From ee27384fa3219a056da5975c0dc5405908b43442 Mon Sep 17 00:00:00 2001 From: Benoit Serie Date: Thu, 18 Aug 2011 14:54:38 +0000 Subject: [PATCH] first commit --- INSTALL | 1 + LICENSE | 281 + UPGRADING | 1 + about.php | 86 + add_dependency.php | 132 + add_escalation.php | 158 + add_host.php | 142 + add_host_template.php | 87 + add_service.php | 185 + add_service_template.php | 86 + autodiscovery.php | 863 ++ autodiscovery/autodiscover.php | 183 + autodiscovery/classes.inc.php | 270 + .../engines/nmap/NmapAutoDiscoveryEngine.php | 127 + build.properties | 10 + cgi.php | 301 + classes/AutodiscoveryDevice.php | 39 + classes/AutodiscoveryDevicePeer.php | 19 + classes/AutodiscoveryDeviceService.php | 30 + classes/AutodiscoveryDeviceServicePeer.php | 19 + classes/AutodiscoveryDeviceTemplateMatch.php | 30 + .../AutodiscoveryDeviceTemplateMatchPeer.php | 19 + classes/AutodiscoveryJob.php | 76 + classes/AutodiscoveryJobPeer.php | 19 + classes/AutodiscoveryLogEntry.php | 55 + classes/AutodiscoveryLogEntryPeer.php | 19 + classes/ExportJob.php | 68 + classes/ExportJobPeer.php | 23 + classes/ExportLogEntry.php | 45 + classes/ExportLogEntryPeer.php | 23 + classes/ImportJob.php | 68 + classes/ImportJobPeer.php | 23 + classes/ImportLogEntry.php | 45 + classes/ImportLogEntryPeer.php | 23 + classes/Label.php | 23 + classes/LabelPeer.php | 27 + classes/LilacConfiguration.php | 30 + classes/LilacConfigurationPeer.php | 19 + classes/LilacCoreModule.php | 25 + classes/Module.php | 226 + classes/NagiosBrokerModule.php | 24 + classes/NagiosBrokerModulePeer.php | 28 + classes/NagiosCgiConfiguration.php | 24 + classes/NagiosCgiConfigurationPeer.php | 27 + classes/NagiosCommand.php | 30 + classes/NagiosCommandPeer.php | 38 + classes/NagiosContact.php | 100 + classes/NagiosContactAddress.php | 23 + classes/NagiosContactAddressPeer.php | 27 + classes/NagiosContactGroup.php | 36 + classes/NagiosContactGroupMember.php | 23 + classes/NagiosContactGroupMemberPeer.php | 27 + classes/NagiosContactGroupPeer.php | 37 + classes/NagiosContactNotificationCommand.php | 23 + .../NagiosContactNotificationCommandPeer.php | 27 + classes/NagiosContactPeer.php | 37 + classes/NagiosDependency.php | 45 + classes/NagiosDependencyPeer.php | 27 + classes/NagiosDependencyTarget.php | 39 + classes/NagiosDependencyTargetPeer.php | 19 + classes/NagiosEscalation.php | 31 + classes/NagiosEscalationContact.php | 30 + classes/NagiosEscalationContactPeer.php | 19 + classes/NagiosEscalationContactgroup.php | 23 + classes/NagiosEscalationContactgroupPeer.php | 27 + classes/NagiosEscalationPeer.php | 27 + classes/NagiosHost.php | 477 ++ classes/NagiosHostCheckCommandParameter.php | 23 + .../NagiosHostCheckCommandParameterPeer.php | 27 + classes/NagiosHostContactMember.php | 30 + classes/NagiosHostContactMemberPeer.php | 19 + classes/NagiosHostContactgroup.php | 23 + classes/NagiosHostContactgroupPeer.php | 27 + classes/NagiosHostParent.php | 23 + classes/NagiosHostParentPeer.php | 27 + classes/NagiosHostPeer.php | 47 + classes/NagiosHostTemplate.php | 523 ++ ...NagiosHostTemplateAutodiscoveryService.php | 30 + ...osHostTemplateAutodiscoveryServicePeer.php | 19 + classes/NagiosHostTemplateInheritance.php | 73 + classes/NagiosHostTemplateInheritancePeer.php | 21 + classes/NagiosHostTemplatePeer.php | 39 + classes/NagiosHostgroup.php | 110 + classes/NagiosHostgroupMembership.php | 23 + classes/NagiosHostgroupMembershipPeer.php | 27 + classes/NagiosHostgroupPeer.php | 37 + classes/NagiosMainConfiguration.php | 122 + classes/NagiosMainConfigurationPeer.php | 27 + classes/NagiosResource.php | 23 + classes/NagiosResourcePeer.php | 27 + classes/NagiosService.php | 451 + .../NagiosServiceCheckCommandParameter.php | 23 + ...NagiosServiceCheckCommandParameterPeer.php | 27 + classes/NagiosServiceContactGroupMember.php | 23 + .../NagiosServiceContactGroupMemberPeer.php | 27 + classes/NagiosServiceContactMember.php | 30 + classes/NagiosServiceContactMemberPeer.php | 19 + classes/NagiosServiceGroup.php | 67 + classes/NagiosServiceGroupMember.php | 23 + classes/NagiosServiceGroupMemberPeer.php | 27 + classes/NagiosServiceGroupPeer.php | 36 + classes/NagiosServicePeer.php | 89 + classes/NagiosServiceTemplate.php | 401 + classes/NagiosServiceTemplateInheritance.php | 66 + .../NagiosServiceTemplateInheritancePeer.php | 19 + classes/NagiosServiceTemplatePeer.php | 37 + classes/NagiosTimeperiod.php | 23 + classes/NagiosTimeperiodEntry.php | 30 + classes/NagiosTimeperiodEntryPeer.php | 19 + classes/NagiosTimeperiodExclude.php | 30 + classes/NagiosTimeperiodExcludePeer.php | 19 + classes/NagiosTimeperiodPeer.php | 37 + classes/map/AutodiscoveryDeviceMapBuilder.php | 89 + .../AutodiscoveryDeviceServiceMapBuilder.php | 83 + ...discoveryDeviceTemplateMatchMapBuilder.php | 77 + classes/map/AutodiscoveryJobMapBuilder.php | 89 + .../map/AutodiscoveryLogEntryMapBuilder.php | 77 + classes/map/ExportJobMapBuilder.php | 89 + classes/map/ExportLogEntryMapBuilder.php | 77 + classes/map/ImportErrorMapBuilder.php | 77 + classes/map/ImportJobMapBuilder.php | 89 + classes/map/ImportLogEntryMapBuilder.php | 77 + classes/map/LabelMapBuilder.php | 75 + classes/map/LilacConfigurationMapBuilder.php | 71 + classes/map/ModuleHookMapBuilder.php | 73 + classes/map/ModuleMapBuilder.php | 77 + classes/map/NagiosBrokerModuleMapBuilder.php | 71 + .../map/NagiosCgiConfigurationMapBuilder.php | 125 + classes/map/NagiosCommandMapBuilder.php | 75 + .../map/NagiosContactAddressMapBuilder.php | 73 + classes/map/NagiosContactGroupMapBuilder.php | 73 + .../NagiosContactGroupMemberMapBuilder.php | 73 + classes/map/NagiosContactMapBuilder.php | 111 + ...osContactNotificationCommandMapBuilder.php | 75 + classes/map/NagiosDependencyMapBuilder.php | 117 + .../map/NagiosDependencyTargetMapBuilder.php | 77 + .../map/NagiosEscalationContactMapBuilder.php | 73 + ...NagiosEscalationContactgroupMapBuilder.php | 73 + classes/map/NagiosEscalationMapBuilder.php | 103 + ...iosHostCheckCommandParameterMapBuilder.php | 75 + .../map/NagiosHostContactMemberMapBuilder.php | 75 + .../map/NagiosHostContactgroupMapBuilder.php | 75 + classes/map/NagiosHostMapBuilder.php | 167 + classes/map/NagiosHostParentMapBuilder.php | 75 + ...TemplateAutodiscoveryServiceMapBuilder.php | 83 + ...agiosHostTemplateInheritanceMapBuilder.php | 77 + classes/map/NagiosHostTemplateMapBuilder.php | 173 + classes/map/NagiosHostgroupMapBuilder.php | 79 + .../NagiosHostgroupMembershipMapBuilder.php | 75 + .../map/NagiosMainConfigurationMapBuilder.php | 319 + classes/map/NagiosResourceMapBuilder.php | 133 + ...ServiceCheckCommandParameterMapBuilder.php | 75 + ...iosServiceContactGroupMemberMapBuilder.php | 75 + .../NagiosServiceContactMemberMapBuilder.php | 75 + classes/map/NagiosServiceGroupMapBuilder.php | 79 + .../NagiosServiceGroupMemberMapBuilder.php | 75 + classes/map/NagiosServiceMapBuilder.php | 169 + ...osServiceTemplateInheritanceMapBuilder.php | 77 + .../map/NagiosServiceTemplateMapBuilder.php | 163 + .../map/NagiosTimeperiodEntryMapBuilder.php | 75 + .../map/NagiosTimeperiodExcludeMapBuilder.php | 73 + classes/map/NagiosTimeperiodMapBuilder.php | 73 + classes/om/BaseAutodiscoveryDevice.php | 1792 ++++ classes/om/BaseAutodiscoveryDevicePeer.php | 1754 ++++ classes/om/BaseAutodiscoveryDeviceService.php | 1047 +++ .../om/BaseAutodiscoveryDeviceServicePeer.php | 952 +++ .../BaseAutodiscoveryDeviceTemplateMatch.php | 981 +++ ...seAutodiscoveryDeviceTemplateMatchPeer.php | 1326 +++ classes/om/BaseAutodiscoveryJob.php | 1765 ++++ classes/om/BaseAutodiscoveryJobPeer.php | 787 ++ classes/om/BaseAutodiscoveryLogEntry.php | 960 +++ classes/om/BaseAutodiscoveryLogEntryPeer.php | 937 +++ classes/om/BaseExportJob.php | 1476 ++++ classes/om/BaseExportJobPeer.php | 778 ++ classes/om/BaseExportLogEntry.php | 960 +++ classes/om/BaseExportLogEntryPeer.php | 937 +++ classes/om/BaseImportError.php | 628 ++ classes/om/BaseImportErrorPeer.php | 785 ++ classes/om/BaseImportJob.php | 1476 ++++ classes/om/BaseImportJobPeer.php | 778 ++ classes/om/BaseImportLogEntry.php | 960 +++ classes/om/BaseImportLogEntryPeer.php | 937 +++ classes/om/BaseLabel.php | 766 ++ classes/om/BaseLabelPeer.php | 697 ++ classes/om/BaseLilacConfiguration.php | 670 ++ classes/om/BaseLilacConfigurationPeer.php | 687 ++ classes/om/BaseModule.php | 1274 +++ classes/om/BaseModulePeer.php | 1372 +++ classes/om/BaseNagiosBrokerModule.php | 670 ++ classes/om/BaseNagiosBrokerModulePeer.php | 687 ++ classes/om/BaseNagiosCgiConfiguration.php | 1966 +++++ classes/om/BaseNagiosCgiConfigurationPeer.php | 822 ++ classes/om/BaseNagiosCommand.php | 5170 ++++++++++++ classes/om/BaseNagiosCommandPeer.php | 928 +++ classes/om/BaseNagiosContact.php | 3304 ++++++++ classes/om/BaseNagiosContactAddress.php | 807 ++ classes/om/BaseNagiosContactAddressPeer.php | 927 +++ classes/om/BaseNagiosContactGroup.php | 1788 ++++ classes/om/BaseNagiosContactGroupMember.php | 885 ++ .../om/BaseNagiosContactGroupMemberPeer.php | 1316 +++ classes/om/BaseNagiosContactGroupPeer.php | 765 ++ .../BaseNagiosContactNotificationCommand.php | 933 +++ ...seNagiosContactNotificationCommandPeer.php | 1321 +++ classes/om/BaseNagiosContactPeer.php | 1450 ++++ classes/om/BaseNagiosDependency.php | 2597 ++++++ classes/om/BaseNagiosDependencyPeer.php | 3156 +++++++ classes/om/BaseNagiosDependencyTarget.php | 1137 +++ classes/om/BaseNagiosDependencyTargetPeer.php | 2064 +++++ classes/om/BaseNagiosEscalation.php | 2409 ++++++ classes/om/BaseNagiosEscalationContact.php | 885 ++ .../om/BaseNagiosEscalationContactPeer.php | 1316 +++ .../om/BaseNagiosEscalationContactgroup.php | 885 ++ .../BaseNagiosEscalationContactgroupPeer.php | 1316 +++ classes/om/BaseNagiosEscalationPeer.php | 3130 +++++++ classes/om/BaseNagiosHost.php | 7149 ++++++++++++++++ .../BaseNagiosHostCheckCommandParameter.php | 933 +++ ...aseNagiosHostCheckCommandParameterPeer.php | 1321 +++ classes/om/BaseNagiosHostContactMember.php | 1011 +++ .../om/BaseNagiosHostContactMemberPeer.php | 1664 ++++ classes/om/BaseNagiosHostContactgroup.php | 1011 +++ classes/om/BaseNagiosHostContactgroupPeer.php | 1664 ++++ classes/om/BaseNagiosHostParent.php | 1011 +++ classes/om/BaseNagiosHostParentPeer.php | 1612 ++++ classes/om/BaseNagiosHostPeer.php | 2357 ++++++ classes/om/BaseNagiosHostTemplate.php | 7394 +++++++++++++++++ ...NagiosHostTemplateAutodiscoveryService.php | 1047 +++ ...osHostTemplateAutodiscoveryServicePeer.php | 952 +++ .../om/BaseNagiosHostTemplateInheritance.php | 1059 +++ .../BaseNagiosHostTemplateInheritancePeer.php | 1617 ++++ classes/om/BaseNagiosHostTemplatePeer.php | 2381 ++++++ classes/om/BaseNagiosHostgroup.php | 2832 +++++++ classes/om/BaseNagiosHostgroupMembership.php | 1011 +++ .../om/BaseNagiosHostgroupMembershipPeer.php | 1664 ++++ classes/om/BaseNagiosHostgroupPeer.php | 789 ++ classes/om/BaseNagiosMainConfiguration.php | 7257 ++++++++++++++++ .../om/BaseNagiosMainConfigurationPeer.php | 3313 ++++++++ classes/om/BaseNagiosResource.php | 2158 +++++ classes/om/BaseNagiosResourcePeer.php | 842 ++ classes/om/BaseNagiosService.php | 6181 ++++++++++++++ ...BaseNagiosServiceCheckCommandParameter.php | 933 +++ ...NagiosServiceCheckCommandParameterPeer.php | 1321 +++ .../BaseNagiosServiceContactGroupMember.php | 1011 +++ ...aseNagiosServiceContactGroupMemberPeer.php | 1664 ++++ classes/om/BaseNagiosServiceContactMember.php | 1011 +++ .../om/BaseNagiosServiceContactMemberPeer.php | 1664 ++++ classes/om/BaseNagiosServiceGroup.php | 1159 +++ classes/om/BaseNagiosServiceGroupMember.php | 1011 +++ .../om/BaseNagiosServiceGroupMemberPeer.php | 1664 ++++ classes/om/BaseNagiosServiceGroupPeer.php | 753 ++ classes/om/BaseNagiosServicePeer.php | 3796 +++++++++ classes/om/BaseNagiosServiceTemplate.php | 5662 +++++++++++++ .../BaseNagiosServiceTemplateInheritance.php | 1059 +++ ...seNagiosServiceTemplateInheritancePeer.php | 1617 ++++ classes/om/BaseNagiosServiceTemplatePeer.php | 2284 +++++ classes/om/BaseNagiosTimeperiod.php | 5155 ++++++++++++ classes/om/BaseNagiosTimeperiodEntry.php | 855 ++ classes/om/BaseNagiosTimeperiodEntryPeer.php | 932 +++ classes/om/BaseNagiosTimeperiodExclude.php | 885 ++ .../om/BaseNagiosTimeperiodExcludePeer.php | 1264 +++ classes/om/BaseNagiosTimeperiodPeer.php | 917 ++ commands.php | 197 + contactgroups.php | 317 + contacts.php | 849 ++ dependency.php | 875 ++ escalation.php | 582 ++ export.php | 439 + exporter/classes.inc.php | 182 + .../engines/nagios/NagiosExportEngine.php | 581 ++ exporter/export.php | 96 + .../exporters/nagios/NagiosCgiExporter.php | 69 + .../nagios/NagiosCommandExporter.php | 59 + .../nagios/NagiosContactExporter.php | 187 + .../nagios/NagiosContactGroupExporter.php | 74 + .../nagios/NagiosDependencyExporter.php | 235 + .../nagios/NagiosEscalationExporter.php | 210 + .../exporters/nagios/NagiosHostExporter.php | 282 + .../nagios/NagiosHostGroupExporter.php | 55 + .../exporters/nagios/NagiosMainExporter.php | 97 + .../nagios/NagiosResourceExporter.php | 50 + .../nagios/NagiosServiceExporter.php | 314 + .../nagios/NagiosServiceGroupExporter.php | 56 + .../nagios/NagiosTimePeriodExporter.php | 78 + favicon.ico | Bin 0 -> 1406 bytes home.php | 42 + host_template.php | 2206 +++++ hostgroups.php | 503 ++ hosts.php | 2197 +++++ images/branch.gif | Bin 0 -> 71 bytes images/branchbottom.gif | Bin 0 -> 73 bytes images/branchtop.gif | Bin 0 -> 68 bytes images/c3-icon-services-sm.gif | Bin 0 -> 1509 bytes images/configurator.gif | Bin 0 -> 477 bytes images/contact.gif | Bin 0 -> 492 bytes images/dotclear.gif | Bin 0 -> 44 bytes images/flexigrid/bg.gif | Bin 0 -> 854 bytes images/flexigrid/btn-sprite.gif | Bin 0 -> 955 bytes images/flexigrid/ddn.png | Bin 0 -> 111 bytes images/flexigrid/dn.png | Bin 0 -> 220 bytes images/flexigrid/fhbg.gif | Bin 0 -> 836 bytes images/flexigrid/first.gif | Bin 0 -> 217 bytes images/flexigrid/hl.png | Bin 0 -> 189 bytes images/flexigrid/last.gif | Bin 0 -> 220 bytes images/flexigrid/line.gif | Bin 0 -> 817 bytes images/flexigrid/load.gif | Bin 0 -> 1737 bytes images/flexigrid/load.png | Bin 0 -> 827 bytes images/flexigrid/magnifier.png | Bin 0 -> 615 bytes images/flexigrid/next.gif | Bin 0 -> 185 bytes images/flexigrid/prev.gif | Bin 0 -> 186 bytes images/flexigrid/up.png | Bin 0 -> 224 bytes images/flexigrid/uup.png | Bin 0 -> 130 bytes images/flexigrid/wbg.gif | Bin 0 -> 868 bytes images/folder-expanded.gif | Bin 0 -> 924 bytes images/folder.gif | Bin 0 -> 923 bytes images/gradient.gif | Bin 0 -> 13160 bytes images/icons/accept.png | Bin 0 -> 781 bytes images/icons/add.png | Bin 0 -> 733 bytes images/icons/anchor.png | Bin 0 -> 523 bytes images/icons/application.png | Bin 0 -> 464 bytes images/icons/application_add.png | Bin 0 -> 619 bytes images/icons/application_cascade.png | Bin 0 -> 524 bytes images/icons/application_delete.png | Bin 0 -> 610 bytes images/icons/application_double.png | Bin 0 -> 533 bytes images/icons/application_edit.png | Bin 0 -> 703 bytes images/icons/application_error.png | Bin 0 -> 656 bytes images/icons/application_form.png | Bin 0 -> 467 bytes images/icons/application_form_add.png | Bin 0 -> 592 bytes images/icons/application_form_delete.png | Bin 0 -> 605 bytes images/icons/application_form_edit.png | Bin 0 -> 714 bytes images/icons/application_form_magnify.png | Bin 0 -> 612 bytes images/icons/application_get.png | Bin 0 -> 581 bytes images/icons/application_go.png | Bin 0 -> 634 bytes images/icons/application_home.png | Bin 0 -> 685 bytes images/icons/application_key.png | Bin 0 -> 670 bytes images/icons/application_lightning.png | Bin 0 -> 656 bytes images/icons/application_link.png | Bin 0 -> 701 bytes images/icons/application_osx.png | Bin 0 -> 487 bytes images/icons/application_osx_terminal.png | Bin 0 -> 525 bytes images/icons/application_put.png | Bin 0 -> 585 bytes images/icons/application_side_boxes.png | Bin 0 -> 478 bytes images/icons/application_side_contract.png | Bin 0 -> 547 bytes images/icons/application_side_expand.png | Bin 0 -> 581 bytes images/icons/application_side_list.png | Bin 0 -> 510 bytes images/icons/application_side_tree.png | Bin 0 -> 483 bytes images/icons/application_split.png | Bin 0 -> 520 bytes images/icons/application_tile_horizontal.png | Bin 0 -> 432 bytes images/icons/application_tile_vertical.png | Bin 0 -> 492 bytes images/icons/application_view_columns.png | Bin 0 -> 493 bytes images/icons/application_view_detail.png | Bin 0 -> 576 bytes images/icons/application_view_gallery.png | Bin 0 -> 555 bytes images/icons/application_view_icons.png | Bin 0 -> 476 bytes images/icons/application_view_list.png | Bin 0 -> 473 bytes images/icons/application_view_tile.png | Bin 0 -> 465 bytes images/icons/application_xp.png | Bin 0 -> 426 bytes images/icons/application_xp_terminal.png | Bin 0 -> 507 bytes images/icons/arrow_branch.png | Bin 0 -> 582 bytes images/icons/arrow_divide.png | Bin 0 -> 677 bytes images/icons/arrow_down.png | Bin 0 -> 379 bytes images/icons/arrow_in.png | Bin 0 -> 600 bytes images/icons/arrow_inout.png | Bin 0 -> 551 bytes images/icons/arrow_join.png | Bin 0 -> 626 bytes images/icons/arrow_left.png | Bin 0 -> 345 bytes images/icons/arrow_merge.png | Bin 0 -> 484 bytes images/icons/arrow_out.png | Bin 0 -> 594 bytes images/icons/arrow_redo.png | Bin 0 -> 625 bytes images/icons/arrow_refresh.png | Bin 0 -> 685 bytes images/icons/arrow_refresh_small.png | Bin 0 -> 506 bytes images/icons/arrow_right.png | Bin 0 -> 349 bytes images/icons/arrow_rotate_anticlockwise.png | Bin 0 -> 608 bytes images/icons/arrow_rotate_clockwise.png | Bin 0 -> 602 bytes images/icons/arrow_switch.png | Bin 0 -> 683 bytes images/icons/arrow_turn_left.png | Bin 0 -> 516 bytes images/icons/arrow_turn_right.png | Bin 0 -> 489 bytes images/icons/arrow_undo.png | Bin 0 -> 631 bytes images/icons/arrow_up.png | Bin 0 -> 372 bytes images/icons/asterisk_orange.png | Bin 0 -> 760 bytes images/icons/asterisk_yellow.png | Bin 0 -> 743 bytes images/icons/attach.png | Bin 0 -> 391 bytes images/icons/award_star_add.png | Bin 0 -> 853 bytes images/icons/award_star_bronze_1.png | Bin 0 -> 733 bytes images/icons/award_star_bronze_2.png | Bin 0 -> 755 bytes images/icons/award_star_bronze_3.png | Bin 0 -> 754 bytes images/icons/award_star_delete.png | Bin 0 -> 849 bytes images/icons/award_star_gold_1.png | Bin 0 -> 753 bytes images/icons/award_star_gold_2.png | Bin 0 -> 770 bytes images/icons/award_star_gold_3.png | Bin 0 -> 781 bytes images/icons/award_star_silver_1.png | Bin 0 -> 714 bytes images/icons/award_star_silver_2.png | Bin 0 -> 734 bytes images/icons/award_star_silver_3.png | Bin 0 -> 738 bytes images/icons/basket.png | Bin 0 -> 669 bytes images/icons/basket_add.png | Bin 0 -> 752 bytes images/icons/basket_delete.png | Bin 0 -> 773 bytes images/icons/basket_edit.png | Bin 0 -> 811 bytes images/icons/basket_error.png | Bin 0 -> 794 bytes images/icons/basket_go.png | Bin 0 -> 777 bytes images/icons/basket_put.png | Bin 0 -> 733 bytes images/icons/basket_remove.png | Bin 0 -> 738 bytes images/icons/bell.png | Bin 0 -> 789 bytes images/icons/bell_add.png | Bin 0 -> 816 bytes images/icons/bell_delete.png | Bin 0 -> 824 bytes images/icons/bell_error.png | Bin 0 -> 813 bytes images/icons/bell_go.png | Bin 0 -> 836 bytes images/icons/bell_link.png | Bin 0 -> 850 bytes images/icons/bin.png | Bin 0 -> 476 bytes images/icons/bin_closed.png | Bin 0 -> 363 bytes images/icons/bin_empty.png | Bin 0 -> 475 bytes images/icons/bomb.png | Bin 0 -> 793 bytes images/icons/book.png | Bin 0 -> 593 bytes images/icons/book_add.png | Bin 0 -> 714 bytes images/icons/book_addresses.png | Bin 0 -> 770 bytes images/icons/book_delete.png | Bin 0 -> 719 bytes images/icons/book_edit.png | Bin 0 -> 813 bytes images/icons/book_error.png | Bin 0 -> 734 bytes images/icons/book_go.png | Bin 0 -> 745 bytes images/icons/book_key.png | Bin 0 -> 779 bytes images/icons/book_link.png | Bin 0 -> 789 bytes images/icons/book_next.png | Bin 0 -> 702 bytes images/icons/book_open.png | Bin 0 -> 622 bytes images/icons/book_previous.png | Bin 0 -> 680 bytes images/icons/box.png | Bin 0 -> 555 bytes images/icons/brick.png | Bin 0 -> 452 bytes images/icons/brick_add.png | Bin 0 -> 729 bytes images/icons/brick_delete.png | Bin 0 -> 745 bytes images/icons/brick_edit.png | Bin 0 -> 775 bytes images/icons/brick_error.png | Bin 0 -> 798 bytes images/icons/brick_go.png | Bin 0 -> 790 bytes images/icons/brick_link.png | Bin 0 -> 764 bytes images/icons/bricks.png | Bin 0 -> 825 bytes images/icons/briefcase.png | Bin 0 -> 793 bytes images/icons/bug.png | Bin 0 -> 774 bytes images/icons/bug_add.png | Bin 0 -> 806 bytes images/icons/bug_delete.png | Bin 0 -> 836 bytes images/icons/bug_edit.png | Bin 0 -> 873 bytes images/icons/bug_error.png | Bin 0 -> 841 bytes images/icons/bug_go.png | Bin 0 -> 831 bytes images/icons/bug_link.png | Bin 0 -> 847 bytes images/icons/building.png | Bin 0 -> 556 bytes images/icons/building_add.png | Bin 0 -> 631 bytes images/icons/building_delete.png | Bin 0 -> 633 bytes images/icons/building_edit.png | Bin 0 -> 731 bytes images/icons/building_error.png | Bin 0 -> 653 bytes images/icons/building_go.png | Bin 0 -> 665 bytes images/icons/building_key.png | Bin 0 -> 705 bytes images/icons/building_link.png | Bin 0 -> 668 bytes images/icons/bullet_add.png | Bin 0 -> 286 bytes images/icons/bullet_arrow_bottom.png | Bin 0 -> 229 bytes images/icons/bullet_arrow_down.png | Bin 0 -> 201 bytes images/icons/bullet_arrow_top.png | Bin 0 -> 230 bytes images/icons/bullet_arrow_up.png | Bin 0 -> 201 bytes images/icons/bullet_black.png | Bin 0 -> 211 bytes images/icons/bullet_blue.png | Bin 0 -> 289 bytes images/icons/bullet_delete.png | Bin 0 -> 308 bytes images/icons/bullet_disk.png | Bin 0 -> 483 bytes images/icons/bullet_error.png | Bin 0 -> 454 bytes images/icons/bullet_feed.png | Bin 0 -> 262 bytes images/icons/bullet_go.png | Bin 0 -> 410 bytes images/icons/bullet_green.png | Bin 0 -> 295 bytes images/icons/bullet_key.png | Bin 0 -> 436 bytes images/icons/bullet_orange.png | Bin 0 -> 283 bytes images/icons/bullet_picture.png | Bin 0 -> 470 bytes images/icons/bullet_pink.png | Bin 0 -> 286 bytes images/icons/bullet_purple.png | Bin 0 -> 294 bytes images/icons/bullet_red.png | Bin 0 -> 287 bytes images/icons/bullet_star.png | Bin 0 -> 331 bytes images/icons/bullet_toggle_minus.png | Bin 0 -> 207 bytes images/icons/bullet_toggle_plus.png | Bin 0 -> 209 bytes images/icons/bullet_white.png | Bin 0 -> 201 bytes images/icons/bullet_wrench.png | Bin 0 -> 448 bytes images/icons/bullet_yellow.png | Bin 0 -> 287 bytes images/icons/cake.png | Bin 0 -> 676 bytes images/icons/calculator.png | Bin 0 -> 543 bytes images/icons/calculator_add.png | Bin 0 -> 660 bytes images/icons/calculator_delete.png | Bin 0 -> 692 bytes images/icons/calculator_edit.png | Bin 0 -> 767 bytes images/icons/calculator_error.png | Bin 0 -> 731 bytes images/icons/calculator_link.png | Bin 0 -> 723 bytes images/icons/calendar.png | Bin 0 -> 675 bytes images/icons/calendar_add.png | Bin 0 -> 723 bytes images/icons/calendar_delete.png | Bin 0 -> 742 bytes images/icons/calendar_edit.png | Bin 0 -> 777 bytes images/icons/calendar_link.png | Bin 0 -> 795 bytes images/icons/calendar_view_day.png | Bin 0 -> 572 bytes images/icons/calendar_view_month.png | Bin 0 -> 595 bytes images/icons/calendar_view_week.png | Bin 0 -> 480 bytes images/icons/camera.png | Bin 0 -> 665 bytes images/icons/camera_add.png | Bin 0 -> 800 bytes images/icons/camera_delete.png | Bin 0 -> 797 bytes images/icons/camera_edit.png | Bin 0 -> 872 bytes images/icons/camera_error.png | Bin 0 -> 835 bytes images/icons/camera_go.png | Bin 0 -> 809 bytes images/icons/camera_link.png | Bin 0 -> 839 bytes images/icons/camera_small.png | Bin 0 -> 489 bytes images/icons/cancel.png | Bin 0 -> 587 bytes images/icons/car.png | Bin 0 -> 610 bytes images/icons/car_add.png | Bin 0 -> 677 bytes images/icons/car_delete.png | Bin 0 -> 689 bytes images/icons/cart.png | Bin 0 -> 421 bytes images/icons/cart_add.png | Bin 0 -> 711 bytes images/icons/cart_delete.png | Bin 0 -> 742 bytes images/icons/cart_edit.png | Bin 0 -> 789 bytes images/icons/cart_error.png | Bin 0 -> 790 bytes images/icons/cart_go.png | Bin 0 -> 763 bytes images/icons/cart_put.png | Bin 0 -> 763 bytes images/icons/cart_remove.png | Bin 0 -> 769 bytes images/icons/cd.png | Bin 0 -> 673 bytes images/icons/cd_add.png | Bin 0 -> 758 bytes images/icons/cd_burn.png | Bin 0 -> 756 bytes images/icons/cd_delete.png | Bin 0 -> 767 bytes images/icons/cd_edit.png | Bin 0 -> 790 bytes images/icons/cd_eject.png | Bin 0 -> 786 bytes images/icons/cd_go.png | Bin 0 -> 793 bytes images/icons/chart_bar.png | Bin 0 -> 541 bytes images/icons/chart_bar_add.png | Bin 0 -> 626 bytes images/icons/chart_bar_delete.png | Bin 0 -> 636 bytes images/icons/chart_bar_edit.png | Bin 0 -> 754 bytes images/icons/chart_bar_error.png | Bin 0 -> 671 bytes images/icons/chart_bar_link.png | Bin 0 -> 712 bytes images/icons/chart_curve.png | Bin 0 -> 710 bytes images/icons/chart_curve_add.png | Bin 0 -> 761 bytes images/icons/chart_curve_delete.png | Bin 0 -> 782 bytes images/icons/chart_curve_edit.png | Bin 0 -> 822 bytes images/icons/chart_curve_error.png | Bin 0 -> 837 bytes images/icons/chart_curve_go.png | Bin 0 -> 823 bytes images/icons/chart_curve_link.png | Bin 0 -> 829 bytes images/icons/chart_line.png | Bin 0 -> 526 bytes images/icons/chart_line_add.png | Bin 0 -> 655 bytes images/icons/chart_line_delete.png | Bin 0 -> 675 bytes images/icons/chart_line_edit.png | Bin 0 -> 718 bytes images/icons/chart_line_error.png | Bin 0 -> 741 bytes images/icons/chart_line_link.png | Bin 0 -> 749 bytes images/icons/chart_organisation.png | Bin 0 -> 444 bytes images/icons/chart_organisation_add.png | Bin 0 -> 551 bytes images/icons/chart_organisation_delete.png | Bin 0 -> 563 bytes images/icons/chart_pie.png | Bin 0 -> 918 bytes images/icons/chart_pie_add.png | Bin 0 -> 975 bytes images/icons/chart_pie_delete.png | Bin 0 -> 983 bytes images/icons/chart_pie_edit.png | Bin 0 -> 986 bytes images/icons/chart_pie_error.png | Bin 0 -> 989 bytes images/icons/chart_pie_link.png | Bin 0 -> 1021 bytes images/icons/clock.png | Bin 0 -> 882 bytes images/icons/clock_add.png | Bin 0 -> 925 bytes images/icons/clock_delete.png | Bin 0 -> 952 bytes images/icons/clock_edit.png | Bin 0 -> 967 bytes images/icons/clock_error.png | Bin 0 -> 953 bytes images/icons/clock_go.png | Bin 0 -> 959 bytes images/icons/clock_link.png | Bin 0 -> 961 bytes images/icons/clock_pause.png | Bin 0 -> 927 bytes images/icons/clock_play.png | Bin 0 -> 943 bytes images/icons/clock_red.png | Bin 0 -> 889 bytes images/icons/clock_stop.png | Bin 0 -> 922 bytes images/icons/cog.png | Bin 0 -> 512 bytes images/icons/cog_add.png | Bin 0 -> 814 bytes images/icons/cog_delete.png | Bin 0 -> 847 bytes images/icons/cog_edit.png | Bin 0 -> 865 bytes images/icons/cog_error.png | Bin 0 -> 869 bytes images/icons/cog_go.png | Bin 0 -> 859 bytes images/icons/coins.png | Bin 0 -> 732 bytes images/icons/coins_add.png | Bin 0 -> 789 bytes images/icons/coins_delete.png | Bin 0 -> 775 bytes images/icons/color_swatch.png | Bin 0 -> 209 bytes images/icons/color_wheel.png | Bin 0 -> 892 bytes images/icons/comment.png | Bin 0 -> 413 bytes images/icons/comment_add.png | Bin 0 -> 530 bytes images/icons/comment_delete.png | Bin 0 -> 548 bytes images/icons/comment_edit.png | Bin 0 -> 644 bytes images/icons/comments.png | Bin 0 -> 557 bytes images/icons/comments_add.png | Bin 0 -> 648 bytes images/icons/comments_delete.png | Bin 0 -> 670 bytes images/icons/compress.png | Bin 0 -> 766 bytes images/icons/computer.png | Bin 0 -> 667 bytes images/icons/computer_add.png | Bin 0 -> 781 bytes images/icons/computer_delete.png | Bin 0 -> 775 bytes images/icons/computer_edit.png | Bin 0 -> 792 bytes images/icons/computer_error.png | Bin 0 -> 784 bytes images/icons/computer_go.png | Bin 0 -> 777 bytes images/icons/computer_key.png | Bin 0 -> 771 bytes images/icons/computer_link.png | Bin 0 -> 792 bytes images/icons/connect.png | Bin 0 -> 748 bytes images/icons/contrast.png | Bin 0 -> 434 bytes images/icons/contrast_decrease.png | Bin 0 -> 695 bytes images/icons/contrast_high.png | Bin 0 -> 435 bytes images/icons/contrast_increase.png | Bin 0 -> 717 bytes images/icons/contrast_low.png | Bin 0 -> 421 bytes images/icons/control_eject.png | Bin 0 -> 603 bytes images/icons/control_eject_blue.png | Bin 0 -> 727 bytes images/icons/control_end.png | Bin 0 -> 621 bytes images/icons/control_end_blue.png | Bin 0 -> 737 bytes images/icons/control_equalizer.png | Bin 0 -> 432 bytes images/icons/control_equalizer_blue.png | Bin 0 -> 764 bytes images/icons/control_fastforward.png | Bin 0 -> 607 bytes images/icons/control_fastforward_blue.png | Bin 0 -> 736 bytes images/icons/control_pause.png | Bin 0 -> 598 bytes images/icons/control_pause_blue.png | Bin 0 -> 721 bytes images/icons/control_play.png | Bin 0 -> 592 bytes images/icons/control_play_blue.png | Bin 0 -> 717 bytes images/icons/control_repeat.png | Bin 0 -> 422 bytes images/icons/control_repeat_blue.png | Bin 0 -> 750 bytes images/icons/control_rewind.png | Bin 0 -> 614 bytes images/icons/control_rewind_blue.png | Bin 0 -> 745 bytes images/icons/control_start.png | Bin 0 -> 604 bytes images/icons/control_start_blue.png | Bin 0 -> 720 bytes images/icons/control_stop.png | Bin 0 -> 403 bytes images/icons/control_stop_blue.png | Bin 0 -> 695 bytes images/icons/controller.png | Bin 0 -> 666 bytes images/icons/controller_add.png | Bin 0 -> 759 bytes images/icons/controller_delete.png | Bin 0 -> 770 bytes images/icons/controller_error.png | Bin 0 -> 815 bytes images/icons/creditcards.png | Bin 0 -> 693 bytes images/icons/cross.png | Bin 0 -> 655 bytes images/icons/css.png | Bin 0 -> 524 bytes images/icons/css_add.png | Bin 0 -> 666 bytes images/icons/css_delete.png | Bin 0 -> 654 bytes images/icons/css_go.png | Bin 0 -> 655 bytes images/icons/css_valid.png | Bin 0 -> 661 bytes images/icons/cup.png | Bin 0 -> 633 bytes images/icons/cup_add.png | Bin 0 -> 715 bytes images/icons/cup_delete.png | Bin 0 -> 731 bytes images/icons/cup_edit.png | Bin 0 -> 778 bytes images/icons/cup_error.png | Bin 0 -> 790 bytes images/icons/cup_go.png | Bin 0 -> 780 bytes images/icons/cup_key.png | Bin 0 -> 776 bytes images/icons/cup_link.png | Bin 0 -> 760 bytes images/icons/cursor.png | Bin 0 -> 354 bytes images/icons/cut.png | Bin 0 -> 648 bytes images/icons/cut_red.png | Bin 0 -> 650 bytes images/icons/database.png | Bin 0 -> 390 bytes images/icons/database_add.png | Bin 0 -> 658 bytes images/icons/database_connect.png | Bin 0 -> 763 bytes images/icons/database_delete.png | Bin 0 -> 659 bytes images/icons/database_edit.png | Bin 0 -> 767 bytes images/icons/database_error.png | Bin 0 -> 682 bytes images/icons/database_gear.png | Bin 0 -> 468 bytes images/icons/database_go.png | Bin 0 -> 698 bytes images/icons/database_key.png | Bin 0 -> 764 bytes images/icons/database_lightning.png | Bin 0 -> 775 bytes images/icons/database_link.png | Bin 0 -> 679 bytes images/icons/database_refresh.png | Bin 0 -> 770 bytes images/icons/database_save.png | Bin 0 -> 755 bytes images/icons/database_table.png | Bin 0 -> 726 bytes images/icons/date.png | Bin 0 -> 626 bytes images/icons/date_add.png | Bin 0 -> 703 bytes images/icons/date_delete.png | Bin 0 -> 716 bytes images/icons/date_edit.png | Bin 0 -> 799 bytes images/icons/date_error.png | Bin 0 -> 753 bytes images/icons/date_go.png | Bin 0 -> 753 bytes images/icons/date_link.png | Bin 0 -> 764 bytes images/icons/date_magnify.png | Bin 0 -> 711 bytes images/icons/date_next.png | Bin 0 -> 688 bytes images/icons/date_previous.png | Bin 0 -> 720 bytes images/icons/delete.png | Bin 0 -> 715 bytes images/icons/disconnect.png | Bin 0 -> 796 bytes images/icons/disk.png | Bin 0 -> 620 bytes images/icons/disk_multiple.png | Bin 0 -> 691 bytes images/icons/door.png | Bin 0 -> 412 bytes images/icons/door_in.png | Bin 0 -> 693 bytes images/icons/door_open.png | Bin 0 -> 508 bytes images/icons/door_out.png | Bin 0 -> 688 bytes images/icons/drink.png | Bin 0 -> 692 bytes images/icons/drink_empty.png | Bin 0 -> 433 bytes images/icons/drive.png | Bin 0 -> 346 bytes images/icons/drive_add.png | Bin 0 -> 623 bytes images/icons/drive_burn.png | Bin 0 -> 608 bytes images/icons/drive_cd.png | Bin 0 -> 734 bytes images/icons/drive_cd_empty.png | Bin 0 -> 341 bytes images/icons/drive_delete.png | Bin 0 -> 628 bytes images/icons/drive_disk.png | Bin 0 -> 695 bytes images/icons/drive_edit.png | Bin 0 -> 714 bytes images/icons/drive_error.png | Bin 0 -> 705 bytes images/icons/drive_go.png | Bin 0 -> 661 bytes images/icons/drive_key.png | Bin 0 -> 681 bytes images/icons/drive_link.png | Bin 0 -> 679 bytes images/icons/drive_magnify.png | Bin 0 -> 641 bytes images/icons/drive_network.png | Bin 0 -> 585 bytes images/icons/drive_rename.png | Bin 0 -> 494 bytes images/icons/drive_user.png | Bin 0 -> 712 bytes images/icons/drive_web.png | Bin 0 -> 686 bytes images/icons/dvd.png | Bin 0 -> 764 bytes images/icons/dvd_add.png | Bin 0 -> 788 bytes images/icons/dvd_delete.png | Bin 0 -> 800 bytes images/icons/dvd_edit.png | Bin 0 -> 844 bytes images/icons/dvd_error.png | Bin 0 -> 854 bytes images/icons/dvd_go.png | Bin 0 -> 854 bytes images/icons/dvd_key.png | Bin 0 -> 816 bytes images/icons/dvd_link.png | Bin 0 -> 819 bytes images/icons/email.png | Bin 0 -> 641 bytes images/icons/email_add.png | Bin 0 -> 761 bytes images/icons/email_attach.png | Bin 0 -> 793 bytes images/icons/email_delete.png | Bin 0 -> 756 bytes images/icons/email_edit.png | Bin 0 -> 756 bytes images/icons/email_error.png | Bin 0 -> 792 bytes images/icons/email_go.png | Bin 0 -> 754 bytes images/icons/email_link.png | Bin 0 -> 821 bytes images/icons/email_open.png | Bin 0 -> 783 bytes images/icons/email_open_image.png | Bin 0 -> 811 bytes images/icons/emoticon_evilgrin.png | Bin 0 -> 727 bytes images/icons/emoticon_grin.png | Bin 0 -> 714 bytes images/icons/emoticon_happy.png | Bin 0 -> 731 bytes images/icons/emoticon_smile.png | Bin 0 -> 725 bytes images/icons/emoticon_surprised.png | Bin 0 -> 741 bytes images/icons/emoticon_tongue.png | Bin 0 -> 727 bytes images/icons/emoticon_unhappy.png | Bin 0 -> 723 bytes images/icons/emoticon_waii.png | Bin 0 -> 737 bytes images/icons/emoticon_wink.png | Bin 0 -> 712 bytes images/icons/error.png | Bin 0 -> 666 bytes images/icons/error_add.png | Bin 0 -> 710 bytes images/icons/error_delete.png | Bin 0 -> 729 bytes images/icons/error_go.png | Bin 0 -> 734 bytes images/icons/exclamation.png | Bin 0 -> 701 bytes images/icons/eye.png | Bin 0 -> 750 bytes images/icons/feed.png | Bin 0 -> 691 bytes images/icons/feed_add.png | Bin 0 -> 763 bytes images/icons/feed_delete.png | Bin 0 -> 746 bytes images/icons/feed_disk.png | Bin 0 -> 738 bytes images/icons/feed_edit.png | Bin 0 -> 801 bytes images/icons/feed_error.png | Bin 0 -> 770 bytes images/icons/feed_go.png | Bin 0 -> 761 bytes images/icons/feed_key.png | Bin 0 -> 771 bytes images/icons/feed_link.png | Bin 0 -> 806 bytes images/icons/feed_magnify.png | Bin 0 -> 737 bytes images/icons/female.png | Bin 0 -> 590 bytes images/icons/film.png | Bin 0 -> 653 bytes images/icons/film_add.png | Bin 0 -> 739 bytes images/icons/film_delete.png | Bin 0 -> 730 bytes images/icons/film_edit.png | Bin 0 -> 855 bytes images/icons/film_error.png | Bin 0 -> 800 bytes images/icons/film_go.png | Bin 0 -> 813 bytes images/icons/film_key.png | Bin 0 -> 835 bytes images/icons/film_link.png | Bin 0 -> 830 bytes images/icons/film_save.png | Bin 0 -> 806 bytes images/icons/find.png | Bin 0 -> 659 bytes images/icons/flag_blue.png | Bin 0 -> 671 bytes images/icons/flag_green.png | Bin 0 -> 672 bytes images/icons/flag_orange.png | Bin 0 -> 669 bytes images/icons/flag_pink.png | Bin 0 -> 651 bytes images/icons/flag_purple.png | Bin 0 -> 656 bytes images/icons/flag_red.png | Bin 0 -> 665 bytes images/icons/flag_yellow.png | Bin 0 -> 671 bytes images/icons/folder.png | Bin 0 -> 537 bytes images/icons/folder_add.png | Bin 0 -> 668 bytes images/icons/folder_bell.png | Bin 0 -> 781 bytes images/icons/folder_brick.png | Bin 0 -> 735 bytes images/icons/folder_bug.png | Bin 0 -> 829 bytes images/icons/folder_camera.png | Bin 0 -> 729 bytes images/icons/folder_database.png | Bin 0 -> 687 bytes images/icons/folder_delete.png | Bin 0 -> 666 bytes images/icons/folder_edit.png | Bin 0 -> 733 bytes images/icons/folder_error.png | Bin 0 -> 727 bytes images/icons/folder_explore.png | Bin 0 -> 679 bytes images/icons/folder_feed.png | Bin 0 -> 691 bytes images/icons/folder_find.png | Bin 0 -> 795 bytes images/icons/folder_go.png | Bin 0 -> 694 bytes images/icons/folder_heart.png | Bin 0 -> 741 bytes images/icons/folder_image.png | Bin 0 -> 677 bytes images/icons/folder_key.png | Bin 0 -> 720 bytes images/icons/folder_lightbulb.png | Bin 0 -> 741 bytes images/icons/folder_link.png | Bin 0 -> 785 bytes images/icons/folder_magnify.png | Bin 0 -> 686 bytes images/icons/folder_page.png | Bin 0 -> 688 bytes images/icons/folder_page_white.png | Bin 0 -> 639 bytes images/icons/folder_palette.png | Bin 0 -> 822 bytes images/icons/folder_picture.png | Bin 0 -> 713 bytes images/icons/folder_star.png | Bin 0 -> 755 bytes images/icons/folder_table.png | Bin 0 -> 675 bytes images/icons/folder_user.png | Bin 0 -> 730 bytes images/icons/folder_wrench.png | Bin 0 -> 740 bytes images/icons/font.png | Bin 0 -> 567 bytes images/icons/font_add.png | Bin 0 -> 634 bytes images/icons/font_delete.png | Bin 0 -> 661 bytes images/icons/font_go.png | Bin 0 -> 700 bytes images/icons/group.png | Bin 0 -> 753 bytes images/icons/group_add.png | Bin 0 -> 807 bytes images/icons/group_delete.png | Bin 0 -> 827 bytes images/icons/group_edit.png | Bin 0 -> 785 bytes images/icons/group_error.png | Bin 0 -> 842 bytes images/icons/group_gear.png | Bin 0 -> 824 bytes images/icons/group_go.png | Bin 0 -> 842 bytes images/icons/group_key.png | Bin 0 -> 813 bytes images/icons/group_link.png | Bin 0 -> 858 bytes images/icons/heart.png | Bin 0 -> 749 bytes images/icons/heart_add.png | Bin 0 -> 820 bytes images/icons/heart_delete.png | Bin 0 -> 823 bytes images/icons/help.png | Bin 0 -> 786 bytes images/icons/hourglass.png | Bin 0 -> 744 bytes images/icons/hourglass_add.png | Bin 0 -> 814 bytes images/icons/hourglass_delete.png | Bin 0 -> 829 bytes images/icons/hourglass_go.png | Bin 0 -> 866 bytes images/icons/hourglass_link.png | Bin 0 -> 871 bytes images/icons/house.png | Bin 0 -> 806 bytes images/icons/house_go.png | Bin 0 -> 861 bytes images/icons/house_link.png | Bin 0 -> 868 bytes images/icons/html.png | Bin 0 -> 578 bytes images/icons/html_add.png | Bin 0 -> 698 bytes images/icons/html_delete.png | Bin 0 -> 688 bytes images/icons/html_go.png | Bin 0 -> 692 bytes images/icons/html_valid.png | Bin 0 -> 704 bytes images/icons/image.png | Bin 0 -> 516 bytes images/icons/image_add.png | Bin 0 -> 653 bytes images/icons/image_delete.png | Bin 0 -> 653 bytes images/icons/image_edit.png | Bin 0 -> 783 bytes images/icons/image_link.png | Bin 0 -> 773 bytes images/icons/images.png | Bin 0 -> 661 bytes images/icons/information.png | Bin 0 -> 778 bytes images/icons/ipod.png | Bin 0 -> 463 bytes images/icons/ipod_cast.png | Bin 0 -> 711 bytes images/icons/ipod_cast_add.png | Bin 0 -> 796 bytes images/icons/ipod_cast_delete.png | Bin 0 -> 809 bytes images/icons/ipod_sound.png | Bin 0 -> 678 bytes images/icons/joystick.png | Bin 0 -> 559 bytes images/icons/joystick_add.png | Bin 0 -> 669 bytes images/icons/joystick_delete.png | Bin 0 -> 671 bytes images/icons/joystick_error.png | Bin 0 -> 711 bytes images/icons/key.png | Bin 0 -> 612 bytes images/icons/key_add.png | Bin 0 -> 703 bytes images/icons/key_delete.png | Bin 0 -> 724 bytes images/icons/key_go.png | Bin 0 -> 744 bytes images/icons/keyboard.png | Bin 0 -> 570 bytes images/icons/keyboard_add.png | Bin 0 -> 683 bytes images/icons/keyboard_delete.png | Bin 0 -> 681 bytes images/icons/keyboard_magnify.png | Bin 0 -> 651 bytes images/icons/layers.png | Bin 0 -> 597 bytes images/icons/layout.png | Bin 0 -> 480 bytes images/icons/layout_add.png | Bin 0 -> 577 bytes images/icons/layout_content.png | Bin 0 -> 519 bytes images/icons/layout_delete.png | Bin 0 -> 608 bytes images/icons/layout_edit.png | Bin 0 -> 716 bytes images/icons/layout_error.png | Bin 0 -> 666 bytes images/icons/layout_header.png | Bin 0 -> 500 bytes images/icons/layout_link.png | Bin 0 -> 660 bytes images/icons/layout_sidebar.png | Bin 0 -> 479 bytes images/icons/lightbulb.png | Bin 0 -> 782 bytes images/icons/lightbulb_add.png | Bin 0 -> 839 bytes images/icons/lightbulb_delete.png | Bin 0 -> 857 bytes images/icons/lightbulb_off.png | Bin 0 -> 700 bytes images/icons/lightning.png | Bin 0 -> 634 bytes images/icons/lightning_add.png | Bin 0 -> 746 bytes images/icons/lightning_delete.png | Bin 0 -> 745 bytes images/icons/lightning_go.png | Bin 0 -> 739 bytes images/icons/link.png | Bin 0 -> 343 bytes images/icons/link_add.png | Bin 0 -> 570 bytes images/icons/link_break.png | Bin 0 -> 657 bytes images/icons/link_delete.png | Bin 0 -> 600 bytes images/icons/link_edit.png | Bin 0 -> 703 bytes images/icons/link_error.png | Bin 0 -> 698 bytes images/icons/link_go.png | Bin 0 -> 655 bytes images/icons/lock.png | Bin 0 -> 749 bytes images/icons/lock_add.png | Bin 0 -> 824 bytes images/icons/lock_break.png | Bin 0 -> 771 bytes images/icons/lock_delete.png | Bin 0 -> 815 bytes images/icons/lock_edit.png | Bin 0 -> 861 bytes images/icons/lock_go.png | Bin 0 -> 829 bytes images/icons/lock_open.png | Bin 0 -> 727 bytes images/icons/lorry.png | Bin 0 -> 582 bytes images/icons/lorry_add.png | Bin 0 -> 689 bytes images/icons/lorry_delete.png | Bin 0 -> 683 bytes images/icons/lorry_error.png | Bin 0 -> 739 bytes images/icons/lorry_flatbed.png | Bin 0 -> 450 bytes images/icons/lorry_go.png | Bin 0 -> 699 bytes images/icons/lorry_link.png | Bin 0 -> 775 bytes images/icons/magifier_zoom_out.png | Bin 0 -> 657 bytes images/icons/magnifier.png | Bin 0 -> 615 bytes images/icons/magnifier_zoom_in.png | Bin 0 -> 680 bytes images/icons/male.png | Bin 0 -> 629 bytes images/icons/map.png | Bin 0 -> 804 bytes images/icons/map_add.png | Bin 0 -> 836 bytes images/icons/map_delete.png | Bin 0 -> 835 bytes images/icons/map_edit.png | Bin 0 -> 876 bytes images/icons/map_go.png | Bin 0 -> 842 bytes images/icons/map_magnify.png | Bin 0 -> 797 bytes images/icons/medal_bronze_1.png | Bin 0 -> 640 bytes images/icons/medal_bronze_2.png | Bin 0 -> 654 bytes images/icons/medal_bronze_3.png | Bin 0 -> 646 bytes images/icons/medal_bronze_add.png | Bin 0 -> 747 bytes images/icons/medal_bronze_delete.png | Bin 0 -> 730 bytes images/icons/medal_gold_1.png | Bin 0 -> 629 bytes images/icons/medal_gold_2.png | Bin 0 -> 641 bytes images/icons/medal_gold_3.png | Bin 0 -> 634 bytes images/icons/medal_gold_add.png | Bin 0 -> 733 bytes images/icons/medal_gold_delete.png | Bin 0 -> 724 bytes images/icons/medal_silver_1.png | Bin 0 -> 589 bytes images/icons/medal_silver_2.png | Bin 0 -> 600 bytes images/icons/medal_silver_3.png | Bin 0 -> 597 bytes images/icons/medal_silver_add.png | Bin 0 -> 727 bytes images/icons/medal_silver_delete.png | Bin 0 -> 714 bytes images/icons/money.png | Bin 0 -> 738 bytes images/icons/money_add.png | Bin 0 -> 784 bytes images/icons/money_delete.png | Bin 0 -> 806 bytes images/icons/money_dollar.png | Bin 0 -> 630 bytes images/icons/money_euro.png | Bin 0 -> 605 bytes images/icons/money_pound.png | Bin 0 -> 565 bytes images/icons/money_yen.png | Bin 0 -> 562 bytes images/icons/monitor.png | Bin 0 -> 612 bytes images/icons/monitor_add.png | Bin 0 -> 692 bytes images/icons/monitor_delete.png | Bin 0 -> 691 bytes images/icons/monitor_edit.png | Bin 0 -> 769 bytes images/icons/monitor_error.png | Bin 0 -> 714 bytes images/icons/monitor_go.png | Bin 0 -> 696 bytes images/icons/monitor_lightning.png | Bin 0 -> 768 bytes images/icons/monitor_link.png | Bin 0 -> 736 bytes images/icons/mouse.png | Bin 0 -> 634 bytes images/icons/mouse_add.png | Bin 0 -> 729 bytes images/icons/mouse_delete.png | Bin 0 -> 741 bytes images/icons/mouse_error.png | Bin 0 -> 790 bytes images/icons/music.png | Bin 0 -> 385 bytes images/icons/new.png | Bin 0 -> 378 bytes images/icons/newspaper.png | Bin 0 -> 658 bytes images/icons/newspaper_add.png | Bin 0 -> 750 bytes images/icons/newspaper_delete.png | Bin 0 -> 775 bytes images/icons/newspaper_go.png | Bin 0 -> 779 bytes images/icons/newspaper_link.png | Bin 0 -> 787 bytes images/icons/note.png | Bin 0 -> 500 bytes images/icons/note_add.png | Bin 0 -> 641 bytes images/icons/note_delete.png | Bin 0 -> 631 bytes images/icons/note_edit.png | Bin 0 -> 731 bytes images/icons/note_error.png | Bin 0 -> 680 bytes images/icons/note_go.png | Bin 0 -> 661 bytes images/icons/overlays.png | Bin 0 -> 716 bytes images/icons/package.png | Bin 0 -> 853 bytes images/icons/package_add.png | Bin 0 -> 899 bytes images/icons/package_delete.png | Bin 0 -> 891 bytes images/icons/package_go.png | Bin 0 -> 898 bytes images/icons/package_green.png | Bin 0 -> 896 bytes images/icons/package_link.png | Bin 0 -> 939 bytes images/icons/page.png | Bin 0 -> 635 bytes images/icons/page_add.png | Bin 0 -> 739 bytes images/icons/page_attach.png | Bin 0 -> 794 bytes images/icons/page_code.png | Bin 0 -> 818 bytes images/icons/page_copy.png | Bin 0 -> 663 bytes images/icons/page_delete.png | Bin 0 -> 740 bytes images/icons/page_edit.png | Bin 0 -> 807 bytes images/icons/page_error.png | Bin 0 -> 793 bytes images/icons/page_excel.png | Bin 0 -> 817 bytes images/icons/page_find.png | Bin 0 -> 879 bytes images/icons/page_gear.png | Bin 0 -> 833 bytes images/icons/page_go.png | Bin 0 -> 779 bytes images/icons/page_green.png | Bin 0 -> 621 bytes images/icons/page_key.png | Bin 0 -> 801 bytes images/icons/page_lightning.png | Bin 0 -> 839 bytes images/icons/page_link.png | Bin 0 -> 830 bytes images/icons/page_paintbrush.png | Bin 0 -> 813 bytes images/icons/page_paste.png | Bin 0 -> 703 bytes images/icons/page_red.png | Bin 0 -> 641 bytes images/icons/page_refresh.png | Bin 0 -> 858 bytes images/icons/page_save.png | Bin 0 -> 774 bytes images/icons/page_white.png | Bin 0 -> 294 bytes images/icons/page_white_acrobat.png | Bin 0 -> 591 bytes images/icons/page_white_actionscript.png | Bin 0 -> 664 bytes images/icons/page_white_add.png | Bin 0 -> 512 bytes images/icons/page_white_c.png | Bin 0 -> 587 bytes images/icons/page_white_camera.png | Bin 0 -> 656 bytes images/icons/page_white_cd.png | Bin 0 -> 666 bytes images/icons/page_white_code.png | Bin 0 -> 603 bytes images/icons/page_white_code_red.png | Bin 0 -> 587 bytes images/icons/page_white_coldfusion.png | Bin 0 -> 592 bytes images/icons/page_white_compressed.png | Bin 0 -> 724 bytes images/icons/page_white_copy.png | Bin 0 -> 309 bytes images/icons/page_white_cplusplus.png | Bin 0 -> 621 bytes images/icons/page_white_csharp.png | Bin 0 -> 700 bytes images/icons/page_white_cup.png | Bin 0 -> 639 bytes images/icons/page_white_database.png | Bin 0 -> 579 bytes images/icons/page_white_delete.png | Bin 0 -> 536 bytes images/icons/page_white_dvd.png | Bin 0 -> 638 bytes images/icons/page_white_edit.png | Bin 0 -> 618 bytes images/icons/page_white_error.png | Bin 0 -> 623 bytes images/icons/page_white_excel.png | Bin 0 -> 663 bytes images/icons/page_white_find.png | Bin 0 -> 676 bytes images/icons/page_white_flash.png | Bin 0 -> 582 bytes images/icons/page_white_freehand.png | Bin 0 -> 639 bytes images/icons/page_white_gear.png | Bin 0 -> 402 bytes images/icons/page_white_get.png | Bin 0 -> 516 bytes images/icons/page_white_go.png | Bin 0 -> 612 bytes images/icons/page_white_h.png | Bin 0 -> 603 bytes images/icons/page_white_horizontal.png | Bin 0 -> 296 bytes images/icons/page_white_key.png | Bin 0 -> 616 bytes images/icons/page_white_lightning.png | Bin 0 -> 669 bytes images/icons/page_white_link.png | Bin 0 -> 614 bytes images/icons/page_white_magnify.png | Bin 0 -> 554 bytes images/icons/page_white_medal.png | Bin 0 -> 706 bytes images/icons/page_white_office.png | Bin 0 -> 779 bytes images/icons/page_white_paint.png | Bin 0 -> 688 bytes images/icons/page_white_paintbrush.png | Bin 0 -> 618 bytes images/icons/page_white_paste.png | Bin 0 -> 620 bytes images/icons/page_white_php.png | Bin 0 -> 538 bytes images/icons/page_white_picture.png | Bin 0 -> 650 bytes images/icons/page_white_powerpoint.png | Bin 0 -> 588 bytes images/icons/page_white_put.png | Bin 0 -> 523 bytes images/icons/page_white_ruby.png | Bin 0 -> 626 bytes images/icons/page_white_stack.png | Bin 0 -> 317 bytes images/icons/page_white_star.png | Bin 0 -> 565 bytes images/icons/page_white_swoosh.png | Bin 0 -> 634 bytes images/icons/page_white_text.png | Bin 0 -> 342 bytes images/icons/page_white_text_width.png | Bin 0 -> 315 bytes images/icons/page_white_tux.png | Bin 0 -> 668 bytes images/icons/page_white_vector.png | Bin 0 -> 644 bytes images/icons/page_white_visualstudio.png | Bin 0 -> 702 bytes images/icons/page_white_width.png | Bin 0 -> 309 bytes images/icons/page_white_word.png | Bin 0 -> 651 bytes images/icons/page_white_world.png | Bin 0 -> 734 bytes images/icons/page_white_wrench.png | Bin 0 -> 613 bytes images/icons/page_white_zip.png | Bin 0 -> 386 bytes images/icons/page_word.png | Bin 0 -> 777 bytes images/icons/page_world.png | Bin 0 -> 903 bytes images/icons/paintbrush.png | Bin 0 -> 548 bytes images/icons/paintcan.png | Bin 0 -> 707 bytes images/icons/palette.png | Bin 0 -> 856 bytes images/icons/paste_plain.png | Bin 0 -> 605 bytes images/icons/paste_word.png | Bin 0 -> 701 bytes images/icons/pencil.png | Bin 0 -> 450 bytes images/icons/pencil_add.png | Bin 0 -> 589 bytes images/icons/pencil_delete.png | Bin 0 -> 603 bytes images/icons/pencil_go.png | Bin 0 -> 666 bytes images/icons/phone.png | Bin 0 -> 488 bytes images/icons/phone_add.png | Bin 0 -> 621 bytes images/icons/phone_delete.png | Bin 0 -> 615 bytes images/icons/phone_sound.png | Bin 0 -> 703 bytes images/icons/photo.png | Bin 0 -> 589 bytes images/icons/photo_add.png | Bin 0 -> 707 bytes images/icons/photo_delete.png | Bin 0 -> 703 bytes images/icons/photo_link.png | Bin 0 -> 784 bytes images/icons/photos.png | Bin 0 -> 647 bytes images/icons/picture.png | Bin 0 -> 606 bytes images/icons/picture_add.png | Bin 0 -> 745 bytes images/icons/picture_delete.png | Bin 0 -> 744 bytes images/icons/picture_edit.png | Bin 0 -> 826 bytes images/icons/picture_empty.png | Bin 0 -> 463 bytes images/icons/picture_error.png | Bin 0 -> 755 bytes images/icons/picture_go.png | Bin 0 -> 758 bytes images/icons/picture_key.png | Bin 0 -> 794 bytes images/icons/picture_link.png | Bin 0 -> 835 bytes images/icons/picture_save.png | Bin 0 -> 755 bytes images/icons/pictures.png | Bin 0 -> 704 bytes images/icons/pilcrow.png | Bin 0 -> 361 bytes images/icons/pill.png | Bin 0 -> 719 bytes images/icons/pill_add.png | Bin 0 -> 797 bytes images/icons/pill_delete.png | Bin 0 -> 805 bytes images/icons/pill_go.png | Bin 0 -> 817 bytes images/icons/plugin.png | Bin 0 -> 591 bytes images/icons/plugin_add.png | Bin 0 -> 691 bytes images/icons/plugin_delete.png | Bin 0 -> 692 bytes images/icons/plugin_disabled.png | Bin 0 -> 347 bytes images/icons/plugin_edit.png | Bin 0 -> 746 bytes images/icons/plugin_error.png | Bin 0 -> 702 bytes images/icons/plugin_go.png | Bin 0 -> 694 bytes images/icons/plugin_link.png | Bin 0 -> 759 bytes images/icons/printer.png | Bin 0 -> 731 bytes images/icons/printer_add.png | Bin 0 -> 782 bytes images/icons/printer_delete.png | Bin 0 -> 792 bytes images/icons/printer_empty.png | Bin 0 -> 350 bytes images/icons/printer_error.png | Bin 0 -> 854 bytes images/icons/rainbow.png | Bin 0 -> 655 bytes images/icons/readme.html | 1495 ++++ images/icons/readme.txt | 22 + images/icons/report.png | Bin 0 -> 649 bytes images/icons/report_add.png | Bin 0 -> 714 bytes images/icons/report_delete.png | Bin 0 -> 729 bytes images/icons/report_disk.png | Bin 0 -> 760 bytes images/icons/report_edit.png | Bin 0 -> 762 bytes images/icons/report_go.png | Bin 0 -> 756 bytes images/icons/report_key.png | Bin 0 -> 760 bytes images/icons/report_link.png | Bin 0 -> 754 bytes images/icons/report_magnify.png | Bin 0 -> 738 bytes images/icons/report_picture.png | Bin 0 -> 733 bytes images/icons/report_user.png | Bin 0 -> 785 bytes images/icons/report_word.png | Bin 0 -> 731 bytes images/icons/resultset_first.png | Bin 0 -> 522 bytes images/icons/resultset_last.png | Bin 0 -> 524 bytes images/icons/resultset_next.png | Bin 0 -> 395 bytes images/icons/resultset_previous.png | Bin 0 -> 389 bytes images/icons/rosette.png | Bin 0 -> 673 bytes images/icons/rss.png | Bin 0 -> 530 bytes images/icons/rss_add.png | Bin 0 -> 649 bytes images/icons/rss_delete.png | Bin 0 -> 633 bytes images/icons/rss_go.png | Bin 0 -> 635 bytes images/icons/rss_valid.png | Bin 0 -> 660 bytes images/icons/ruby.png | Bin 0 -> 592 bytes images/icons/ruby_add.png | Bin 0 -> 691 bytes images/icons/ruby_delete.png | Bin 0 -> 704 bytes images/icons/ruby_gear.png | Bin 0 -> 716 bytes images/icons/ruby_get.png | Bin 0 -> 692 bytes images/icons/ruby_go.png | Bin 0 -> 720 bytes images/icons/ruby_key.png | Bin 0 -> 732 bytes images/icons/ruby_link.png | Bin 0 -> 767 bytes images/icons/ruby_put.png | Bin 0 -> 694 bytes images/icons/script.png | Bin 0 -> 748 bytes images/icons/script_add.png | Bin 0 -> 811 bytes images/icons/script_code.png | Bin 0 -> 859 bytes images/icons/script_code_red.png | Bin 0 -> 868 bytes images/icons/script_delete.png | Bin 0 -> 811 bytes images/icons/script_edit.png | Bin 0 -> 880 bytes images/icons/script_error.png | Bin 0 -> 861 bytes images/icons/script_gear.png | Bin 0 -> 861 bytes images/icons/script_go.png | Bin 0 -> 839 bytes images/icons/script_key.png | Bin 0 -> 853 bytes images/icons/script_lightning.png | Bin 0 -> 879 bytes images/icons/script_link.png | Bin 0 -> 876 bytes images/icons/script_palette.png | Bin 0 -> 917 bytes images/icons/script_save.png | Bin 0 -> 804 bytes images/icons/server.png | Bin 0 -> 530 bytes images/icons/server_add.png | Bin 0 -> 676 bytes images/icons/server_chart.png | Bin 0 -> 673 bytes images/icons/server_compressed.png | Bin 0 -> 721 bytes images/icons/server_connect.png | Bin 0 -> 755 bytes images/icons/server_database.png | Bin 0 -> 666 bytes images/icons/server_delete.png | Bin 0 -> 668 bytes images/icons/server_edit.png | Bin 0 -> 749 bytes images/icons/server_error.png | Bin 0 -> 678 bytes images/icons/server_go.png | Bin 0 -> 706 bytes images/icons/server_key.png | Bin 0 -> 746 bytes images/icons/server_lightning.png | Bin 0 -> 729 bytes images/icons/server_link.png | Bin 0 -> 706 bytes images/icons/server_uncompressed.png | Bin 0 -> 669 bytes images/icons/shading.png | Bin 0 -> 225 bytes images/icons/shape_align_bottom.png | Bin 0 -> 398 bytes images/icons/shape_align_center.png | Bin 0 -> 384 bytes images/icons/shape_align_left.png | Bin 0 -> 402 bytes images/icons/shape_align_middle.png | Bin 0 -> 414 bytes images/icons/shape_align_right.png | Bin 0 -> 401 bytes images/icons/shape_align_top.png | Bin 0 -> 406 bytes images/icons/shape_flip_horizontal.png | Bin 0 -> 403 bytes images/icons/shape_flip_vertical.png | Bin 0 -> 418 bytes images/icons/shape_group.png | Bin 0 -> 553 bytes images/icons/shape_handles.png | Bin 0 -> 538 bytes images/icons/shape_move_back.png | Bin 0 -> 395 bytes images/icons/shape_move_backwards.png | Bin 0 -> 358 bytes images/icons/shape_move_forwards.png | Bin 0 -> 381 bytes images/icons/shape_move_front.png | Bin 0 -> 435 bytes images/icons/shape_rotate_anticlockwise.png | Bin 0 -> 657 bytes images/icons/shape_rotate_clockwise.png | Bin 0 -> 673 bytes images/icons/shape_square.png | Bin 0 -> 353 bytes images/icons/shape_square_add.png | Bin 0 -> 539 bytes images/icons/shape_square_delete.png | Bin 0 -> 537 bytes images/icons/shape_square_edit.png | Bin 0 -> 660 bytes images/icons/shape_square_error.png | Bin 0 -> 570 bytes images/icons/shape_square_go.png | Bin 0 -> 566 bytes images/icons/shape_square_key.png | Bin 0 -> 607 bytes images/icons/shape_square_link.png | Bin 0 -> 642 bytes images/icons/shape_ungroup.png | Bin 0 -> 666 bytes images/icons/shield.png | Bin 0 -> 702 bytes images/icons/shield_add.png | Bin 0 -> 758 bytes images/icons/shield_delete.png | Bin 0 -> 768 bytes images/icons/shield_go.png | Bin 0 -> 775 bytes images/icons/sitemap.png | Bin 0 -> 278 bytes images/icons/sitemap_color.png | Bin 0 -> 406 bytes images/icons/sound.png | Bin 0 -> 610 bytes images/icons/sound_add.png | Bin 0 -> 684 bytes images/icons/sound_delete.png | Bin 0 -> 711 bytes images/icons/sound_low.png | Bin 0 -> 524 bytes images/icons/sound_mute.png | Bin 0 -> 474 bytes images/icons/sound_none.png | Bin 0 -> 417 bytes images/icons/spellcheck.png | Bin 0 -> 603 bytes images/icons/sport_8ball.png | Bin 0 -> 490 bytes images/icons/sport_basketball.png | Bin 0 -> 977 bytes images/icons/sport_football.png | Bin 0 -> 875 bytes images/icons/sport_golf.png | Bin 0 -> 504 bytes images/icons/sport_raquet.png | Bin 0 -> 719 bytes images/icons/sport_shuttlecock.png | Bin 0 -> 683 bytes images/icons/sport_soccer.png | Bin 0 -> 517 bytes images/icons/sport_tennis.png | Bin 0 -> 884 bytes images/icons/star.png | Bin 0 -> 670 bytes images/icons/status_away.png | Bin 0 -> 794 bytes images/icons/status_busy.png | Bin 0 -> 751 bytes images/icons/status_offline.png | Bin 0 -> 422 bytes images/icons/status_online.png | Bin 0 -> 722 bytes images/icons/stop.png | Bin 0 -> 700 bytes images/icons/style.png | Bin 0 -> 813 bytes images/icons/style_add.png | Bin 0 -> 844 bytes images/icons/style_delete.png | Bin 0 -> 865 bytes images/icons/style_edit.png | Bin 0 -> 927 bytes images/icons/style_go.png | Bin 0 -> 862 bytes images/icons/sum.png | Bin 0 -> 289 bytes images/icons/tab.png | Bin 0 -> 323 bytes images/icons/tab_add.png | Bin 0 -> 488 bytes images/icons/tab_delete.png | Bin 0 -> 493 bytes images/icons/tab_edit.png | Bin 0 -> 580 bytes images/icons/tab_go.png | Bin 0 -> 552 bytes images/icons/table.png | Bin 0 -> 566 bytes images/icons/table_add.png | Bin 0 -> 663 bytes images/icons/table_delete.png | Bin 0 -> 660 bytes images/icons/table_edit.png | Bin 0 -> 744 bytes images/icons/table_error.png | Bin 0 -> 687 bytes images/icons/table_gear.png | Bin 0 -> 714 bytes images/icons/table_go.png | Bin 0 -> 683 bytes images/icons/table_key.png | Bin 0 -> 746 bytes images/icons/table_lightning.png | Bin 0 -> 736 bytes images/icons/table_link.png | Bin 0 -> 728 bytes images/icons/table_multiple.png | Bin 0 -> 612 bytes images/icons/table_refresh.png | Bin 0 -> 795 bytes images/icons/table_relationship.png | Bin 0 -> 663 bytes images/icons/table_row_delete.png | Bin 0 -> 629 bytes images/icons/table_row_insert.png | Bin 0 -> 641 bytes images/icons/table_save.png | Bin 0 -> 723 bytes images/icons/table_sort.png | Bin 0 -> 678 bytes images/icons/tag.png | Bin 0 -> 389 bytes images/icons/tag_blue.png | Bin 0 -> 586 bytes images/icons/tag_blue_add.png | Bin 0 -> 671 bytes images/icons/tag_blue_delete.png | Bin 0 -> 701 bytes images/icons/tag_blue_edit.png | Bin 0 -> 748 bytes images/icons/tag_green.png | Bin 0 -> 613 bytes images/icons/tag_orange.png | Bin 0 -> 586 bytes images/icons/tag_pink.png | Bin 0 -> 579 bytes images/icons/tag_purple.png | Bin 0 -> 599 bytes images/icons/tag_red.png | Bin 0 -> 592 bytes images/icons/tag_yellow.png | Bin 0 -> 586 bytes images/icons/telephone.png | Bin 0 -> 791 bytes images/icons/telephone_add.png | Bin 0 -> 860 bytes images/icons/telephone_delete.png | Bin 0 -> 856 bytes images/icons/telephone_edit.png | Bin 0 -> 893 bytes images/icons/telephone_error.png | Bin 0 -> 884 bytes images/icons/telephone_go.png | Bin 0 -> 865 bytes images/icons/telephone_key.png | Bin 0 -> 881 bytes images/icons/telephone_link.png | Bin 0 -> 909 bytes images/icons/television.png | Bin 0 -> 696 bytes images/icons/television_add.png | Bin 0 -> 809 bytes images/icons/television_delete.png | Bin 0 -> 810 bytes images/icons/text_align_center.png | Bin 0 -> 234 bytes images/icons/text_align_justify.png | Bin 0 -> 209 bytes images/icons/text_align_left.png | Bin 0 -> 209 bytes images/icons/text_align_right.png | Bin 0 -> 209 bytes images/icons/text_allcaps.png | Bin 0 -> 284 bytes images/icons/text_bold.png | Bin 0 -> 304 bytes images/icons/text_columns.png | Bin 0 -> 246 bytes images/icons/text_dropcaps.png | Bin 0 -> 314 bytes images/icons/text_heading_1.png | Bin 0 -> 276 bytes images/icons/text_heading_2.png | Bin 0 -> 304 bytes images/icons/text_heading_3.png | Bin 0 -> 306 bytes images/icons/text_heading_4.png | Bin 0 -> 293 bytes images/icons/text_heading_5.png | Bin 0 -> 304 bytes images/icons/text_heading_6.png | Bin 0 -> 310 bytes images/icons/text_horizontalrule.png | Bin 0 -> 317 bytes images/icons/text_indent.png | Bin 0 -> 353 bytes images/icons/text_indent_remove.png | Bin 0 -> 351 bytes images/icons/text_italic.png | Bin 0 -> 223 bytes images/icons/text_kerning.png | Bin 0 -> 495 bytes images/icons/text_letter_omega.png | Bin 0 -> 541 bytes images/icons/text_letterspacing.png | Bin 0 -> 503 bytes images/icons/text_linespacing.png | Bin 0 -> 363 bytes images/icons/text_list_bullets.png | Bin 0 -> 344 bytes images/icons/text_list_numbers.png | Bin 0 -> 357 bytes images/icons/text_lowercase.png | Bin 0 -> 709 bytes images/icons/text_padding_bottom.png | Bin 0 -> 237 bytes images/icons/text_padding_left.png | Bin 0 -> 271 bytes images/icons/text_padding_right.png | Bin 0 -> 271 bytes images/icons/text_padding_top.png | Bin 0 -> 236 bytes images/icons/text_replace.png | Bin 0 -> 691 bytes images/icons/text_signature.png | Bin 0 -> 524 bytes images/icons/text_smallcaps.png | Bin 0 -> 260 bytes images/icons/text_strikethrough.png | Bin 0 -> 269 bytes images/icons/text_subscript.png | Bin 0 -> 422 bytes images/icons/text_superscript.png | Bin 0 -> 421 bytes images/icons/text_underline.png | Bin 0 -> 273 bytes images/icons/text_uppercase.png | Bin 0 -> 747 bytes images/icons/textfield.png | Bin 0 -> 153 bytes images/icons/textfield_add.png | Bin 0 -> 321 bytes images/icons/textfield_delete.png | Bin 0 -> 335 bytes images/icons/textfield_key.png | Bin 0 -> 455 bytes images/icons/textfield_rename.png | Bin 0 -> 273 bytes images/icons/thumb_down.png | Bin 0 -> 601 bytes images/icons/thumb_up.png | Bin 0 -> 619 bytes images/icons/tick.png | Bin 0 -> 537 bytes images/icons/time.png | Bin 0 -> 793 bytes images/icons/time_add.png | Bin 0 -> 827 bytes images/icons/time_delete.png | Bin 0 -> 853 bytes images/icons/time_go.png | Bin 0 -> 882 bytes images/icons/timeline_marker.png | Bin 0 -> 327 bytes images/icons/transmit.png | Bin 0 -> 749 bytes images/icons/transmit_add.png | Bin 0 -> 803 bytes images/icons/transmit_blue.png | Bin 0 -> 814 bytes images/icons/transmit_delete.png | Bin 0 -> 827 bytes images/icons/transmit_edit.png | Bin 0 -> 848 bytes images/icons/transmit_error.png | Bin 0 -> 883 bytes images/icons/transmit_go.png | Bin 0 -> 842 bytes images/icons/tux.png | Bin 0 -> 696 bytes images/icons/user.png | Bin 0 -> 741 bytes images/icons/user_add.png | Bin 0 -> 746 bytes images/icons/user_comment.png | Bin 0 -> 743 bytes images/icons/user_delete.png | Bin 0 -> 767 bytes images/icons/user_edit.png | Bin 0 -> 833 bytes images/icons/user_female.png | Bin 0 -> 663 bytes images/icons/user_go.png | Bin 0 -> 793 bytes images/icons/user_gray.png | Bin 0 -> 706 bytes images/icons/user_green.png | Bin 0 -> 722 bytes images/icons/user_orange.png | Bin 0 -> 723 bytes images/icons/user_red.png | Bin 0 -> 717 bytes images/icons/user_suit.png | Bin 0 -> 748 bytes images/icons/vcard.png | Bin 0 -> 533 bytes images/icons/vcard_add.png | Bin 0 -> 661 bytes images/icons/vcard_delete.png | Bin 0 -> 651 bytes images/icons/vcard_edit.png | Bin 0 -> 775 bytes images/icons/vector.png | Bin 0 -> 481 bytes images/icons/vector_add.png | Bin 0 -> 616 bytes images/icons/vector_delete.png | Bin 0 -> 635 bytes images/icons/wand.png | Bin 0 -> 570 bytes images/icons/weather_clouds.png | Bin 0 -> 581 bytes images/icons/weather_cloudy.png | Bin 0 -> 694 bytes images/icons/weather_lightning.png | Bin 0 -> 641 bytes images/icons/weather_rain.png | Bin 0 -> 626 bytes images/icons/weather_snow.png | Bin 0 -> 341 bytes images/icons/weather_sun.png | Bin 0 -> 623 bytes images/icons/webcam.png | Bin 0 -> 728 bytes images/icons/webcam_add.png | Bin 0 -> 786 bytes images/icons/webcam_delete.png | Bin 0 -> 805 bytes images/icons/webcam_error.png | Bin 0 -> 821 bytes images/icons/world.png | Bin 0 -> 923 bytes images/icons/world_add.png | Bin 0 -> 940 bytes images/icons/world_delete.png | Bin 0 -> 945 bytes images/icons/world_edit.png | Bin 0 -> 945 bytes images/icons/world_go.png | Bin 0 -> 944 bytes images/icons/world_link.png | Bin 0 -> 957 bytes images/icons/wrench.png | Bin 0 -> 610 bytes images/icons/wrench_orange.png | Bin 0 -> 584 bytes images/icons/xhtml.png | Bin 0 -> 595 bytes images/icons/xhtml_add.png | Bin 0 -> 703 bytes images/icons/xhtml_delete.png | Bin 0 -> 696 bytes images/icons/xhtml_go.png | Bin 0 -> 697 bytes images/icons/xhtml_valid.png | Bin 0 -> 718 bytes images/icons/zoom.png | Bin 0 -> 692 bytes images/icons/zoom_in.png | Bin 0 -> 725 bytes images/icons/zoom_out.png | Bin 0 -> 708 bytes images/info.gif | Bin 0 -> 1056 bytes images/lilac.gif | Bin 0 -> 460 bytes images/lilac_configurator.gif | Bin 0 -> 2937 bytes images/lilac_small.gif | Bin 0 -> 360 bytes images/lilac_small_white.gif.png | Bin 0 -> 52819 bytes images/lilacs.gif | Bin 0 -> 489 bytes images/line.gif | Bin 0 -> 64 bytes images/linebottom.gif | Bin 0 -> 59 bytes images/logo.gif | Bin 0 -> 8139 bytes images/mail.gif | Bin 0 -> 278 bytes images/minus.gif | Bin 0 -> 92 bytes images/minusbottom.gif | Bin 0 -> 91 bytes images/minustop.gif | Bin 0 -> 89 bytes images/nagios.gif | Bin 0 -> 2021 bytes images/navspacer.gif | Bin 0 -> 59 bytes images/notification.gif | Bin 0 -> 243 bytes images/plus.gif | Bin 0 -> 95 bytes images/plusbottom.gif | Bin 0 -> 94 bytes images/plustop.gif | Bin 0 -> 94 bytes images/roundedcorner_error_bl.png | Bin 0 -> 128 bytes images/roundedcorner_error_br.png | Bin 0 -> 124 bytes images/roundedcorner_error_tl.png | Bin 0 -> 145 bytes images/roundedcorner_error_tr.png | Bin 0 -> 139 bytes images/roundedcorner_inner_bl.png | Bin 0 -> 123 bytes images/roundedcorner_inner_br.png | Bin 0 -> 126 bytes images/roundedcorner_inner_tl.png | Bin 0 -> 144 bytes images/roundedcorner_inner_tr.png | Bin 0 -> 138 bytes images/roundedcorner_lilac_bl.png | Bin 0 -> 131 bytes images/roundedcorner_lilac_br.png | Bin 0 -> 123 bytes images/roundedcorner_lilac_tl.png | Bin 0 -> 147 bytes images/roundedcorner_lilac_tr.png | Bin 0 -> 147 bytes images/roundedcorner_success_bl.png | Bin 0 -> 131 bytes images/roundedcorner_success_br.png | Bin 0 -> 122 bytes images/roundedcorner_success_tl.png | Bin 0 -> 147 bytes images/roundedcorner_success_tr.png | Bin 0 -> 153 bytes images/roundedcorner_warning_bl.png | Bin 0 -> 118 bytes images/roundedcorner_warning_br.png | Bin 0 -> 110 bytes images/roundedcorner_warning_tl.png | Bin 0 -> 128 bytes images/roundedcorner_warning_tr.png | Bin 0 -> 130 bytes images/searchback.gif | Bin 0 -> 101 bytes images/server.gif | Bin 0 -> 319 bytes images/servergroup.gif | Bin 0 -> 883 bytes images/services.gif | Bin 0 -> 1378 bytes images/tree-server.gif | Bin 0 -> 153 bytes import.php | 426 + importer/classes.inc.php | 182 + .../engines/fruity/FruityImportEngine.php | 280 + .../engines/nagios/NagiosImportEngine.php | 671 ++ importer/import.php | 123 + .../importers/fruity/FruityCgiImporter.php | 41 + .../fruity/FruityCommandImporter.php | 43 + .../fruity/FruityContactImporter.php | 159 + .../fruity/FruityDependencyImporter.php | 123 + .../fruity/FruityEscalationImporter.php | 93 + .../fruity/FruityHostGroupImporter.php | 27 + .../importers/fruity/FruityHostImporter.php | 289 + .../fruity/FruityHostTemplateImporter.php | 242 + .../importers/fruity/FruityMainImporter.php | 143 + .../fruity/FruityResourceImporter.php | 41 + .../fruity/FruityServiceGroupImporter.php | 24 + .../fruity/FruityServiceImporter.php | 250 + .../fruity/FruityServiceTemplateImporter.php | 254 + .../fruity/FruityTimeperiodImporter.php | 74 + .../importers/nagios/NagiosCgiImporter.php | 154 + .../nagios/NagiosCommandImporter.php | 137 + .../nagios/NagiosContactGroupImporter.php | 104 + .../nagios/NagiosContactImporter.php | 300 + .../nagios/NagiosHostDependencyImporter.php | 370 + .../nagios/NagiosHostEscalationImporter.php | 356 + .../nagios/NagiosHostExtInfoImporter.php | 277 + .../nagios/NagiosHostGroupImporter.php | 128 + .../importers/nagios/NagiosHostImporter.php | 396 + .../importers/nagios/NagiosMainImporter.php | 518 ++ .../nagios/NagiosResourceImporter.php | 150 + .../NagiosServiceDependencyImporter.php | 392 + .../NagiosServiceEscalationImporter.php | 361 + .../nagios/NagiosServiceExtInfoImporter.php | 201 + .../nagios/NagiosServiceGroupImporter.php | 139 + .../nagios/NagiosServiceImporter.php | 478 ++ .../nagios/NagiosTimeperiodImporter.php | 400 + includes/config.inc | 49 + includes/init.inc.php | 46 + includes/lilac-classmap.php | 157 + includes/lilac-conf.php | 35 + includes/lilac-conf.php.dist | 35 + includes/lilac.inc | 1220 +++ includes/output.php | 765 ++ index.php | 68 + install.php | 1272 +++ js/flexigrid.js | 1486 ++++ js/jquery-1.2.6.min.js | 32 + js/jquery.autocomplete.js | 759 ++ js/jquery.timers-1.0.0.js | 151 + js/jquery.tooltip.min.js | 16 + library/Log.php | 850 ++ library/Log/composite.php | 231 + library/Log/console.php | 208 + library/Log/daemon.php | 235 + library/Log/display.php | 161 + library/Log/error_log.php | 127 + library/Log/file.php | 316 + library/Log/firebug.php | 214 + library/Log/mail.php | 294 + library/Log/mcal.php | 170 + library/Log/mdb2.php | 358 + library/Log/null.php | 91 + library/Log/observer.php | 129 + library/Log/sql.php | 294 + library/Log/sqlite.php | 225 + library/Log/syslog.php | 179 + library/Log/win.php | 269 + library/Net/Traceroute.php | 629 ++ library/propel/Propel.php | 861 ++ library/propel/PropelException.php | 61 + library/propel/adapter/DBAdapter.php | 305 + library/propel/adapter/DBMSSQL.php | 194 + library/propel/adapter/DBMySQL.php | 156 + library/propel/adapter/DBNone.php | 99 + library/propel/adapter/DBOracle.php | 143 + library/propel/adapter/DBPostgres.php | 152 + library/propel/adapter/DBSQLite.php | 127 + library/propel/logger/BasicLogger.php | 103 + library/propel/logger/MojaviLogAdapter.php | 170 + library/propel/map/ColumnMap.php | 417 + library/propel/map/DatabaseMap.php | 152 + library/propel/map/MapBuilder.php | 75 + library/propel/map/TableMap.php | 458 + library/propel/map/ValidatorMap.php | 109 + library/propel/om/BaseObject.php | 202 + .../propel/om/NestedSetRecursiveIterator.php | 88 + library/propel/om/NodeObject.php | 334 + library/propel/om/Persistent.php | 118 + library/propel/om/PreOrderNodeIterator.php | 90 + library/propel/util/BasePeer.php | 1005 +++ library/propel/util/Criteria.php | 1819 ++++ library/propel/util/DebugPDO.php | 515 ++ library/propel/util/DebugPDOStatement.php | 131 + library/propel/util/NodePeer.php | 379 + library/propel/util/PropelColumnTypes.php | 136 + library/propel/util/PropelConfiguration.php | 183 + .../util/PropelConfigurationIterator.php | 114 + library/propel/util/PropelDateTime.php | 87 + library/propel/util/PropelPDO.php | 237 + library/propel/util/PropelPager.php | 543 ++ library/propel/validator/BasicValidator.php | 46 + library/propel/validator/MatchValidator.php | 79 + .../propel/validator/MaxLengthValidator.php | 50 + .../propel/validator/MaxValueValidator.php | 54 + .../propel/validator/MinLengthValidator.php | 47 + .../propel/validator/MinValueValidator.php | 54 + .../propel/validator/NotMatchValidator.php | 77 + .../propel/validator/RequiredValidator.php | 49 + library/propel/validator/TypeValidator.php | 44 + library/propel/validator/UniqueValidator.php | 59 + .../propel/validator/ValidValuesValidator.php | 44 + library/propel/validator/ValidationFailed.php | 126 + main.php | 1368 +++ resources.php | 199 + runtime-conf.xml | 23 + schema-transformed.xml | 2 + schema.xml | 1120 +++ search.php | 461 + service.php | 1898 +++++ service_template.php | 1835 ++++ servicegroups.php | 380 + sitedb/sitedb-utility.php | 129 + sqldata/lilac-nagios-en-label.sql | 452 + sqldata/schema.sql | 1700 ++++ sqldata/seed.sql | 463 ++ style/flexigrid.css | 726 ++ style/install.css | 132 + style/jquery.autocomplete.css | 48 + style/jquery.tooltip.css | 9 + style/lilac.css | 568 ++ style/reset.css | 18 + templates.php | 119 + timeperiod.php | 316 + timeperiods.php | 165 + tools.php | 47 + 1495 files changed, 233924 insertions(+) create mode 100755 INSTALL create mode 100755 LICENSE create mode 100755 UPGRADING create mode 100755 about.php create mode 100755 add_dependency.php create mode 100755 add_escalation.php create mode 100755 add_host.php create mode 100755 add_host_template.php create mode 100755 add_service.php create mode 100755 add_service_template.php create mode 100755 autodiscovery.php create mode 100755 autodiscovery/autodiscover.php create mode 100755 autodiscovery/classes.inc.php create mode 100755 autodiscovery/engines/nmap/NmapAutoDiscoveryEngine.php create mode 100755 build.properties create mode 100755 cgi.php create mode 100755 classes/AutodiscoveryDevice.php create mode 100755 classes/AutodiscoveryDevicePeer.php create mode 100755 classes/AutodiscoveryDeviceService.php create mode 100755 classes/AutodiscoveryDeviceServicePeer.php create mode 100755 classes/AutodiscoveryDeviceTemplateMatch.php create mode 100755 classes/AutodiscoveryDeviceTemplateMatchPeer.php create mode 100755 classes/AutodiscoveryJob.php create mode 100755 classes/AutodiscoveryJobPeer.php create mode 100755 classes/AutodiscoveryLogEntry.php create mode 100755 classes/AutodiscoveryLogEntryPeer.php create mode 100755 classes/ExportJob.php create mode 100755 classes/ExportJobPeer.php create mode 100755 classes/ExportLogEntry.php create mode 100755 classes/ExportLogEntryPeer.php create mode 100755 classes/ImportJob.php create mode 100755 classes/ImportJobPeer.php create mode 100755 classes/ImportLogEntry.php create mode 100755 classes/ImportLogEntryPeer.php create mode 100755 classes/Label.php create mode 100755 classes/LabelPeer.php create mode 100755 classes/LilacConfiguration.php create mode 100755 classes/LilacConfigurationPeer.php create mode 100755 classes/LilacCoreModule.php create mode 100755 classes/Module.php create mode 100755 classes/NagiosBrokerModule.php create mode 100755 classes/NagiosBrokerModulePeer.php create mode 100755 classes/NagiosCgiConfiguration.php create mode 100755 classes/NagiosCgiConfigurationPeer.php create mode 100755 classes/NagiosCommand.php create mode 100755 classes/NagiosCommandPeer.php create mode 100755 classes/NagiosContact.php create mode 100755 classes/NagiosContactAddress.php create mode 100755 classes/NagiosContactAddressPeer.php create mode 100755 classes/NagiosContactGroup.php create mode 100755 classes/NagiosContactGroupMember.php create mode 100755 classes/NagiosContactGroupMemberPeer.php create mode 100755 classes/NagiosContactGroupPeer.php create mode 100755 classes/NagiosContactNotificationCommand.php create mode 100755 classes/NagiosContactNotificationCommandPeer.php create mode 100755 classes/NagiosContactPeer.php create mode 100755 classes/NagiosDependency.php create mode 100755 classes/NagiosDependencyPeer.php create mode 100755 classes/NagiosDependencyTarget.php create mode 100755 classes/NagiosDependencyTargetPeer.php create mode 100755 classes/NagiosEscalation.php create mode 100755 classes/NagiosEscalationContact.php create mode 100755 classes/NagiosEscalationContactPeer.php create mode 100755 classes/NagiosEscalationContactgroup.php create mode 100755 classes/NagiosEscalationContactgroupPeer.php create mode 100755 classes/NagiosEscalationPeer.php create mode 100755 classes/NagiosHost.php create mode 100755 classes/NagiosHostCheckCommandParameter.php create mode 100755 classes/NagiosHostCheckCommandParameterPeer.php create mode 100755 classes/NagiosHostContactMember.php create mode 100755 classes/NagiosHostContactMemberPeer.php create mode 100755 classes/NagiosHostContactgroup.php create mode 100755 classes/NagiosHostContactgroupPeer.php create mode 100755 classes/NagiosHostParent.php create mode 100755 classes/NagiosHostParentPeer.php create mode 100755 classes/NagiosHostPeer.php create mode 100755 classes/NagiosHostTemplate.php create mode 100755 classes/NagiosHostTemplateAutodiscoveryService.php create mode 100755 classes/NagiosHostTemplateAutodiscoveryServicePeer.php create mode 100755 classes/NagiosHostTemplateInheritance.php create mode 100755 classes/NagiosHostTemplateInheritancePeer.php create mode 100755 classes/NagiosHostTemplatePeer.php create mode 100755 classes/NagiosHostgroup.php create mode 100755 classes/NagiosHostgroupMembership.php create mode 100755 classes/NagiosHostgroupMembershipPeer.php create mode 100755 classes/NagiosHostgroupPeer.php create mode 100755 classes/NagiosMainConfiguration.php create mode 100755 classes/NagiosMainConfigurationPeer.php create mode 100755 classes/NagiosResource.php create mode 100755 classes/NagiosResourcePeer.php create mode 100755 classes/NagiosService.php create mode 100755 classes/NagiosServiceCheckCommandParameter.php create mode 100755 classes/NagiosServiceCheckCommandParameterPeer.php create mode 100755 classes/NagiosServiceContactGroupMember.php create mode 100755 classes/NagiosServiceContactGroupMemberPeer.php create mode 100755 classes/NagiosServiceContactMember.php create mode 100755 classes/NagiosServiceContactMemberPeer.php create mode 100755 classes/NagiosServiceGroup.php create mode 100755 classes/NagiosServiceGroupMember.php create mode 100755 classes/NagiosServiceGroupMemberPeer.php create mode 100755 classes/NagiosServiceGroupPeer.php create mode 100755 classes/NagiosServicePeer.php create mode 100755 classes/NagiosServiceTemplate.php create mode 100755 classes/NagiosServiceTemplateInheritance.php create mode 100755 classes/NagiosServiceTemplateInheritancePeer.php create mode 100755 classes/NagiosServiceTemplatePeer.php create mode 100755 classes/NagiosTimeperiod.php create mode 100755 classes/NagiosTimeperiodEntry.php create mode 100755 classes/NagiosTimeperiodEntryPeer.php create mode 100755 classes/NagiosTimeperiodExclude.php create mode 100755 classes/NagiosTimeperiodExcludePeer.php create mode 100755 classes/NagiosTimeperiodPeer.php create mode 100755 classes/map/AutodiscoveryDeviceMapBuilder.php create mode 100755 classes/map/AutodiscoveryDeviceServiceMapBuilder.php create mode 100755 classes/map/AutodiscoveryDeviceTemplateMatchMapBuilder.php create mode 100755 classes/map/AutodiscoveryJobMapBuilder.php create mode 100755 classes/map/AutodiscoveryLogEntryMapBuilder.php create mode 100755 classes/map/ExportJobMapBuilder.php create mode 100755 classes/map/ExportLogEntryMapBuilder.php create mode 100755 classes/map/ImportErrorMapBuilder.php create mode 100755 classes/map/ImportJobMapBuilder.php create mode 100755 classes/map/ImportLogEntryMapBuilder.php create mode 100755 classes/map/LabelMapBuilder.php create mode 100755 classes/map/LilacConfigurationMapBuilder.php create mode 100755 classes/map/ModuleHookMapBuilder.php create mode 100755 classes/map/ModuleMapBuilder.php create mode 100755 classes/map/NagiosBrokerModuleMapBuilder.php create mode 100755 classes/map/NagiosCgiConfigurationMapBuilder.php create mode 100755 classes/map/NagiosCommandMapBuilder.php create mode 100755 classes/map/NagiosContactAddressMapBuilder.php create mode 100755 classes/map/NagiosContactGroupMapBuilder.php create mode 100755 classes/map/NagiosContactGroupMemberMapBuilder.php create mode 100755 classes/map/NagiosContactMapBuilder.php create mode 100755 classes/map/NagiosContactNotificationCommandMapBuilder.php create mode 100755 classes/map/NagiosDependencyMapBuilder.php create mode 100755 classes/map/NagiosDependencyTargetMapBuilder.php create mode 100755 classes/map/NagiosEscalationContactMapBuilder.php create mode 100755 classes/map/NagiosEscalationContactgroupMapBuilder.php create mode 100755 classes/map/NagiosEscalationMapBuilder.php create mode 100755 classes/map/NagiosHostCheckCommandParameterMapBuilder.php create mode 100755 classes/map/NagiosHostContactMemberMapBuilder.php create mode 100755 classes/map/NagiosHostContactgroupMapBuilder.php create mode 100755 classes/map/NagiosHostMapBuilder.php create mode 100755 classes/map/NagiosHostParentMapBuilder.php create mode 100755 classes/map/NagiosHostTemplateAutodiscoveryServiceMapBuilder.php create mode 100755 classes/map/NagiosHostTemplateInheritanceMapBuilder.php create mode 100755 classes/map/NagiosHostTemplateMapBuilder.php create mode 100755 classes/map/NagiosHostgroupMapBuilder.php create mode 100755 classes/map/NagiosHostgroupMembershipMapBuilder.php create mode 100755 classes/map/NagiosMainConfigurationMapBuilder.php create mode 100755 classes/map/NagiosResourceMapBuilder.php create mode 100755 classes/map/NagiosServiceCheckCommandParameterMapBuilder.php create mode 100755 classes/map/NagiosServiceContactGroupMemberMapBuilder.php create mode 100755 classes/map/NagiosServiceContactMemberMapBuilder.php create mode 100755 classes/map/NagiosServiceGroupMapBuilder.php create mode 100755 classes/map/NagiosServiceGroupMemberMapBuilder.php create mode 100755 classes/map/NagiosServiceMapBuilder.php create mode 100755 classes/map/NagiosServiceTemplateInheritanceMapBuilder.php create mode 100755 classes/map/NagiosServiceTemplateMapBuilder.php create mode 100755 classes/map/NagiosTimeperiodEntryMapBuilder.php create mode 100755 classes/map/NagiosTimeperiodExcludeMapBuilder.php create mode 100755 classes/map/NagiosTimeperiodMapBuilder.php create mode 100755 classes/om/BaseAutodiscoveryDevice.php create mode 100755 classes/om/BaseAutodiscoveryDevicePeer.php create mode 100755 classes/om/BaseAutodiscoveryDeviceService.php create mode 100755 classes/om/BaseAutodiscoveryDeviceServicePeer.php create mode 100755 classes/om/BaseAutodiscoveryDeviceTemplateMatch.php create mode 100755 classes/om/BaseAutodiscoveryDeviceTemplateMatchPeer.php create mode 100755 classes/om/BaseAutodiscoveryJob.php create mode 100755 classes/om/BaseAutodiscoveryJobPeer.php create mode 100755 classes/om/BaseAutodiscoveryLogEntry.php create mode 100755 classes/om/BaseAutodiscoveryLogEntryPeer.php create mode 100755 classes/om/BaseExportJob.php create mode 100755 classes/om/BaseExportJobPeer.php create mode 100755 classes/om/BaseExportLogEntry.php create mode 100755 classes/om/BaseExportLogEntryPeer.php create mode 100755 classes/om/BaseImportError.php create mode 100755 classes/om/BaseImportErrorPeer.php create mode 100755 classes/om/BaseImportJob.php create mode 100755 classes/om/BaseImportJobPeer.php create mode 100755 classes/om/BaseImportLogEntry.php create mode 100755 classes/om/BaseImportLogEntryPeer.php create mode 100755 classes/om/BaseLabel.php create mode 100755 classes/om/BaseLabelPeer.php create mode 100755 classes/om/BaseLilacConfiguration.php create mode 100755 classes/om/BaseLilacConfigurationPeer.php create mode 100755 classes/om/BaseModule.php create mode 100755 classes/om/BaseModulePeer.php create mode 100755 classes/om/BaseNagiosBrokerModule.php create mode 100755 classes/om/BaseNagiosBrokerModulePeer.php create mode 100755 classes/om/BaseNagiosCgiConfiguration.php create mode 100755 classes/om/BaseNagiosCgiConfigurationPeer.php create mode 100755 classes/om/BaseNagiosCommand.php create mode 100755 classes/om/BaseNagiosCommandPeer.php create mode 100755 classes/om/BaseNagiosContact.php create mode 100755 classes/om/BaseNagiosContactAddress.php create mode 100755 classes/om/BaseNagiosContactAddressPeer.php create mode 100755 classes/om/BaseNagiosContactGroup.php create mode 100755 classes/om/BaseNagiosContactGroupMember.php create mode 100755 classes/om/BaseNagiosContactGroupMemberPeer.php create mode 100755 classes/om/BaseNagiosContactGroupPeer.php create mode 100755 classes/om/BaseNagiosContactNotificationCommand.php create mode 100755 classes/om/BaseNagiosContactNotificationCommandPeer.php create mode 100755 classes/om/BaseNagiosContactPeer.php create mode 100755 classes/om/BaseNagiosDependency.php create mode 100755 classes/om/BaseNagiosDependencyPeer.php create mode 100755 classes/om/BaseNagiosDependencyTarget.php create mode 100755 classes/om/BaseNagiosDependencyTargetPeer.php create mode 100755 classes/om/BaseNagiosEscalation.php create mode 100755 classes/om/BaseNagiosEscalationContact.php create mode 100755 classes/om/BaseNagiosEscalationContactPeer.php create mode 100755 classes/om/BaseNagiosEscalationContactgroup.php create mode 100755 classes/om/BaseNagiosEscalationContactgroupPeer.php create mode 100755 classes/om/BaseNagiosEscalationPeer.php create mode 100755 classes/om/BaseNagiosHost.php create mode 100755 classes/om/BaseNagiosHostCheckCommandParameter.php create mode 100755 classes/om/BaseNagiosHostCheckCommandParameterPeer.php create mode 100755 classes/om/BaseNagiosHostContactMember.php create mode 100755 classes/om/BaseNagiosHostContactMemberPeer.php create mode 100755 classes/om/BaseNagiosHostContactgroup.php create mode 100755 classes/om/BaseNagiosHostContactgroupPeer.php create mode 100755 classes/om/BaseNagiosHostParent.php create mode 100755 classes/om/BaseNagiosHostParentPeer.php create mode 100755 classes/om/BaseNagiosHostPeer.php create mode 100755 classes/om/BaseNagiosHostTemplate.php create mode 100755 classes/om/BaseNagiosHostTemplateAutodiscoveryService.php create mode 100755 classes/om/BaseNagiosHostTemplateAutodiscoveryServicePeer.php create mode 100755 classes/om/BaseNagiosHostTemplateInheritance.php create mode 100755 classes/om/BaseNagiosHostTemplateInheritancePeer.php create mode 100755 classes/om/BaseNagiosHostTemplatePeer.php create mode 100755 classes/om/BaseNagiosHostgroup.php create mode 100755 classes/om/BaseNagiosHostgroupMembership.php create mode 100755 classes/om/BaseNagiosHostgroupMembershipPeer.php create mode 100755 classes/om/BaseNagiosHostgroupPeer.php create mode 100755 classes/om/BaseNagiosMainConfiguration.php create mode 100755 classes/om/BaseNagiosMainConfigurationPeer.php create mode 100755 classes/om/BaseNagiosResource.php create mode 100755 classes/om/BaseNagiosResourcePeer.php create mode 100755 classes/om/BaseNagiosService.php create mode 100755 classes/om/BaseNagiosServiceCheckCommandParameter.php create mode 100755 classes/om/BaseNagiosServiceCheckCommandParameterPeer.php create mode 100755 classes/om/BaseNagiosServiceContactGroupMember.php create mode 100755 classes/om/BaseNagiosServiceContactGroupMemberPeer.php create mode 100755 classes/om/BaseNagiosServiceContactMember.php create mode 100755 classes/om/BaseNagiosServiceContactMemberPeer.php create mode 100755 classes/om/BaseNagiosServiceGroup.php create mode 100755 classes/om/BaseNagiosServiceGroupMember.php create mode 100755 classes/om/BaseNagiosServiceGroupMemberPeer.php create mode 100755 classes/om/BaseNagiosServiceGroupPeer.php create mode 100755 classes/om/BaseNagiosServicePeer.php create mode 100755 classes/om/BaseNagiosServiceTemplate.php create mode 100755 classes/om/BaseNagiosServiceTemplateInheritance.php create mode 100755 classes/om/BaseNagiosServiceTemplateInheritancePeer.php create mode 100755 classes/om/BaseNagiosServiceTemplatePeer.php create mode 100755 classes/om/BaseNagiosTimeperiod.php create mode 100755 classes/om/BaseNagiosTimeperiodEntry.php create mode 100755 classes/om/BaseNagiosTimeperiodEntryPeer.php create mode 100755 classes/om/BaseNagiosTimeperiodExclude.php create mode 100755 classes/om/BaseNagiosTimeperiodExcludePeer.php create mode 100755 classes/om/BaseNagiosTimeperiodPeer.php create mode 100755 commands.php create mode 100755 contactgroups.php create mode 100755 contacts.php create mode 100755 dependency.php create mode 100755 escalation.php create mode 100755 export.php create mode 100755 exporter/classes.inc.php create mode 100755 exporter/engines/nagios/NagiosExportEngine.php create mode 100755 exporter/export.php create mode 100755 exporter/exporters/nagios/NagiosCgiExporter.php create mode 100755 exporter/exporters/nagios/NagiosCommandExporter.php create mode 100755 exporter/exporters/nagios/NagiosContactExporter.php create mode 100755 exporter/exporters/nagios/NagiosContactGroupExporter.php create mode 100755 exporter/exporters/nagios/NagiosDependencyExporter.php create mode 100755 exporter/exporters/nagios/NagiosEscalationExporter.php create mode 100755 exporter/exporters/nagios/NagiosHostExporter.php create mode 100755 exporter/exporters/nagios/NagiosHostGroupExporter.php create mode 100755 exporter/exporters/nagios/NagiosMainExporter.php create mode 100755 exporter/exporters/nagios/NagiosResourceExporter.php create mode 100755 exporter/exporters/nagios/NagiosServiceExporter.php create mode 100755 exporter/exporters/nagios/NagiosServiceGroupExporter.php create mode 100755 exporter/exporters/nagios/NagiosTimePeriodExporter.php create mode 100755 favicon.ico create mode 100755 home.php create mode 100755 host_template.php create mode 100755 hostgroups.php create mode 100755 hosts.php create mode 100755 images/branch.gif create mode 100755 images/branchbottom.gif create mode 100755 images/branchtop.gif create mode 100755 images/c3-icon-services-sm.gif create mode 100755 images/configurator.gif create mode 100755 images/contact.gif create mode 100755 images/dotclear.gif create mode 100755 images/flexigrid/bg.gif create mode 100755 images/flexigrid/btn-sprite.gif create mode 100755 images/flexigrid/ddn.png create mode 100755 images/flexigrid/dn.png create mode 100755 images/flexigrid/fhbg.gif create mode 100755 images/flexigrid/first.gif create mode 100755 images/flexigrid/hl.png create mode 100755 images/flexigrid/last.gif create mode 100755 images/flexigrid/line.gif create mode 100755 images/flexigrid/load.gif create mode 100755 images/flexigrid/load.png create mode 100755 images/flexigrid/magnifier.png create mode 100755 images/flexigrid/next.gif create mode 100755 images/flexigrid/prev.gif create mode 100755 images/flexigrid/up.png create mode 100755 images/flexigrid/uup.png create mode 100755 images/flexigrid/wbg.gif create mode 100755 images/folder-expanded.gif create mode 100755 images/folder.gif create mode 100755 images/gradient.gif create mode 100755 images/icons/accept.png create mode 100755 images/icons/add.png create mode 100755 images/icons/anchor.png create mode 100755 images/icons/application.png create mode 100755 images/icons/application_add.png create mode 100755 images/icons/application_cascade.png create mode 100755 images/icons/application_delete.png create mode 100755 images/icons/application_double.png create mode 100755 images/icons/application_edit.png create mode 100755 images/icons/application_error.png create mode 100755 images/icons/application_form.png create mode 100755 images/icons/application_form_add.png create mode 100755 images/icons/application_form_delete.png create mode 100755 images/icons/application_form_edit.png create mode 100755 images/icons/application_form_magnify.png create mode 100755 images/icons/application_get.png create mode 100755 images/icons/application_go.png create mode 100755 images/icons/application_home.png create mode 100755 images/icons/application_key.png create mode 100755 images/icons/application_lightning.png create mode 100755 images/icons/application_link.png create mode 100755 images/icons/application_osx.png create mode 100755 images/icons/application_osx_terminal.png create mode 100755 images/icons/application_put.png create mode 100755 images/icons/application_side_boxes.png create mode 100755 images/icons/application_side_contract.png create mode 100755 images/icons/application_side_expand.png create mode 100755 images/icons/application_side_list.png create mode 100755 images/icons/application_side_tree.png create mode 100755 images/icons/application_split.png create mode 100755 images/icons/application_tile_horizontal.png create mode 100755 images/icons/application_tile_vertical.png create mode 100755 images/icons/application_view_columns.png create mode 100755 images/icons/application_view_detail.png create mode 100755 images/icons/application_view_gallery.png create mode 100755 images/icons/application_view_icons.png create mode 100755 images/icons/application_view_list.png create mode 100755 images/icons/application_view_tile.png create mode 100755 images/icons/application_xp.png create mode 100755 images/icons/application_xp_terminal.png create mode 100755 images/icons/arrow_branch.png create mode 100755 images/icons/arrow_divide.png create mode 100755 images/icons/arrow_down.png create mode 100755 images/icons/arrow_in.png create mode 100755 images/icons/arrow_inout.png create mode 100755 images/icons/arrow_join.png create mode 100755 images/icons/arrow_left.png create mode 100755 images/icons/arrow_merge.png create mode 100755 images/icons/arrow_out.png create mode 100755 images/icons/arrow_redo.png create mode 100755 images/icons/arrow_refresh.png create mode 100755 images/icons/arrow_refresh_small.png create mode 100755 images/icons/arrow_right.png create mode 100755 images/icons/arrow_rotate_anticlockwise.png create mode 100755 images/icons/arrow_rotate_clockwise.png create mode 100755 images/icons/arrow_switch.png create mode 100755 images/icons/arrow_turn_left.png create mode 100755 images/icons/arrow_turn_right.png create mode 100755 images/icons/arrow_undo.png create mode 100755 images/icons/arrow_up.png create mode 100755 images/icons/asterisk_orange.png create mode 100755 images/icons/asterisk_yellow.png create mode 100755 images/icons/attach.png create mode 100755 images/icons/award_star_add.png create mode 100755 images/icons/award_star_bronze_1.png create mode 100755 images/icons/award_star_bronze_2.png create mode 100755 images/icons/award_star_bronze_3.png create mode 100755 images/icons/award_star_delete.png create mode 100755 images/icons/award_star_gold_1.png create mode 100755 images/icons/award_star_gold_2.png create mode 100755 images/icons/award_star_gold_3.png create mode 100755 images/icons/award_star_silver_1.png create mode 100755 images/icons/award_star_silver_2.png create mode 100755 images/icons/award_star_silver_3.png create mode 100755 images/icons/basket.png create mode 100755 images/icons/basket_add.png create mode 100755 images/icons/basket_delete.png create mode 100755 images/icons/basket_edit.png create mode 100755 images/icons/basket_error.png create mode 100755 images/icons/basket_go.png create mode 100755 images/icons/basket_put.png create mode 100755 images/icons/basket_remove.png create mode 100755 images/icons/bell.png create mode 100755 images/icons/bell_add.png create mode 100755 images/icons/bell_delete.png create mode 100755 images/icons/bell_error.png create mode 100755 images/icons/bell_go.png create mode 100755 images/icons/bell_link.png create mode 100755 images/icons/bin.png create mode 100755 images/icons/bin_closed.png create mode 100755 images/icons/bin_empty.png create mode 100755 images/icons/bomb.png create mode 100755 images/icons/book.png create mode 100755 images/icons/book_add.png create mode 100755 images/icons/book_addresses.png create mode 100755 images/icons/book_delete.png create mode 100755 images/icons/book_edit.png create mode 100755 images/icons/book_error.png create mode 100755 images/icons/book_go.png create mode 100755 images/icons/book_key.png create mode 100755 images/icons/book_link.png create mode 100755 images/icons/book_next.png create mode 100755 images/icons/book_open.png create mode 100755 images/icons/book_previous.png create mode 100755 images/icons/box.png create mode 100755 images/icons/brick.png create mode 100755 images/icons/brick_add.png create mode 100755 images/icons/brick_delete.png create mode 100755 images/icons/brick_edit.png create mode 100755 images/icons/brick_error.png create mode 100755 images/icons/brick_go.png create mode 100755 images/icons/brick_link.png create mode 100755 images/icons/bricks.png create mode 100755 images/icons/briefcase.png create mode 100755 images/icons/bug.png create mode 100755 images/icons/bug_add.png create mode 100755 images/icons/bug_delete.png create mode 100755 images/icons/bug_edit.png create mode 100755 images/icons/bug_error.png create mode 100755 images/icons/bug_go.png create mode 100755 images/icons/bug_link.png create mode 100755 images/icons/building.png create mode 100755 images/icons/building_add.png create mode 100755 images/icons/building_delete.png create mode 100755 images/icons/building_edit.png create mode 100755 images/icons/building_error.png create mode 100755 images/icons/building_go.png create mode 100755 images/icons/building_key.png create mode 100755 images/icons/building_link.png create mode 100755 images/icons/bullet_add.png create mode 100755 images/icons/bullet_arrow_bottom.png create mode 100755 images/icons/bullet_arrow_down.png create mode 100755 images/icons/bullet_arrow_top.png create mode 100755 images/icons/bullet_arrow_up.png create mode 100755 images/icons/bullet_black.png create mode 100755 images/icons/bullet_blue.png create mode 100755 images/icons/bullet_delete.png create mode 100755 images/icons/bullet_disk.png create mode 100755 images/icons/bullet_error.png create mode 100755 images/icons/bullet_feed.png create mode 100755 images/icons/bullet_go.png create mode 100755 images/icons/bullet_green.png create mode 100755 images/icons/bullet_key.png create mode 100755 images/icons/bullet_orange.png create mode 100755 images/icons/bullet_picture.png create mode 100755 images/icons/bullet_pink.png create mode 100755 images/icons/bullet_purple.png create mode 100755 images/icons/bullet_red.png create mode 100755 images/icons/bullet_star.png create mode 100755 images/icons/bullet_toggle_minus.png create mode 100755 images/icons/bullet_toggle_plus.png create mode 100755 images/icons/bullet_white.png create mode 100755 images/icons/bullet_wrench.png create mode 100755 images/icons/bullet_yellow.png create mode 100755 images/icons/cake.png create mode 100755 images/icons/calculator.png create mode 100755 images/icons/calculator_add.png create mode 100755 images/icons/calculator_delete.png create mode 100755 images/icons/calculator_edit.png create mode 100755 images/icons/calculator_error.png create mode 100755 images/icons/calculator_link.png create mode 100755 images/icons/calendar.png create mode 100755 images/icons/calendar_add.png create mode 100755 images/icons/calendar_delete.png create mode 100755 images/icons/calendar_edit.png create mode 100755 images/icons/calendar_link.png create mode 100755 images/icons/calendar_view_day.png create mode 100755 images/icons/calendar_view_month.png create mode 100755 images/icons/calendar_view_week.png create mode 100755 images/icons/camera.png create mode 100755 images/icons/camera_add.png create mode 100755 images/icons/camera_delete.png create mode 100755 images/icons/camera_edit.png create mode 100755 images/icons/camera_error.png create mode 100755 images/icons/camera_go.png create mode 100755 images/icons/camera_link.png create mode 100755 images/icons/camera_small.png create mode 100755 images/icons/cancel.png create mode 100755 images/icons/car.png create mode 100755 images/icons/car_add.png create mode 100755 images/icons/car_delete.png create mode 100755 images/icons/cart.png create mode 100755 images/icons/cart_add.png create mode 100755 images/icons/cart_delete.png create mode 100755 images/icons/cart_edit.png create mode 100755 images/icons/cart_error.png create mode 100755 images/icons/cart_go.png create mode 100755 images/icons/cart_put.png create mode 100755 images/icons/cart_remove.png create mode 100755 images/icons/cd.png create mode 100755 images/icons/cd_add.png create mode 100755 images/icons/cd_burn.png create mode 100755 images/icons/cd_delete.png create mode 100755 images/icons/cd_edit.png create mode 100755 images/icons/cd_eject.png create mode 100755 images/icons/cd_go.png create mode 100755 images/icons/chart_bar.png create mode 100755 images/icons/chart_bar_add.png create mode 100755 images/icons/chart_bar_delete.png create mode 100755 images/icons/chart_bar_edit.png create mode 100755 images/icons/chart_bar_error.png create mode 100755 images/icons/chart_bar_link.png create mode 100755 images/icons/chart_curve.png create mode 100755 images/icons/chart_curve_add.png create mode 100755 images/icons/chart_curve_delete.png create mode 100755 images/icons/chart_curve_edit.png create mode 100755 images/icons/chart_curve_error.png create mode 100755 images/icons/chart_curve_go.png create mode 100755 images/icons/chart_curve_link.png create mode 100755 images/icons/chart_line.png create mode 100755 images/icons/chart_line_add.png create mode 100755 images/icons/chart_line_delete.png create mode 100755 images/icons/chart_line_edit.png create mode 100755 images/icons/chart_line_error.png create mode 100755 images/icons/chart_line_link.png create mode 100755 images/icons/chart_organisation.png create mode 100755 images/icons/chart_organisation_add.png create mode 100755 images/icons/chart_organisation_delete.png create mode 100755 images/icons/chart_pie.png create mode 100755 images/icons/chart_pie_add.png create mode 100755 images/icons/chart_pie_delete.png create mode 100755 images/icons/chart_pie_edit.png create mode 100755 images/icons/chart_pie_error.png create mode 100755 images/icons/chart_pie_link.png create mode 100755 images/icons/clock.png create mode 100755 images/icons/clock_add.png create mode 100755 images/icons/clock_delete.png create mode 100755 images/icons/clock_edit.png create mode 100755 images/icons/clock_error.png create mode 100755 images/icons/clock_go.png create mode 100755 images/icons/clock_link.png create mode 100755 images/icons/clock_pause.png create mode 100755 images/icons/clock_play.png create mode 100755 images/icons/clock_red.png create mode 100755 images/icons/clock_stop.png create mode 100755 images/icons/cog.png create mode 100755 images/icons/cog_add.png create mode 100755 images/icons/cog_delete.png create mode 100755 images/icons/cog_edit.png create mode 100755 images/icons/cog_error.png create mode 100755 images/icons/cog_go.png create mode 100755 images/icons/coins.png create mode 100755 images/icons/coins_add.png create mode 100755 images/icons/coins_delete.png create mode 100755 images/icons/color_swatch.png create mode 100755 images/icons/color_wheel.png create mode 100755 images/icons/comment.png create mode 100755 images/icons/comment_add.png create mode 100755 images/icons/comment_delete.png create mode 100755 images/icons/comment_edit.png create mode 100755 images/icons/comments.png create mode 100755 images/icons/comments_add.png create mode 100755 images/icons/comments_delete.png create mode 100755 images/icons/compress.png create mode 100755 images/icons/computer.png create mode 100755 images/icons/computer_add.png create mode 100755 images/icons/computer_delete.png create mode 100755 images/icons/computer_edit.png create mode 100755 images/icons/computer_error.png create mode 100755 images/icons/computer_go.png create mode 100755 images/icons/computer_key.png create mode 100755 images/icons/computer_link.png create mode 100755 images/icons/connect.png create mode 100755 images/icons/contrast.png create mode 100755 images/icons/contrast_decrease.png create mode 100755 images/icons/contrast_high.png create mode 100755 images/icons/contrast_increase.png create mode 100755 images/icons/contrast_low.png create mode 100755 images/icons/control_eject.png create mode 100755 images/icons/control_eject_blue.png create mode 100755 images/icons/control_end.png create mode 100755 images/icons/control_end_blue.png create mode 100755 images/icons/control_equalizer.png create mode 100755 images/icons/control_equalizer_blue.png create mode 100755 images/icons/control_fastforward.png create mode 100755 images/icons/control_fastforward_blue.png create mode 100755 images/icons/control_pause.png create mode 100755 images/icons/control_pause_blue.png create mode 100755 images/icons/control_play.png create mode 100755 images/icons/control_play_blue.png create mode 100755 images/icons/control_repeat.png create mode 100755 images/icons/control_repeat_blue.png create mode 100755 images/icons/control_rewind.png create mode 100755 images/icons/control_rewind_blue.png create mode 100755 images/icons/control_start.png create mode 100755 images/icons/control_start_blue.png create mode 100755 images/icons/control_stop.png create mode 100755 images/icons/control_stop_blue.png create mode 100755 images/icons/controller.png create mode 100755 images/icons/controller_add.png create mode 100755 images/icons/controller_delete.png create mode 100755 images/icons/controller_error.png create mode 100755 images/icons/creditcards.png create mode 100755 images/icons/cross.png create mode 100755 images/icons/css.png create mode 100755 images/icons/css_add.png create mode 100755 images/icons/css_delete.png create mode 100755 images/icons/css_go.png create mode 100755 images/icons/css_valid.png create mode 100755 images/icons/cup.png create mode 100755 images/icons/cup_add.png create mode 100755 images/icons/cup_delete.png create mode 100755 images/icons/cup_edit.png create mode 100755 images/icons/cup_error.png create mode 100755 images/icons/cup_go.png create mode 100755 images/icons/cup_key.png create mode 100755 images/icons/cup_link.png create mode 100755 images/icons/cursor.png create mode 100755 images/icons/cut.png create mode 100755 images/icons/cut_red.png create mode 100755 images/icons/database.png create mode 100755 images/icons/database_add.png create mode 100755 images/icons/database_connect.png create mode 100755 images/icons/database_delete.png create mode 100755 images/icons/database_edit.png create mode 100755 images/icons/database_error.png create mode 100755 images/icons/database_gear.png create mode 100755 images/icons/database_go.png create mode 100755 images/icons/database_key.png create mode 100755 images/icons/database_lightning.png create mode 100755 images/icons/database_link.png create mode 100755 images/icons/database_refresh.png create mode 100755 images/icons/database_save.png create mode 100755 images/icons/database_table.png create mode 100755 images/icons/date.png create mode 100755 images/icons/date_add.png create mode 100755 images/icons/date_delete.png create mode 100755 images/icons/date_edit.png create mode 100755 images/icons/date_error.png create mode 100755 images/icons/date_go.png create mode 100755 images/icons/date_link.png create mode 100755 images/icons/date_magnify.png create mode 100755 images/icons/date_next.png create mode 100755 images/icons/date_previous.png create mode 100755 images/icons/delete.png create mode 100755 images/icons/disconnect.png create mode 100755 images/icons/disk.png create mode 100755 images/icons/disk_multiple.png create mode 100755 images/icons/door.png create mode 100755 images/icons/door_in.png create mode 100755 images/icons/door_open.png create mode 100755 images/icons/door_out.png create mode 100755 images/icons/drink.png create mode 100755 images/icons/drink_empty.png create mode 100755 images/icons/drive.png create mode 100755 images/icons/drive_add.png create mode 100755 images/icons/drive_burn.png create mode 100755 images/icons/drive_cd.png create mode 100755 images/icons/drive_cd_empty.png create mode 100755 images/icons/drive_delete.png create mode 100755 images/icons/drive_disk.png create mode 100755 images/icons/drive_edit.png create mode 100755 images/icons/drive_error.png create mode 100755 images/icons/drive_go.png create mode 100755 images/icons/drive_key.png create mode 100755 images/icons/drive_link.png create mode 100755 images/icons/drive_magnify.png create mode 100755 images/icons/drive_network.png create mode 100755 images/icons/drive_rename.png create mode 100755 images/icons/drive_user.png create mode 100755 images/icons/drive_web.png create mode 100755 images/icons/dvd.png create mode 100755 images/icons/dvd_add.png create mode 100755 images/icons/dvd_delete.png create mode 100755 images/icons/dvd_edit.png create mode 100755 images/icons/dvd_error.png create mode 100755 images/icons/dvd_go.png create mode 100755 images/icons/dvd_key.png create mode 100755 images/icons/dvd_link.png create mode 100755 images/icons/email.png create mode 100755 images/icons/email_add.png create mode 100755 images/icons/email_attach.png create mode 100755 images/icons/email_delete.png create mode 100755 images/icons/email_edit.png create mode 100755 images/icons/email_error.png create mode 100755 images/icons/email_go.png create mode 100755 images/icons/email_link.png create mode 100755 images/icons/email_open.png create mode 100755 images/icons/email_open_image.png create mode 100755 images/icons/emoticon_evilgrin.png create mode 100755 images/icons/emoticon_grin.png create mode 100755 images/icons/emoticon_happy.png create mode 100755 images/icons/emoticon_smile.png create mode 100755 images/icons/emoticon_surprised.png create mode 100755 images/icons/emoticon_tongue.png create mode 100755 images/icons/emoticon_unhappy.png create mode 100755 images/icons/emoticon_waii.png create mode 100755 images/icons/emoticon_wink.png create mode 100755 images/icons/error.png create mode 100755 images/icons/error_add.png create mode 100755 images/icons/error_delete.png create mode 100755 images/icons/error_go.png create mode 100755 images/icons/exclamation.png create mode 100755 images/icons/eye.png create mode 100755 images/icons/feed.png create mode 100755 images/icons/feed_add.png create mode 100755 images/icons/feed_delete.png create mode 100755 images/icons/feed_disk.png create mode 100755 images/icons/feed_edit.png create mode 100755 images/icons/feed_error.png create mode 100755 images/icons/feed_go.png create mode 100755 images/icons/feed_key.png create mode 100755 images/icons/feed_link.png create mode 100755 images/icons/feed_magnify.png create mode 100755 images/icons/female.png create mode 100755 images/icons/film.png create mode 100755 images/icons/film_add.png create mode 100755 images/icons/film_delete.png create mode 100755 images/icons/film_edit.png create mode 100755 images/icons/film_error.png create mode 100755 images/icons/film_go.png create mode 100755 images/icons/film_key.png create mode 100755 images/icons/film_link.png create mode 100755 images/icons/film_save.png create mode 100755 images/icons/find.png create mode 100755 images/icons/flag_blue.png create mode 100755 images/icons/flag_green.png create mode 100755 images/icons/flag_orange.png create mode 100755 images/icons/flag_pink.png create mode 100755 images/icons/flag_purple.png create mode 100755 images/icons/flag_red.png create mode 100755 images/icons/flag_yellow.png create mode 100755 images/icons/folder.png create mode 100755 images/icons/folder_add.png create mode 100755 images/icons/folder_bell.png create mode 100755 images/icons/folder_brick.png create mode 100755 images/icons/folder_bug.png create mode 100755 images/icons/folder_camera.png create mode 100755 images/icons/folder_database.png create mode 100755 images/icons/folder_delete.png create mode 100755 images/icons/folder_edit.png create mode 100755 images/icons/folder_error.png create mode 100755 images/icons/folder_explore.png create mode 100755 images/icons/folder_feed.png create mode 100755 images/icons/folder_find.png create mode 100755 images/icons/folder_go.png create mode 100755 images/icons/folder_heart.png create mode 100755 images/icons/folder_image.png create mode 100755 images/icons/folder_key.png create mode 100755 images/icons/folder_lightbulb.png create mode 100755 images/icons/folder_link.png create mode 100755 images/icons/folder_magnify.png create mode 100755 images/icons/folder_page.png create mode 100755 images/icons/folder_page_white.png create mode 100755 images/icons/folder_palette.png create mode 100755 images/icons/folder_picture.png create mode 100755 images/icons/folder_star.png create mode 100755 images/icons/folder_table.png create mode 100755 images/icons/folder_user.png create mode 100755 images/icons/folder_wrench.png create mode 100755 images/icons/font.png create mode 100755 images/icons/font_add.png create mode 100755 images/icons/font_delete.png create mode 100755 images/icons/font_go.png create mode 100755 images/icons/group.png create mode 100755 images/icons/group_add.png create mode 100755 images/icons/group_delete.png create mode 100755 images/icons/group_edit.png create mode 100755 images/icons/group_error.png create mode 100755 images/icons/group_gear.png create mode 100755 images/icons/group_go.png create mode 100755 images/icons/group_key.png create mode 100755 images/icons/group_link.png create mode 100755 images/icons/heart.png create mode 100755 images/icons/heart_add.png create mode 100755 images/icons/heart_delete.png create mode 100755 images/icons/help.png create mode 100755 images/icons/hourglass.png create mode 100755 images/icons/hourglass_add.png create mode 100755 images/icons/hourglass_delete.png create mode 100755 images/icons/hourglass_go.png create mode 100755 images/icons/hourglass_link.png create mode 100755 images/icons/house.png create mode 100755 images/icons/house_go.png create mode 100755 images/icons/house_link.png create mode 100755 images/icons/html.png create mode 100755 images/icons/html_add.png create mode 100755 images/icons/html_delete.png create mode 100755 images/icons/html_go.png create mode 100755 images/icons/html_valid.png create mode 100755 images/icons/image.png create mode 100755 images/icons/image_add.png create mode 100755 images/icons/image_delete.png create mode 100755 images/icons/image_edit.png create mode 100755 images/icons/image_link.png create mode 100755 images/icons/images.png create mode 100755 images/icons/information.png create mode 100755 images/icons/ipod.png create mode 100755 images/icons/ipod_cast.png create mode 100755 images/icons/ipod_cast_add.png create mode 100755 images/icons/ipod_cast_delete.png create mode 100755 images/icons/ipod_sound.png create mode 100755 images/icons/joystick.png create mode 100755 images/icons/joystick_add.png create mode 100755 images/icons/joystick_delete.png create mode 100755 images/icons/joystick_error.png create mode 100755 images/icons/key.png create mode 100755 images/icons/key_add.png create mode 100755 images/icons/key_delete.png create mode 100755 images/icons/key_go.png create mode 100755 images/icons/keyboard.png create mode 100755 images/icons/keyboard_add.png create mode 100755 images/icons/keyboard_delete.png create mode 100755 images/icons/keyboard_magnify.png create mode 100755 images/icons/layers.png create mode 100755 images/icons/layout.png create mode 100755 images/icons/layout_add.png create mode 100755 images/icons/layout_content.png create mode 100755 images/icons/layout_delete.png create mode 100755 images/icons/layout_edit.png create mode 100755 images/icons/layout_error.png create mode 100755 images/icons/layout_header.png create mode 100755 images/icons/layout_link.png create mode 100755 images/icons/layout_sidebar.png create mode 100755 images/icons/lightbulb.png create mode 100755 images/icons/lightbulb_add.png create mode 100755 images/icons/lightbulb_delete.png create mode 100755 images/icons/lightbulb_off.png create mode 100755 images/icons/lightning.png create mode 100755 images/icons/lightning_add.png create mode 100755 images/icons/lightning_delete.png create mode 100755 images/icons/lightning_go.png create mode 100755 images/icons/link.png create mode 100755 images/icons/link_add.png create mode 100755 images/icons/link_break.png create mode 100755 images/icons/link_delete.png create mode 100755 images/icons/link_edit.png create mode 100755 images/icons/link_error.png create mode 100755 images/icons/link_go.png create mode 100755 images/icons/lock.png create mode 100755 images/icons/lock_add.png create mode 100755 images/icons/lock_break.png create mode 100755 images/icons/lock_delete.png create mode 100755 images/icons/lock_edit.png create mode 100755 images/icons/lock_go.png create mode 100755 images/icons/lock_open.png create mode 100755 images/icons/lorry.png create mode 100755 images/icons/lorry_add.png create mode 100755 images/icons/lorry_delete.png create mode 100755 images/icons/lorry_error.png create mode 100755 images/icons/lorry_flatbed.png create mode 100755 images/icons/lorry_go.png create mode 100755 images/icons/lorry_link.png create mode 100755 images/icons/magifier_zoom_out.png create mode 100755 images/icons/magnifier.png create mode 100755 images/icons/magnifier_zoom_in.png create mode 100755 images/icons/male.png create mode 100755 images/icons/map.png create mode 100755 images/icons/map_add.png create mode 100755 images/icons/map_delete.png create mode 100755 images/icons/map_edit.png create mode 100755 images/icons/map_go.png create mode 100755 images/icons/map_magnify.png create mode 100755 images/icons/medal_bronze_1.png create mode 100755 images/icons/medal_bronze_2.png create mode 100755 images/icons/medal_bronze_3.png create mode 100755 images/icons/medal_bronze_add.png create mode 100755 images/icons/medal_bronze_delete.png create mode 100755 images/icons/medal_gold_1.png create mode 100755 images/icons/medal_gold_2.png create mode 100755 images/icons/medal_gold_3.png create mode 100755 images/icons/medal_gold_add.png create mode 100755 images/icons/medal_gold_delete.png create mode 100755 images/icons/medal_silver_1.png create mode 100755 images/icons/medal_silver_2.png create mode 100755 images/icons/medal_silver_3.png create mode 100755 images/icons/medal_silver_add.png create mode 100755 images/icons/medal_silver_delete.png create mode 100755 images/icons/money.png create mode 100755 images/icons/money_add.png create mode 100755 images/icons/money_delete.png create mode 100755 images/icons/money_dollar.png create mode 100755 images/icons/money_euro.png create mode 100755 images/icons/money_pound.png create mode 100755 images/icons/money_yen.png create mode 100755 images/icons/monitor.png create mode 100755 images/icons/monitor_add.png create mode 100755 images/icons/monitor_delete.png create mode 100755 images/icons/monitor_edit.png create mode 100755 images/icons/monitor_error.png create mode 100755 images/icons/monitor_go.png create mode 100755 images/icons/monitor_lightning.png create mode 100755 images/icons/monitor_link.png create mode 100755 images/icons/mouse.png create mode 100755 images/icons/mouse_add.png create mode 100755 images/icons/mouse_delete.png create mode 100755 images/icons/mouse_error.png create mode 100755 images/icons/music.png create mode 100755 images/icons/new.png create mode 100755 images/icons/newspaper.png create mode 100755 images/icons/newspaper_add.png create mode 100755 images/icons/newspaper_delete.png create mode 100755 images/icons/newspaper_go.png create mode 100755 images/icons/newspaper_link.png create mode 100755 images/icons/note.png create mode 100755 images/icons/note_add.png create mode 100755 images/icons/note_delete.png create mode 100755 images/icons/note_edit.png create mode 100755 images/icons/note_error.png create mode 100755 images/icons/note_go.png create mode 100755 images/icons/overlays.png create mode 100755 images/icons/package.png create mode 100755 images/icons/package_add.png create mode 100755 images/icons/package_delete.png create mode 100755 images/icons/package_go.png create mode 100755 images/icons/package_green.png create mode 100755 images/icons/package_link.png create mode 100755 images/icons/page.png create mode 100755 images/icons/page_add.png create mode 100755 images/icons/page_attach.png create mode 100755 images/icons/page_code.png create mode 100755 images/icons/page_copy.png create mode 100755 images/icons/page_delete.png create mode 100755 images/icons/page_edit.png create mode 100755 images/icons/page_error.png create mode 100755 images/icons/page_excel.png create mode 100755 images/icons/page_find.png create mode 100755 images/icons/page_gear.png create mode 100755 images/icons/page_go.png create mode 100755 images/icons/page_green.png create mode 100755 images/icons/page_key.png create mode 100755 images/icons/page_lightning.png create mode 100755 images/icons/page_link.png create mode 100755 images/icons/page_paintbrush.png create mode 100755 images/icons/page_paste.png create mode 100755 images/icons/page_red.png create mode 100755 images/icons/page_refresh.png create mode 100755 images/icons/page_save.png create mode 100755 images/icons/page_white.png create mode 100755 images/icons/page_white_acrobat.png create mode 100755 images/icons/page_white_actionscript.png create mode 100755 images/icons/page_white_add.png create mode 100755 images/icons/page_white_c.png create mode 100755 images/icons/page_white_camera.png create mode 100755 images/icons/page_white_cd.png create mode 100755 images/icons/page_white_code.png create mode 100755 images/icons/page_white_code_red.png create mode 100755 images/icons/page_white_coldfusion.png create mode 100755 images/icons/page_white_compressed.png create mode 100755 images/icons/page_white_copy.png create mode 100755 images/icons/page_white_cplusplus.png create mode 100755 images/icons/page_white_csharp.png create mode 100755 images/icons/page_white_cup.png create mode 100755 images/icons/page_white_database.png create mode 100755 images/icons/page_white_delete.png create mode 100755 images/icons/page_white_dvd.png create mode 100755 images/icons/page_white_edit.png create mode 100755 images/icons/page_white_error.png create mode 100755 images/icons/page_white_excel.png create mode 100755 images/icons/page_white_find.png create mode 100755 images/icons/page_white_flash.png create mode 100755 images/icons/page_white_freehand.png create mode 100755 images/icons/page_white_gear.png create mode 100755 images/icons/page_white_get.png create mode 100755 images/icons/page_white_go.png create mode 100755 images/icons/page_white_h.png create mode 100755 images/icons/page_white_horizontal.png create mode 100755 images/icons/page_white_key.png create mode 100755 images/icons/page_white_lightning.png create mode 100755 images/icons/page_white_link.png create mode 100755 images/icons/page_white_magnify.png create mode 100755 images/icons/page_white_medal.png create mode 100755 images/icons/page_white_office.png create mode 100755 images/icons/page_white_paint.png create mode 100755 images/icons/page_white_paintbrush.png create mode 100755 images/icons/page_white_paste.png create mode 100755 images/icons/page_white_php.png create mode 100755 images/icons/page_white_picture.png create mode 100755 images/icons/page_white_powerpoint.png create mode 100755 images/icons/page_white_put.png create mode 100755 images/icons/page_white_ruby.png create mode 100755 images/icons/page_white_stack.png create mode 100755 images/icons/page_white_star.png create mode 100755 images/icons/page_white_swoosh.png create mode 100755 images/icons/page_white_text.png create mode 100755 images/icons/page_white_text_width.png create mode 100755 images/icons/page_white_tux.png create mode 100755 images/icons/page_white_vector.png create mode 100755 images/icons/page_white_visualstudio.png create mode 100755 images/icons/page_white_width.png create mode 100755 images/icons/page_white_word.png create mode 100755 images/icons/page_white_world.png create mode 100755 images/icons/page_white_wrench.png create mode 100755 images/icons/page_white_zip.png create mode 100755 images/icons/page_word.png create mode 100755 images/icons/page_world.png create mode 100755 images/icons/paintbrush.png create mode 100755 images/icons/paintcan.png create mode 100755 images/icons/palette.png create mode 100755 images/icons/paste_plain.png create mode 100755 images/icons/paste_word.png create mode 100755 images/icons/pencil.png create mode 100755 images/icons/pencil_add.png create mode 100755 images/icons/pencil_delete.png create mode 100755 images/icons/pencil_go.png create mode 100755 images/icons/phone.png create mode 100755 images/icons/phone_add.png create mode 100755 images/icons/phone_delete.png create mode 100755 images/icons/phone_sound.png create mode 100755 images/icons/photo.png create mode 100755 images/icons/photo_add.png create mode 100755 images/icons/photo_delete.png create mode 100755 images/icons/photo_link.png create mode 100755 images/icons/photos.png create mode 100755 images/icons/picture.png create mode 100755 images/icons/picture_add.png create mode 100755 images/icons/picture_delete.png create mode 100755 images/icons/picture_edit.png create mode 100755 images/icons/picture_empty.png create mode 100755 images/icons/picture_error.png create mode 100755 images/icons/picture_go.png create mode 100755 images/icons/picture_key.png create mode 100755 images/icons/picture_link.png create mode 100755 images/icons/picture_save.png create mode 100755 images/icons/pictures.png create mode 100755 images/icons/pilcrow.png create mode 100755 images/icons/pill.png create mode 100755 images/icons/pill_add.png create mode 100755 images/icons/pill_delete.png create mode 100755 images/icons/pill_go.png create mode 100755 images/icons/plugin.png create mode 100755 images/icons/plugin_add.png create mode 100755 images/icons/plugin_delete.png create mode 100755 images/icons/plugin_disabled.png create mode 100755 images/icons/plugin_edit.png create mode 100755 images/icons/plugin_error.png create mode 100755 images/icons/plugin_go.png create mode 100755 images/icons/plugin_link.png create mode 100755 images/icons/printer.png create mode 100755 images/icons/printer_add.png create mode 100755 images/icons/printer_delete.png create mode 100755 images/icons/printer_empty.png create mode 100755 images/icons/printer_error.png create mode 100755 images/icons/rainbow.png create mode 100755 images/icons/readme.html create mode 100755 images/icons/readme.txt create mode 100755 images/icons/report.png create mode 100755 images/icons/report_add.png create mode 100755 images/icons/report_delete.png create mode 100755 images/icons/report_disk.png create mode 100755 images/icons/report_edit.png create mode 100755 images/icons/report_go.png create mode 100755 images/icons/report_key.png create mode 100755 images/icons/report_link.png create mode 100755 images/icons/report_magnify.png create mode 100755 images/icons/report_picture.png create mode 100755 images/icons/report_user.png create mode 100755 images/icons/report_word.png create mode 100755 images/icons/resultset_first.png create mode 100755 images/icons/resultset_last.png create mode 100755 images/icons/resultset_next.png create mode 100755 images/icons/resultset_previous.png create mode 100755 images/icons/rosette.png create mode 100755 images/icons/rss.png create mode 100755 images/icons/rss_add.png create mode 100755 images/icons/rss_delete.png create mode 100755 images/icons/rss_go.png create mode 100755 images/icons/rss_valid.png create mode 100755 images/icons/ruby.png create mode 100755 images/icons/ruby_add.png create mode 100755 images/icons/ruby_delete.png create mode 100755 images/icons/ruby_gear.png create mode 100755 images/icons/ruby_get.png create mode 100755 images/icons/ruby_go.png create mode 100755 images/icons/ruby_key.png create mode 100755 images/icons/ruby_link.png create mode 100755 images/icons/ruby_put.png create mode 100755 images/icons/script.png create mode 100755 images/icons/script_add.png create mode 100755 images/icons/script_code.png create mode 100755 images/icons/script_code_red.png create mode 100755 images/icons/script_delete.png create mode 100755 images/icons/script_edit.png create mode 100755 images/icons/script_error.png create mode 100755 images/icons/script_gear.png create mode 100755 images/icons/script_go.png create mode 100755 images/icons/script_key.png create mode 100755 images/icons/script_lightning.png create mode 100755 images/icons/script_link.png create mode 100755 images/icons/script_palette.png create mode 100755 images/icons/script_save.png create mode 100755 images/icons/server.png create mode 100755 images/icons/server_add.png create mode 100755 images/icons/server_chart.png create mode 100755 images/icons/server_compressed.png create mode 100755 images/icons/server_connect.png create mode 100755 images/icons/server_database.png create mode 100755 images/icons/server_delete.png create mode 100755 images/icons/server_edit.png create mode 100755 images/icons/server_error.png create mode 100755 images/icons/server_go.png create mode 100755 images/icons/server_key.png create mode 100755 images/icons/server_lightning.png create mode 100755 images/icons/server_link.png create mode 100755 images/icons/server_uncompressed.png create mode 100755 images/icons/shading.png create mode 100755 images/icons/shape_align_bottom.png create mode 100755 images/icons/shape_align_center.png create mode 100755 images/icons/shape_align_left.png create mode 100755 images/icons/shape_align_middle.png create mode 100755 images/icons/shape_align_right.png create mode 100755 images/icons/shape_align_top.png create mode 100755 images/icons/shape_flip_horizontal.png create mode 100755 images/icons/shape_flip_vertical.png create mode 100755 images/icons/shape_group.png create mode 100755 images/icons/shape_handles.png create mode 100755 images/icons/shape_move_back.png create mode 100755 images/icons/shape_move_backwards.png create mode 100755 images/icons/shape_move_forwards.png create mode 100755 images/icons/shape_move_front.png create mode 100755 images/icons/shape_rotate_anticlockwise.png create mode 100755 images/icons/shape_rotate_clockwise.png create mode 100755 images/icons/shape_square.png create mode 100755 images/icons/shape_square_add.png create mode 100755 images/icons/shape_square_delete.png create mode 100755 images/icons/shape_square_edit.png create mode 100755 images/icons/shape_square_error.png create mode 100755 images/icons/shape_square_go.png create mode 100755 images/icons/shape_square_key.png create mode 100755 images/icons/shape_square_link.png create mode 100755 images/icons/shape_ungroup.png create mode 100755 images/icons/shield.png create mode 100755 images/icons/shield_add.png create mode 100755 images/icons/shield_delete.png create mode 100755 images/icons/shield_go.png create mode 100755 images/icons/sitemap.png create mode 100755 images/icons/sitemap_color.png create mode 100755 images/icons/sound.png create mode 100755 images/icons/sound_add.png create mode 100755 images/icons/sound_delete.png create mode 100755 images/icons/sound_low.png create mode 100755 images/icons/sound_mute.png create mode 100755 images/icons/sound_none.png create mode 100755 images/icons/spellcheck.png create mode 100755 images/icons/sport_8ball.png create mode 100755 images/icons/sport_basketball.png create mode 100755 images/icons/sport_football.png create mode 100755 images/icons/sport_golf.png create mode 100755 images/icons/sport_raquet.png create mode 100755 images/icons/sport_shuttlecock.png create mode 100755 images/icons/sport_soccer.png create mode 100755 images/icons/sport_tennis.png create mode 100755 images/icons/star.png create mode 100755 images/icons/status_away.png create mode 100755 images/icons/status_busy.png create mode 100755 images/icons/status_offline.png create mode 100755 images/icons/status_online.png create mode 100755 images/icons/stop.png create mode 100755 images/icons/style.png create mode 100755 images/icons/style_add.png create mode 100755 images/icons/style_delete.png create mode 100755 images/icons/style_edit.png create mode 100755 images/icons/style_go.png create mode 100755 images/icons/sum.png create mode 100755 images/icons/tab.png create mode 100755 images/icons/tab_add.png create mode 100755 images/icons/tab_delete.png create mode 100755 images/icons/tab_edit.png create mode 100755 images/icons/tab_go.png create mode 100755 images/icons/table.png create mode 100755 images/icons/table_add.png create mode 100755 images/icons/table_delete.png create mode 100755 images/icons/table_edit.png create mode 100755 images/icons/table_error.png create mode 100755 images/icons/table_gear.png create mode 100755 images/icons/table_go.png create mode 100755 images/icons/table_key.png create mode 100755 images/icons/table_lightning.png create mode 100755 images/icons/table_link.png create mode 100755 images/icons/table_multiple.png create mode 100755 images/icons/table_refresh.png create mode 100755 images/icons/table_relationship.png create mode 100755 images/icons/table_row_delete.png create mode 100755 images/icons/table_row_insert.png create mode 100755 images/icons/table_save.png create mode 100755 images/icons/table_sort.png create mode 100755 images/icons/tag.png create mode 100755 images/icons/tag_blue.png create mode 100755 images/icons/tag_blue_add.png create mode 100755 images/icons/tag_blue_delete.png create mode 100755 images/icons/tag_blue_edit.png create mode 100755 images/icons/tag_green.png create mode 100755 images/icons/tag_orange.png create mode 100755 images/icons/tag_pink.png create mode 100755 images/icons/tag_purple.png create mode 100755 images/icons/tag_red.png create mode 100755 images/icons/tag_yellow.png create mode 100755 images/icons/telephone.png create mode 100755 images/icons/telephone_add.png create mode 100755 images/icons/telephone_delete.png create mode 100755 images/icons/telephone_edit.png create mode 100755 images/icons/telephone_error.png create mode 100755 images/icons/telephone_go.png create mode 100755 images/icons/telephone_key.png create mode 100755 images/icons/telephone_link.png create mode 100755 images/icons/television.png create mode 100755 images/icons/television_add.png create mode 100755 images/icons/television_delete.png create mode 100755 images/icons/text_align_center.png create mode 100755 images/icons/text_align_justify.png create mode 100755 images/icons/text_align_left.png create mode 100755 images/icons/text_align_right.png create mode 100755 images/icons/text_allcaps.png create mode 100755 images/icons/text_bold.png create mode 100755 images/icons/text_columns.png create mode 100755 images/icons/text_dropcaps.png create mode 100755 images/icons/text_heading_1.png create mode 100755 images/icons/text_heading_2.png create mode 100755 images/icons/text_heading_3.png create mode 100755 images/icons/text_heading_4.png create mode 100755 images/icons/text_heading_5.png create mode 100755 images/icons/text_heading_6.png create mode 100755 images/icons/text_horizontalrule.png create mode 100755 images/icons/text_indent.png create mode 100755 images/icons/text_indent_remove.png create mode 100755 images/icons/text_italic.png create mode 100755 images/icons/text_kerning.png create mode 100755 images/icons/text_letter_omega.png create mode 100755 images/icons/text_letterspacing.png create mode 100755 images/icons/text_linespacing.png create mode 100755 images/icons/text_list_bullets.png create mode 100755 images/icons/text_list_numbers.png create mode 100755 images/icons/text_lowercase.png create mode 100755 images/icons/text_padding_bottom.png create mode 100755 images/icons/text_padding_left.png create mode 100755 images/icons/text_padding_right.png create mode 100755 images/icons/text_padding_top.png create mode 100755 images/icons/text_replace.png create mode 100755 images/icons/text_signature.png create mode 100755 images/icons/text_smallcaps.png create mode 100755 images/icons/text_strikethrough.png create mode 100755 images/icons/text_subscript.png create mode 100755 images/icons/text_superscript.png create mode 100755 images/icons/text_underline.png create mode 100755 images/icons/text_uppercase.png create mode 100755 images/icons/textfield.png create mode 100755 images/icons/textfield_add.png create mode 100755 images/icons/textfield_delete.png create mode 100755 images/icons/textfield_key.png create mode 100755 images/icons/textfield_rename.png create mode 100755 images/icons/thumb_down.png create mode 100755 images/icons/thumb_up.png create mode 100755 images/icons/tick.png create mode 100755 images/icons/time.png create mode 100755 images/icons/time_add.png create mode 100755 images/icons/time_delete.png create mode 100755 images/icons/time_go.png create mode 100755 images/icons/timeline_marker.png create mode 100755 images/icons/transmit.png create mode 100755 images/icons/transmit_add.png create mode 100755 images/icons/transmit_blue.png create mode 100755 images/icons/transmit_delete.png create mode 100755 images/icons/transmit_edit.png create mode 100755 images/icons/transmit_error.png create mode 100755 images/icons/transmit_go.png create mode 100755 images/icons/tux.png create mode 100755 images/icons/user.png create mode 100755 images/icons/user_add.png create mode 100755 images/icons/user_comment.png create mode 100755 images/icons/user_delete.png create mode 100755 images/icons/user_edit.png create mode 100755 images/icons/user_female.png create mode 100755 images/icons/user_go.png create mode 100755 images/icons/user_gray.png create mode 100755 images/icons/user_green.png create mode 100755 images/icons/user_orange.png create mode 100755 images/icons/user_red.png create mode 100755 images/icons/user_suit.png create mode 100755 images/icons/vcard.png create mode 100755 images/icons/vcard_add.png create mode 100755 images/icons/vcard_delete.png create mode 100755 images/icons/vcard_edit.png create mode 100755 images/icons/vector.png create mode 100755 images/icons/vector_add.png create mode 100755 images/icons/vector_delete.png create mode 100755 images/icons/wand.png create mode 100755 images/icons/weather_clouds.png create mode 100755 images/icons/weather_cloudy.png create mode 100755 images/icons/weather_lightning.png create mode 100755 images/icons/weather_rain.png create mode 100755 images/icons/weather_snow.png create mode 100755 images/icons/weather_sun.png create mode 100755 images/icons/webcam.png create mode 100755 images/icons/webcam_add.png create mode 100755 images/icons/webcam_delete.png create mode 100755 images/icons/webcam_error.png create mode 100755 images/icons/world.png create mode 100755 images/icons/world_add.png create mode 100755 images/icons/world_delete.png create mode 100755 images/icons/world_edit.png create mode 100755 images/icons/world_go.png create mode 100755 images/icons/world_link.png create mode 100755 images/icons/wrench.png create mode 100755 images/icons/wrench_orange.png create mode 100755 images/icons/xhtml.png create mode 100755 images/icons/xhtml_add.png create mode 100755 images/icons/xhtml_delete.png create mode 100755 images/icons/xhtml_go.png create mode 100755 images/icons/xhtml_valid.png create mode 100755 images/icons/zoom.png create mode 100755 images/icons/zoom_in.png create mode 100755 images/icons/zoom_out.png create mode 100755 images/info.gif create mode 100755 images/lilac.gif create mode 100755 images/lilac_configurator.gif create mode 100755 images/lilac_small.gif create mode 100755 images/lilac_small_white.gif.png create mode 100755 images/lilacs.gif create mode 100755 images/line.gif create mode 100755 images/linebottom.gif create mode 100755 images/logo.gif create mode 100755 images/mail.gif create mode 100755 images/minus.gif create mode 100755 images/minusbottom.gif create mode 100755 images/minustop.gif create mode 100755 images/nagios.gif create mode 100755 images/navspacer.gif create mode 100755 images/notification.gif create mode 100755 images/plus.gif create mode 100755 images/plusbottom.gif create mode 100755 images/plustop.gif create mode 100755 images/roundedcorner_error_bl.png create mode 100755 images/roundedcorner_error_br.png create mode 100755 images/roundedcorner_error_tl.png create mode 100755 images/roundedcorner_error_tr.png create mode 100755 images/roundedcorner_inner_bl.png create mode 100755 images/roundedcorner_inner_br.png create mode 100755 images/roundedcorner_inner_tl.png create mode 100755 images/roundedcorner_inner_tr.png create mode 100755 images/roundedcorner_lilac_bl.png create mode 100755 images/roundedcorner_lilac_br.png create mode 100755 images/roundedcorner_lilac_tl.png create mode 100755 images/roundedcorner_lilac_tr.png create mode 100755 images/roundedcorner_success_bl.png create mode 100755 images/roundedcorner_success_br.png create mode 100755 images/roundedcorner_success_tl.png create mode 100755 images/roundedcorner_success_tr.png create mode 100755 images/roundedcorner_warning_bl.png create mode 100755 images/roundedcorner_warning_br.png create mode 100755 images/roundedcorner_warning_tl.png create mode 100755 images/roundedcorner_warning_tr.png create mode 100755 images/searchback.gif create mode 100755 images/server.gif create mode 100755 images/servergroup.gif create mode 100755 images/services.gif create mode 100755 images/tree-server.gif create mode 100755 import.php create mode 100755 importer/classes.inc.php create mode 100755 importer/engines/fruity/FruityImportEngine.php create mode 100755 importer/engines/nagios/NagiosImportEngine.php create mode 100755 importer/import.php create mode 100755 importer/importers/fruity/FruityCgiImporter.php create mode 100755 importer/importers/fruity/FruityCommandImporter.php create mode 100755 importer/importers/fruity/FruityContactImporter.php create mode 100755 importer/importers/fruity/FruityDependencyImporter.php create mode 100755 importer/importers/fruity/FruityEscalationImporter.php create mode 100755 importer/importers/fruity/FruityHostGroupImporter.php create mode 100755 importer/importers/fruity/FruityHostImporter.php create mode 100755 importer/importers/fruity/FruityHostTemplateImporter.php create mode 100755 importer/importers/fruity/FruityMainImporter.php create mode 100755 importer/importers/fruity/FruityResourceImporter.php create mode 100755 importer/importers/fruity/FruityServiceGroupImporter.php create mode 100755 importer/importers/fruity/FruityServiceImporter.php create mode 100755 importer/importers/fruity/FruityServiceTemplateImporter.php create mode 100755 importer/importers/fruity/FruityTimeperiodImporter.php create mode 100755 importer/importers/nagios/NagiosCgiImporter.php create mode 100755 importer/importers/nagios/NagiosCommandImporter.php create mode 100755 importer/importers/nagios/NagiosContactGroupImporter.php create mode 100755 importer/importers/nagios/NagiosContactImporter.php create mode 100755 importer/importers/nagios/NagiosHostDependencyImporter.php create mode 100755 importer/importers/nagios/NagiosHostEscalationImporter.php create mode 100755 importer/importers/nagios/NagiosHostExtInfoImporter.php create mode 100755 importer/importers/nagios/NagiosHostGroupImporter.php create mode 100755 importer/importers/nagios/NagiosHostImporter.php create mode 100755 importer/importers/nagios/NagiosMainImporter.php create mode 100755 importer/importers/nagios/NagiosResourceImporter.php create mode 100755 importer/importers/nagios/NagiosServiceDependencyImporter.php create mode 100755 importer/importers/nagios/NagiosServiceEscalationImporter.php create mode 100755 importer/importers/nagios/NagiosServiceExtInfoImporter.php create mode 100755 importer/importers/nagios/NagiosServiceGroupImporter.php create mode 100755 importer/importers/nagios/NagiosServiceImporter.php create mode 100755 importer/importers/nagios/NagiosTimeperiodImporter.php create mode 100755 includes/config.inc create mode 100755 includes/init.inc.php create mode 100755 includes/lilac-classmap.php create mode 100755 includes/lilac-conf.php create mode 100755 includes/lilac-conf.php.dist create mode 100755 includes/lilac.inc create mode 100755 includes/output.php create mode 100755 index.php create mode 100755 install.php create mode 100755 js/flexigrid.js create mode 100755 js/jquery-1.2.6.min.js create mode 100755 js/jquery.autocomplete.js create mode 100755 js/jquery.timers-1.0.0.js create mode 100755 js/jquery.tooltip.min.js create mode 100755 library/Log.php create mode 100755 library/Log/composite.php create mode 100755 library/Log/console.php create mode 100755 library/Log/daemon.php create mode 100755 library/Log/display.php create mode 100755 library/Log/error_log.php create mode 100755 library/Log/file.php create mode 100755 library/Log/firebug.php create mode 100755 library/Log/mail.php create mode 100755 library/Log/mcal.php create mode 100755 library/Log/mdb2.php create mode 100755 library/Log/null.php create mode 100755 library/Log/observer.php create mode 100755 library/Log/sql.php create mode 100755 library/Log/sqlite.php create mode 100755 library/Log/syslog.php create mode 100755 library/Log/win.php create mode 100755 library/Net/Traceroute.php create mode 100755 library/propel/Propel.php create mode 100755 library/propel/PropelException.php create mode 100755 library/propel/adapter/DBAdapter.php create mode 100755 library/propel/adapter/DBMSSQL.php create mode 100755 library/propel/adapter/DBMySQL.php create mode 100755 library/propel/adapter/DBNone.php create mode 100755 library/propel/adapter/DBOracle.php create mode 100755 library/propel/adapter/DBPostgres.php create mode 100755 library/propel/adapter/DBSQLite.php create mode 100755 library/propel/logger/BasicLogger.php create mode 100755 library/propel/logger/MojaviLogAdapter.php create mode 100755 library/propel/map/ColumnMap.php create mode 100755 library/propel/map/DatabaseMap.php create mode 100755 library/propel/map/MapBuilder.php create mode 100755 library/propel/map/TableMap.php create mode 100755 library/propel/map/ValidatorMap.php create mode 100755 library/propel/om/BaseObject.php create mode 100755 library/propel/om/NestedSetRecursiveIterator.php create mode 100755 library/propel/om/NodeObject.php create mode 100755 library/propel/om/Persistent.php create mode 100755 library/propel/om/PreOrderNodeIterator.php create mode 100755 library/propel/util/BasePeer.php create mode 100755 library/propel/util/Criteria.php create mode 100755 library/propel/util/DebugPDO.php create mode 100755 library/propel/util/DebugPDOStatement.php create mode 100755 library/propel/util/NodePeer.php create mode 100755 library/propel/util/PropelColumnTypes.php create mode 100755 library/propel/util/PropelConfiguration.php create mode 100755 library/propel/util/PropelConfigurationIterator.php create mode 100755 library/propel/util/PropelDateTime.php create mode 100755 library/propel/util/PropelPDO.php create mode 100755 library/propel/util/PropelPager.php create mode 100755 library/propel/validator/BasicValidator.php create mode 100755 library/propel/validator/MatchValidator.php create mode 100755 library/propel/validator/MaxLengthValidator.php create mode 100755 library/propel/validator/MaxValueValidator.php create mode 100755 library/propel/validator/MinLengthValidator.php create mode 100755 library/propel/validator/MinValueValidator.php create mode 100755 library/propel/validator/NotMatchValidator.php create mode 100755 library/propel/validator/RequiredValidator.php create mode 100755 library/propel/validator/TypeValidator.php create mode 100755 library/propel/validator/UniqueValidator.php create mode 100755 library/propel/validator/ValidValuesValidator.php create mode 100755 library/propel/validator/ValidationFailed.php create mode 100755 main.php create mode 100755 resources.php create mode 100755 runtime-conf.xml create mode 100755 schema-transformed.xml create mode 100755 schema.xml create mode 100755 search.php create mode 100755 service.php create mode 100755 service_template.php create mode 100755 servicegroups.php create mode 100755 sitedb/sitedb-utility.php create mode 100755 sqldata/lilac-nagios-en-label.sql create mode 100755 sqldata/schema.sql create mode 100755 sqldata/seed.sql create mode 100755 style/flexigrid.css create mode 100755 style/install.css create mode 100755 style/jquery.autocomplete.css create mode 100755 style/jquery.tooltip.css create mode 100755 style/lilac.css create mode 100755 style/reset.css create mode 100755 templates.php create mode 100755 timeperiod.php create mode 100755 timeperiods.php create mode 100755 tools.php diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..4334c25 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +Please refer to www.lilacplatform.com for documentation on installation and bug reporting. diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..4cc2ce4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,281 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/UPGRADING b/UPGRADING new file mode 100755 index 0000000..cd70ac6 --- /dev/null +++ b/UPGRADING @@ -0,0 +1 @@ +Lilac is intended to be installed from scratch. \ No newline at end of file diff --git a/about.php b/about.php new file mode 100755 index 0000000..ad0f42c --- /dev/null +++ b/about.php @@ -0,0 +1,86 @@ + +

+

Lilac Configurator

+Lilac Configurator is part of the Lilac Platform. The community site is available at www.lilacplatform.com. Lilac Configurator is a project developed by Lilac Networks. +

+

+

Services & Support

+Lilac Networks can help support your implementation of Lilac & Nagios. For commercial support of your open source monitoring infrastructure, review our service offerings at www.lilacnetworks.com. For community support for Lilac Configurator, refer to the community site at www.lilacplatform.com. +

+

+

Statistics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Nagios Commands:
Total Nagios Time Periods:
Total Nagios Contacts:
Total Nagios Contact Groups:
Total Nagios Host Groups:
Total Nagios Service Groups:
Total Nagios Host Templates:
Total Nagios Service Templates:
Total Nagios Hosts:
Total Nagios Services:
+ +setNagiosHost($tempSource); + break; + case 'service': + $dependency->setNagiosService($tempSource); + break; + case 'hostgroup': + $dependency->setNagiosHostgroup($tempSource); + break; + } + $dependency->setName($_POST['name']); + $dependency->save(); + header("Location: dependency.php?id= " . $dependency->getId()); + exit(); + } + } +} + + +if($type == "service") { + $textTitle = $tempSource->getOwnerDescription() . " : " . $tempSource->getDescription(); +} +else { + $textTitle = $tempSource->getName(); +} + +print_header("Add Dependency To " . $title . " " . $textTitle); + +print_window_header("Add Dependency To " . $title . " " . $textTitle, "100%"); + ?> + Provide A Name for this Dependency +
+ +
+ +
+
Cancel And Return To +
+ diff --git a/add_escalation.php b/add_escalation.php new file mode 100755 index 0000000..7bdd9fb --- /dev/null +++ b/add_escalation.php @@ -0,0 +1,158 @@ +setHost($tempSource->getId()); + } + if($type == "hostgroup") { + $escalation->setHostgroup($tempSource->getId()); + } + else if($type == "hosttemplate") { + $escalation->setHostTemplate($tempSource->getId()); + } + else if($type == "service") { + $escalation->setService($tempSource->getId()); + } + else if($type == "servicetemplate") { + $escalation->setServiceTemplate($tempSource->getId()); + } + $escalation->setDescription(trim($_POST['escalation_description'])); + $escalation->save(); + header("Location: escalation.php?id=" . $escalation->getId()); + die(); + } +} + +if($type == "service") { + $textTitle = $tempSource->getNagiosHost()->getName() . " : " . $tempSource->getDescription(); +} +else { + $textTitle = $tempSource->getName(); +} + +print_header("Add Escalation To " . $title . " " . $textTitle); + +print_window_header("Add A Escalation", "100%"); + + + +?> +Return To + +
+ +
+
+
+ + + + + Description:
+
+ element_desc("escalation_description", "nagios_escalations_desc"); ?>
+
+ + + + +

+
+ +
+ diff --git a/add_host.php b/add_host.php new file mode 100755 index 0000000..c4e0154 --- /dev/null +++ b/add_host.php @@ -0,0 +1,142 @@ +host_exists($_POST['host_manage']['host_name'])) { + $error = "A host with that name already exists!"; + } + else { + // Field Error Checking + if(count($_POST['host_manage'])) { + foreach($_POST['host_manage'] as $tempVariable) + $tempVariable = trim($tempVariable); + } + if($_POST['host_manage']['host_name'] == '' || $_POST['host_manage']['alias'] == '' || $_POST['host_manage']['address'] == '') { + $error = "Fields shown are required and cannot be left blank."; + } + else { + // All is well for error checking, add the host into the db. + $tempHost = new NagiosHost(); + $tempHost->setName($_POST['host_manage']['host_name']); + $tempHost->setAlias($_POST['host_manage']['alias']); + if(isset($_GET['parent_id'])) { + // Get the host by that parent_id + $host = NagiosHostPeer::retrieveByPk($_GET['parent_id']); + if($host) { + // valid host, add parent + $tempHost->addParentByName($host->getName()); + } + } + $tempHost->setAddress($_POST['host_manage']['address']); + if(isset($_POST['host_manage']['display_name'])) { + $tempHost->setDisplayName($_POST['host_manage']['display_name']); + } + $tempHost->save(); + header("Location: hosts.php?id=" . $tempHost->getId()); + die(); + } + } +} + +$add_template_list[] = array("host_template_id" => '', "template_name" => "None"); +$lilac->get_host_template_list( $template_list); + +if(count($template_list)) { + foreach($template_list as $tempTemplate) { + $add_template_list[] = array('host_template_id' => $tempTemplate->getId(), 'template_name' => $tempTemplate->getName()); + } +} + +print_header("Add New Host"); + + +$title = "Add A Top-Level Host"; +if(isset($_GET['parent_id'])) { + $tempHostInfo = NagiosHostPeer::retrieveByPK($_GET['parent_id']); + if($tempHostInfo) { + $title = "Add A Host Under " . $tempHostInfo->getName(); + } +} + + + +print_window_header($title, "100%"); +?> +
+ + + + + + + + Host Name:
+
+ element_desc("host_name", "nagios_hosts_desc"); ?>
+
+ + + + + Host Description:
+
+ element_desc("alias", "nagios_hosts_desc"); ?>
+
+ + + + + Address:
+
+ element_desc("address", "nagios_hosts_desc"); ?>
+
+ + + + + Display Name (Optional):
+
+ element_desc("display_name", "nagios_hosts_desc"); ?>
+
+ + + + [ Cancel ] +

+
+ + +
+ diff --git a/add_host_template.php b/add_host_template.php new file mode 100755 index 0000000..8b8b388 --- /dev/null +++ b/add_host_template.php @@ -0,0 +1,87 @@ +host_template_exists($_POST['template_name'])) { + $error = "A host template with that name already exists!"; + } + else { + // Field Error Checking + if($_POST['template_name'] == '' || $_POST['template_description'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + $template = new NagiosHostTemplate(); + $template->setName($_POST['template_name']); + $template->setDescription($_POST['template_description']); + $template->save(); + header("Location: host_template.php?id=" . $template->getId()); + die(); + } + } + } +} + +print_header("Host Template Editor"); + +print_window_header("Add Host Template", "100%"); +?> +
+ + + + + Template Name:
+
+ element_desc("template_name", "nagios_hosts_desc"); ?>
+
+ + + + + Template Description:
+
+ element_desc("template_description", "nagios_hosts_desc"); ?>
+
+ + + + [ Cancel ] +

+
+ +
+ diff --git a/add_service.php b/add_service.php new file mode 100755 index 0000000..36bb902 --- /dev/null +++ b/add_service.php @@ -0,0 +1,185 @@ +getName(); + $sublink = "?host_template_id=" . $hostTemplate->getId(); + $cancelLink = "host_template.php?id=" . $hostTemplate->getId() . "§ion=services"; + } +} +else if(isset($_GET['host_id'])) { + $host = NagiosHostPeer::retrieveByPK($_GET['host_id']); + if(!$host) { + header("Location: welcome.php"); + die(); + } + else { + $title = " for Host " . $host->getName(); + $sublink = "?host_id=" . $host->getId(); + $cancelLink = "hosts.php?id=" . $host->getId() . "§ion=services"; + } +} +else if(isset($_GET['hostgroup_id'])) { + $hostgroup = NagiosHostgroupPeer::retrieveByPK($_GET['hostgroup_id']); + if(!$hostgroup) { + header("Location: welcome.php"); + die(); + } + else { + $title = " for Hostgroup " . $hostgroup->getName(); + $sublink = "?hostgroup_id=" . $hostgroup->getId(); + $cancelLink = "hostgroups.php?id=" . $hostgroup->getId() . "§ion=services"; + } +} + +else { + header("Location: welcome.php"); + die(); +} + +if(isset($_POST['request'])) { + if($_POST['request'] == 'add_service') { + if(isset($hostTemplate)) { + // Template logic + $c = new Criteria(); + $c->add(NagiosServicePeer::DESCRIPTION, $_POST['service_description']); + $c->add(NagiosServicePeer::HOST_TEMPLATE, $hostTemplate->getId()); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if($service) { + $error = "A service with that description already exists for that host template."; + } + else { + // Let's add. + $service = new NagiosService(); + $service->setDescription($_POST['service_description']); + $service->setDisplayName($_POST['display_name']); + $service->setHostTemplate($hostTemplate->getId()); + $service->save(); + header("Location: service.php?id=" . $service->getId()); + die(); + + } + } + else if(isset($host)) { + // Host logic + $c = new Criteria(); + $c->add(NagiosServicePeer::DESCRIPTION, $_POST['service_description']); + $c->add(NagiosServicePeer::HOST, $host->getId()); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if($service) { + $error = "A service with that description already exists for that host."; + } + else { + // Let's add. + $service = new NagiosService(); + $service->setDescription($_POST['service_description']); + $service->setDisplayName($_POST['display_name']); + $service->setHost($host->getId()); + $service->save(); + header("Location: service.php?id=" . $service->getId()); + die(); + } + } + else if(isset($hostgroup)) { + // Host logic + $c = new Criteria(); + $c->add(NagiosServicePeer::DESCRIPTION, $_POST['service_description']); + $c->add(NagiosServicePeer::HOSTGROUP, $hostgroup->getId()); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if($service) { + $error = "A service with that description already exists for that hostgroup."; + } + else { + // Let's add. + $service = new NagiosService(); + $service->setDescription($_POST['service_description']); + $service->setDisplayName($_POST['display_name']); + $service->setHostgroup($hostgroup->getId()); + $service->save(); + header("Location: service.php?id=" . $service->getId()); + die(); + } + } + + + } +} + +print_header("Service Editor"); + +// Get list of service templates +$lilac->get_service_template_list($tempList); +$template_list[] = array("service_template_id" => '', "template_name" => "None"); +foreach($tempList as $tempTemplate) + $template_list[] = array('service_template_id' => $tempTemplate->getId(), 'template_name' => $tempTemplate->getName()); + + + + +print_window_header("Add Service " . $title, "100%"); +?> +
+ + + + + Service Description:
+
+ element_desc("service_description", "nagios_services_desc"); ?>
+
+ + + + + Display Name: (Optional)
+
+ element_desc("display_name", "nagios_services_desc"); ?>
+
+ + + + [ Cancel ] +

+
+ +
+ diff --git a/add_service_template.php b/add_service_template.php new file mode 100755 index 0000000..ab11979 --- /dev/null +++ b/add_service_template.php @@ -0,0 +1,86 @@ +service_template_exists($_POST['template_name'])) { + $error = "A service template with that name already exists!"; + } + else { + // Field Error Checking + if($_POST['template_name'] == '' || $_POST['template_description'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + $template = new NagiosServiceTemplate(); + $template->setName($_POST['template_name']); + $template->setDescription($_POST['template_description']); + $template->save(); + header("Location: service_template.php?id=" . $template->getId()); + } + } + } +} + +print_header("Service Template Editor"); + +print_window_header("Add Service Template", "100%"); +?> +
+ + + + + Template Name:
+
+ element_desc("template_name", "nagios_services_desc"); ?>
+
+ + + + + Template Description:
+
+ element_desc("template_description", "nagios_services_desc"); ?>
+
+ + + + [ Cancel ] +

+
+ +
+ diff --git a/autodiscovery.php b/autodiscovery.php new file mode 100755 index 0000000..7935542 --- /dev/null +++ b/autodiscovery.php @@ -0,0 +1,863 @@ +setStatusCode(AutodiscoveryJob::STATUS_STARTING); + $autodiscoveryJob->save(); + exec("php autodiscovery/autodiscover.php " . $autodiscoveryJob->getId() . " > /dev/null", $tempOutput, $retVal); + if($retVal != 42) { + $error = "Failed to run external autodiscovery script. Return value: " . $retVal . "
Error:"; + foreach($tempOutput as $output) { + $error .= $output . "
"; + } + } + else { + // No need to show + //$success = "Restarted AutoDiscovery Job"; + } + } + if(isset($_GET['delete'])) { + // We want to delete the job! + $autodiscoveryJob->delete(); + unset($_GET['id']); + unset($autodiscoveryJob); + $success = "Removed Job and associated devices."; + } +} + + +if(isset($_GET['deviceId'])) { + // We want to review a specific device + $device = AutodiscoveryDevicePeer::retrieveByPK($_GET['deviceId']); + if(!$device) { + header("Location: autodiscovery.php"); + exit(); + } + + + if(isset($_GET['request']) && $_GET['request'] == 'recalc') { + // We want to recalculate template matches + $config = unserialize($autodiscoveryJob->getConfig()); + $defaultTemplateId = $config->getVar("default_template"); + if(!empty($defaultTemplateId)) { + $defaultTemplate = NagiosHostTemplatePeer::retrieveByPK($defaultTemplateId); + } + if(empty($defaultTemplate)) { + $defaultTemplate = null; + } + AutodiscoveryMatchMaker::match($device, $defaultTemplate); + $success = "Recalculated Matching Templates."; + } +} + +if(isset($_GET['request']) && $_GET['request'] == 'status') { + // We're our AJAX client wanting status information + $result = array(); + $autodiscoveryJob = AutodiscoveryJobPeer::retrieveByPK($_GET['id']); + if(!$autodiscoveryJob) { + $result['error'] = "Invalid job specified."; + print(json_encode($result)); + exit(); + } + // Okay, let's populate the status + $result['start_time'] = $autodiscoveryJob->getStartTime(); + $result['status_code'] = $autodiscoveryJob->getStatusCode(); + $result['status_text'] = $autodiscoveryJob->getStatus(); + $result['status_change_time'] = $autodiscoveryJob->getStatusChangeTime(); + + // Build elapsed time + if(!in_array($autodiscoveryJob->getStatusCode(), array(AutoDiscoveryJob::STATUS_FAILED, AutoDiscoveryJob::STATUS_FINISHED))) { + $target = time(); + } + else { + $target = strtotime($result['status_change_time']); + } + $start = strtotime($result['start_time']); + $total = $target - $start; + $hours = (int)($total / 3600); + $total = $total % 3600; + $minutes = (int)($total / 60); + $seconds = $total % 60; + + $result['elapsed_time'] = $hours . " Hours " . $minutes . " Minutes " . $seconds . " Seconds"; + + print(json_encode($result)); + exit(); +} + + +if(isset($_GET['request']) && $_GET['request'] == 'fetch') { + // We're our AJAX client wanting to get new log data + $result = array(); + $c = new Criteria(); + $c->add(AutodiscoveryLogEntryPeer::JOB, $_GET['id']); + $c->setLimit($_POST['rp']); + $c->setOffset(isset($_POST['page']) ? ($_POST['page'] - 1) * $_POST['rp'] : 0); + $c->addDescendingOrderByColumn(AutodiscoveryLogEntryPeer::ID); + $entries = $autodiscoveryJob->getAutodiscoveryLogEntrys($c); + foreach($entries as $entry) { + $results['rows'][] = array('id' => $entry->getId(), 'cell' => array( $entry->getTime(), + $entry->getReadableType($entry->getType()), + $entry->getText())); + } + $c = new Criteria(); + $c->add(AutodiscoveryLogEntryPeer::JOB, $autodiscoveryJob->getId()); + $results['page'] = $_POST['page']; + $results['total'] = AutodiscoveryLogEntryPeer::doCount($c); + ?> + + setVar("targets", $_POST['target']); + $config->setVar("nmap_binary", $_POST['nmap_binary']); + $config->setVar("traceroute_enabled", (empty($_POST['traceroute_enabled'])) ? true : true); + $config->setVar("default_template", $_POST['default_template']); + + $autodiscoveryJob = new AutodiscoveryJob(); + $autodiscoveryJob->setName($_POST['job_name']); + $autodiscoveryJob->setDescription($_POST['job_description']); + $autodiscoveryJob->setCmd(AutodiscoveryJob::CMD_START); + $autodiscoveryJob->setConfig(serialize($config)); + $autodiscoveryJob->setStatus("Starting..."); + $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_STARTING); + $autodiscoveryJob->save(); + + // Attempt to execute the external auto-discovery script, fork it, and love it. + exec("php autodiscovery/autodiscover.php " . $autodiscoveryJob->getId() . " > /dev/null", $tempOutput, $retVal); + if($retVal != 42) { + $status_msg = "Failed to run external Autodiscovery script. Return value: " . $retVal . "
Error:"; + foreach($tempOutput as $output) { + $status_msg .= $output . "
"; + } + } + } + } + } + else if($_POST['request'] == "updateGeneral") { + if(trim($_POST['name']) != '' && trim($_POST['description']) != '') { + // Check to see first if a host or auto discovery device has that potential name + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, trim($_POST['name'])); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) { + // Try a autodiscovery device? + $c = new Criteria(); + $c->add(AutodiscoveryDevicePeer::NAME, trim($_POST['name'])); + $c->setIgnoreCase(true); + $host = AutodiscoveryDevicePeer::doSelectOne($c); + } + if($host) { + $error = "A host already exists with that name. Must choose a unique name."; + } + else { + // Assign name and description + $device->setName(trim($_POST['name'])); + $device->setDescription(trim($_POST['description'])); + $device->save(); + $success = "Updated discovered device's information."; + } + } + else { + $error = "Name and Description cannot be blank."; + } + } + else if($_POST['request'] == "assignTemplate") { + $hostTemplate = NagiosHostTemplatePeer::retrieveByPK($_POST['template']); + if(!$hostTemplate) { + $error = "That template no longer exists."; + } + else { + $device->setNagiosHostTemplate($hostTemplate); + $device->save(); + $success = "Template assigned."; + } + } + else { + // We want to process our device list! + // First we check to see if there's any hosts now with the same name + foreach($_POST['selectedDevices'] as $deviceId) { + $device = AutodiscoveryDevicePeer::retrieveByPK($deviceId); + if(!$device) { + $error = "One of the devices provided no longer exists."; + continue; + } + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $device->getName()); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) { + $c = new Criteria(); + $c->add(AutodiscoveryDevicePeer::NAME, $device->getName()); + $c->setIgnoreCase(true); + $host = AutodiscoveryDevicePeer::doSelectOne($c); + if($host->getId() == $device->getId()) { + unset($host); + } + } + if(!empty($host)) { + $error = "A host already exists with the name of " . $device->getName() . ". Change the device's name before importing."; + } + } + if(empty($error)) { + $totalSuccess = 0; + // Okay, no errors, let's create our hosts! + foreach($_POST['selectedDevices'] as $deviceId) { + $device = AutodiscoveryDevicePeer::retrieveByPK($deviceId); + $tempHost = new NagiosHost(); + $tempHost->setAddress($device->getAddress()); + $tempHost->setName($device->getName()); + $tempHost->setAlias($device->getDescription()); + $tempHost->save(); + // Now assign a template, if wanted + $template = $device->getNagiosHostTemplate(); + if(!empty($template)) { + $inheritance = new NagiosHostTemplateInheritance(); + $inheritance->setNagiosHost($tempHost); + $inheritance->setNagiosHostTemplateRelatedByTargetTemplate($template); + $inheritance->save(); + } + // Now parent + $parent = $device->getNagiosHost(); + if(!empty($parent)) { + $parentRelationship = new NagiosHostParent(); + $parentRelationship->setNagiosHostRelatedByChildHost($tempHost); + $parentRelationship->setNagiosHostRelatedByParentHost($parent); + $parentRelationship->save(); + } + $totalSuccess++; + $device->delete(); + } + $success = $totalSuccess . " Device(s) Imported."; + } + } +} + + +print_header("AutoDiscovery"); + +if(isset($autodiscoveryJob)) { + ?> + + + + + +add(AutodiscoveryJobPeer::END_TIME, null); + $autodiscoveryJobs = autodiscoveryJobPeer::doSelect($c); + if($autodiscoveryJobs) { + print_window_header("Jobs In Progress", "100%"); + ?> + There appears to be running autodiscovery jobs. There should only be one running. If there are multiple showing as running, you should cancel them or purge them. Click on a job to + view it's progress and it's log. + + + + + + + + + + + + + + + + + + +
NameDescriptionStart TimeStatusActions
getName();?>getDescription();?>getStartTime();?>getStatus();?>View JobRestart
+ + To begin an auto-discovery of your configuration, an Auto Discovery Job must be defined. Configure your auto discovery job below. Once created, your auto discovery + job will begin in the background. You will be able to check on the status of your job and view it's log as it continues running. You are advised to NOT edit anything + in Lilac while your job is running. +
+
+ +

+

+ Job Definition + + + + +
+

+

+

+ Discovery Options +

+ + +

+

+ Enable Traceroute to Determine Parent Host
+

+

+ + 'None', + 'value' => '' + ); + foreach($templates as $template) { + $options[] = array( + 'option' => $template->getName(), + 'value' => $template->getId() + ); + } + print_select("default_template", $options, "value" , "option", ''); + ?> +

+
+

+

+

+ Target Specification +

+ + + + +
+ Add Target +
+ Provide an IP address or range of ip addresses in NMAP-accepted style. See Target Specification for examples. +

+
+

+ + + getStats(); + if($stats) { + $stats = unserialize($stats); + } + + print_window_header("Job Details", "100%"); + ?> + Job Name: getName();?>
+ getDescription();?> +
+
+ Start Time: getStartTime();?>
+
+ getStatusCode(), array(AutodiscoveryJob::STATUS_FAILED, AutodiscoveryJob::STATUS_FINISHED) )) { + ?> + Elapsed Time: Unknown + getStatusCode() == AutodiscoveryJob::STATUS_FAILED) { + ?> + Time of Failure: getStatusChangeTime();?> + + Time When Completed: getStatusChangeTime();?> + +
+ Current Status: getStatus();?>
+ getConfig()); + ?> + getStatusCode() != AutodiscoveryJob::STATUS_FINISHED ) { ?>style="display: none;"> +
+
+
+ Auto-Discovery Complete. Click to Continue To Reviewing Found Devices +
+
+
+ + Restart Job | Remove Job | Return To AutoDiscovery Menu + +
+ +
+ + + Return To Auto-Discovery Job +
+ add(AutodiscoveryDevicePeer::JOB_ID, $autodiscoveryJob->getId()); + $devices = AutodiscoveryDevicePeer::doSelect($c); + if(empty($devices)) { + ?> +
+

No Devices Available For Import

+ +
+

Device(s) Available For Import

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Address + Name + Description + ParentHostname + Template Assigned + + Actions +
+ getAddress();?> + + getName();?> + + getDescription();?> + + getNagiosHost(); + if(empty($parent)) { + ?>Top-LevelgetName()); + } + ?> + + getHostname();?> + + getHostTemplate()) { + ?>None AssignedgetHostTemplate()); + if(!empty($hostTemplate)) { + print($hostTemplate->getName()); + } + else { + print("Template Not Found"); + } + } + ?> + + Modify Details +
+ Check All / Un-Check All With Selected: + +
+ + [ Return To Device List ] +
+
+

General Information

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AddressNameDescriptionParentHostnameOS FamilyOS GenerationOS VendorTemplate Assigned
getAddress(); ?>getName(); ?>getDescription(); ?> + getNagiosHost(); + if(empty($parent)) { + ?>Top-LevelgetName()); + } + ?> + getHostname(); ?>getOsfamily(); ?>getOsgen(); ?>getOsvendor(); ?> getHostTemplate()) { + ?>None AssignedgetHostTemplate()); + if(!empty($hostTemplate)) { + print($hostTemplate->getName()); + } + else { + print("Template Not Found"); + } + } + ?>
+
+

Update General Information

+
+ + Name: Description: + + +
+
+

Change Template Assignment

+
+ + getTemplateMatches(); + $options = array(); + $options[] = array( + 'option' => 'None', + 'value' => '' + ); + $searchArray = array(); + foreach($matchedTemplates as $match) { + $options[] = array( + 'option' => $match->getNagiosHostTemplate()->getName() . " - " . $match->getPercent() . "%", + 'value' => $match->getNagiosHostTemplate()->getId() + ); + $searchArray[] = $match->getNagiosHostTemplate()->getId(); + } + // Add the rest of the templates + $templates = NagiosHostTemplatePeer::doSelect(new Criteria()); + foreach($templates as $template) { + if(!in_array($template->getId(), $searchArray)) { + $options[] = array( + 'option' => $template->getName() . " - n/a", + 'value' => $template->getId() + ); + } + } + print_select("template", $options, "value", "option", $device->getHostTemplate()); + ?> [ Recalculate Template Matches ] +
+
+
+ add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $device->getId()); + $services = AutodiscoveryDeviceServicePeer::doSelect($c); + if(empty($services)) { + ?> +

+

No Services Were Found On This Device

+

+ +

Found Service(s)

+ + + + + + +
> +

getName();?> on port getProtocol();?>/getPort(); ?>

+ Product: getProduct(); ?>
+ Version: getVersion(); ?>
+ Extra Information: getExtraInfo(); ?> +
+ diff --git a/autodiscovery/autodiscover.php b/autodiscovery/autodiscover.php new file mode 100755 index 0000000..a8e6a17 --- /dev/null +++ b/autodiscovery/autodiscover.php @@ -0,0 +1,183 @@ +setStartTime(time()); + $autodiscoveryJob->clearLog(); + $autodiscoveryJob->save(); + + + // Okay, let's get the AutodiscoveryConfig + $config = $autodiscoveryJob->getConfig(); + $config = unserialize($config); + + $engineClass = $config->getEngineClass(); + + if(!class_exists($engineClass) || !is_subclass_of($engineClass, "AutodiscoveryEngine")) { + $autodiscoveryJob->addError("Autodiscovery Engine of type " . $engineClass . " not found."); + exit(30); + } +} +else { + print "No job id provided.\n"; + exit(10); + +} + +$autodiscoveryJob->addNotice("Starting Background Auto Discovery Process for Job: " . $autodiscoveryJob->getName()); +$autodiscoveryJob->setStatus("Running"); +$autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_RUNNING); +$autodiscoveryJob->save(); + +$autodiscoveryJob->addNotice("Removing old devices found in this job."); +$devices = $autodiscoveryJob->getAutodiscoveryDevices(); +foreach($devices as $device) { + $device->delete(); +} + +$defaultTemplateId = $config->getVar("default_template"); +if(!empty($defaultTemplateId)) { + $autodiscoveryJob->addNotice("Fetching Default Template..."); + $defaultTemplate = NagiosHostTemplatePeer::retrieveByPK($defaultTemplateId); + if(!$defaultTemplate) { + $autodiscoveryJob->addNotice("Failed to find default template requested. Will not be able to assign a default template."); + } +} + +$autodiscoveryJob->addNotice("Initializing Auto Discovery Engine: " . $engineClass); + +$engine = new $engineClass($autodiscoveryJob); +if(!$engine->init()) { + $autodiscoveryJob->addError("Engine failed to initialize."); + $importJob->addError("Auto Discovery Engine of type " . $engineClass . " not found."); + $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_FAILED); + $autodiscoveryJob->save(); + exit(40); +} + +if(!$engine->discover()) { + $autodiscoveryJob->addError("Engine autodiscovery process failed to complete successfully."); + $autodiscoveryJob->setStatus("Failed"); + $autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_FAILED); + $autodiscoveryJob->save(); + exit(40); +} +$autodiscoveryJob->addNotice("Engine completed discovering devices"); + +$tracerouteEnabled = $config->getVar("traceroute_enabled"); + +$tracerouteEnabled = false; + +if(!$tracerouteEnabled) { + $autodiscoveryJob->addNotice("Tracerouting skipped. Hosts will be set as top-level."); +} +else { + $autodiscoveryJob->addNotice("Beginning Traceroute for found hosts."); + $c = new Criteria(); + $c->add(AutodiscoveryDevicePeer::JOB_ID, $autodiscoveryJob->getId()); + $devices = AutodiscoveryDevicePeer::doSelect($c); + foreach($devices as $device) { + $autodiscoveryJob->addNotice("Attempting Traceroute to " . $device->getAddress()); + $tr = Net_Traceroute::factory(); + if(!PEAR::isError($tr)) { + $response = $tr->traceroute($device->getAddress()); + $hops = $response->getHops(); + $numOfHops = count($hops); + $found = false; + for($counter = $numOfHops - 1; $counter >= 0; $counter--) { + + // Check the farthest hop first + $c = new Criteria(); + $c1 = $c->getNewCriterion(NagiosHostPeer::ADDRESS, $hops[$counter]['ip']); + $c2 = $c->getNewCriterion(NagiosHostPeer::ADDRESS, $hops[$counter['machine']]); + $c1->addOr($c2); + $c->add($c1); + $host = NagiosHostPeer::doSelectOne($c); + if($host) { + // Found parent + $autodiscoveryJob->addNotice("Found parent: " . $host->getName()); + $device->setProposedParent($host->getId()); + $device->save(); + $found = true; + } + } + if(!$found) { + $autodiscoveryJob->addNotice("Could not find a suitable parent. Setting as a top-level device."); + } + } + else { + $autodiscoveryJob->addNotce("Failed to run Traceroute. Not using it."); + } + } +} + +// Okay, now we start doing the magic. + +$c = new Criteria(); +$c->add(AutodiscoveryDevicePeer::JOB_ID, $autodiscoveryJob->getId()); +$devices = AutodiscoveryDevicePeer::doSelect($c); + +foreach($devices as $device) { + $autodiscoveryJob->addNotice("Performing template matching for device: " . $device->getAddress()); + AutodiscoveryMatchMaker::match($device, $defaultTemplate); +} + +$autodiscoveryJob->addNotice("Completed Auto Discovery."); +$autodiscoveryJob->setStatus("Finished."); +$autodiscoveryJob->setStatusCode(AutodiscoveryJob::STATUS_FINISHED); +$autodiscoveryJob->save(); + +?> diff --git a/autodiscovery/classes.inc.php b/autodiscovery/classes.inc.php new file mode 100755 index 0000000..85408c2 --- /dev/null +++ b/autodiscovery/classes.inc.php @@ -0,0 +1,270 @@ +engine = $engine; + + } + + /** + * Enter description here... + * + * @return AutoDiscoveryEngine + */ + public function getEngine() { + return $this->engine; + } + +} + +abstract class AutoDiscoveryEngine { + // Currently empty, but used to potentially employ rules later on + private $job; + + /** + * Enter description here... + * + * @param ImportJob $importJob + */ + public function __construct($importJob) { + $this->job = $importJob; + + } + + /** + * Enter description here... + * + * @return AutodiscoveryJob + */ + public function getJob() { + return $this->job; + } + + public function getConfig() { + return unserialize($this->job->getConfig()); + } + + public function getStats() { + $stats = $this->job->getStats(); + if(!$stats) { + // Create stats on the fly + $stats = new ImportStats(); + + } + else { + $stats = unserialize($stats); + } + $stats->setJob($this->job); + return $stats; + } + + /** + * Should be used for any startup + * + */ + abstract function init(); + + abstract function discover(); + + +} + +/** + * Currently implemented using a hash map, but we could potentially do more than this? + * + */ +class AutodiscoveryConfig { + private $configVars; + + private $engineClass; + + public function __construct($engine) { + $this->engineClass = $engine; + $this->configVars = array(); + } + + public function getEngineClass() { + return $this->engineClass; + } + + public function setVar($name, $val) { + $this->configVars[$name] = $val; + } + + public function getVar($name) { + if(isset($this->configVars[$name])) + return $this->configVars[$name]; + return null; + } +} + +/** + * Currently implemented using a hash map, but we could potentially do more than this? + * + */ +class AutodiscoveryStats { + private $stats; + private $job; // Won't be serialized since it will be a reference + + public function __construct() { + $this->stats = array(); + } + + public function setJob($importJob) { + $this->job = $importJob; + } + + public function setStat($name, $val) { + $this->stats[$name] = $val; + $this->save(); + } + + public function getStat($name) { + return $this->stats[$name]; + } + + public function save() { + if(isset($job)) { + $job->setStats(serialize($his)); + $this->job->save(); + } + } +} + +final class AutodiscoveryMatchMaker { + + private function __construct() { + // We don't allow instances of this class + } + + public static function match(AutodiscoveryDevice $device, NagiosHostTemplate $defaultTemplate = null) { + + // Delete previous matches + $c = new Criteria(); + $c->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $device->getId()); + AutodiscoveryDeviceTemplateMatchPeer::doDelete($c); + + $templates = NagiosHostTemplatePeer::doSelect(new Criteria()); + $templateMatches = array(); + foreach($templates as $template) { + $templateValues = $template->getValues(); + $complexity = 0; + $match = 0; + $serviceFilters = $template->getNagiosHostTemplateAutodiscoveryServices(); + $inheritedServiceFilters = $template->getInheritedNagiosAutodiscoveryServiceFilters(); + $serviceFilters = array_merge($serviceFilters, $inheritedServiceFilters); + + if(!empty($templateValues['autodiscovery_address_filter']) && $templateValues['autodiscovery_address_filter']['value'] != '') { + $complexity++; + if(preg_match($templateValues['autodiscovery_address_filter']['value'], $device->getAddress())) { + $match++; + } + } + if(!empty($templateValues['autodiscovery_hostname_filter']) && $templateValues['autodiscovery_hostname_filter']['value'] != '') { + $complexity++; + if(preg_match($templateValues['autodiscovery_hostname_filter']['value'], $device->getHostname())) { + $match++; + } + } + if(!empty($templateValues['autodiscovery_os_family_filter']) && $templateValues['autodiscovery_os_family_filter']['value'] != '') { + $complexity++; + if(preg_match($templateValues['autodiscovery_os_family_filter']['value'], $device->getOsfamily())) { + $match++; + } + } + if(!empty($templateValues['autodiscovery_os_generation_filter']) && $templateValues['autodiscovery_os_generation_filter']['value'] != '') { + $complexity++; + if(preg_match($templateValues['autodiscovery_os_generation_filter']['value'], $device->getOsgen())) { + $match++; + } + } + if(!empty($templateValues['autodiscovery_os_vendor_filter']) && $templateValues['autodiscovery_os_vendor_filter']['value'] != '') { + $complexity++; + if(preg_match($templateValues['autodiscovery_os_vendor_filter']['value'], $device->getOsvendor())) { + $match++; + } + } + // Checked bases, let's now check service filters + $complexity += count($serviceFilters); + foreach($serviceFilters as $filter) { + foreach($device->getAutodiscoveryDeviceServices() as $service) { + if($filter->getPort() == $service->getPort() && $filter->getProtocol() == $service->getProtocol()) { + // Okay, we're ALMOST found...let's see if we have any other additional filters. + $tempMatch = true; + if($filter->getName() != '') { + if(!preg_match($filter->getName(), $service->getName())) { + $tempMatch = false; + } + } + if($filter->getProduct() != '') { + if(!preg_match($filter->getProduct(), $service->getProduct())) { + $tempMatch = false; + } + } + if($filter->getVersion() != '') { + if(!preg_match($filter->getVersion(), $service->getVersion())) { + $tempMatch = false; + } + } + if($filter->getExtraInformation() != '') { + if(!preg_match($filter->getExtraInformation(), $service->getExtraInformation())) { + $tempMatch = false; + } + } + if($tempMatch) { + $match++; + } + } + } + } + + // Okay, we got everything, let's determine the percentage. + if($complexity == 0) { + // Blank template, no auto-discovery features used. + $percentage = 0; + continue; + } + else { + $percentage = (int)(((float)$match / (float)$complexity)*100); + } + if($percentage == 0) { + continue; + } + + // Store the template into the array + $templateMatches[$percentage][$complexity][] = $template; + } + + // Okay, let's now create the matches + $percentages = array_keys($templateMatches); + $assigned = false; + for($percentageCounter = 0; $percentageCounter < count($percentages); $percentageCounter++) { + $complexities = array_keys($templateMatches[$percentages[$percentageCounter]]); + $complexities = array_reverse($complexities); + for($complexityCount = 0; $complexityCount < count($complexities); $complexityCount++) { + foreach($templateMatches[$percentages[$percentageCounter]][$complexities[$complexityCount]] as $template) { + $match = new AutodiscoveryDeviceTemplateMatch(); + $match->setAutodiscoveryDevice($device); + $match->setNagiosHostTemplate($template); + $match->setPercent($percentages[$percentageCounter]); + $match->setComplexity($complexities[$complexityCount]); + $match->save(); + // Add the highest match as the template to assign + if(!$assigned) { + $assigned = true; + $device->setNagiosHostTemplate($template); + } + } + } + } + // If Not assigned, assign default template + if(!$assigned && !empty($defaultTemplate)) { + $device->setNagiosHostTemplate($defaultTemplate); + } + $device->save(); + } +} + +?> \ No newline at end of file diff --git a/autodiscovery/engines/nmap/NmapAutoDiscoveryEngine.php b/autodiscovery/engines/nmap/NmapAutoDiscoveryEngine.php new file mode 100755 index 0000000..00e98b0 --- /dev/null +++ b/autodiscovery/engines/nmap/NmapAutoDiscoveryEngine.php @@ -0,0 +1,127 @@ +getJob(); + + $this->xmlFile = "/tmp/" . $job->getId() . "-nmap.xml"; + + $job->addNotice("Removing potential old job files."); + @unlink($xmlFile); + + return true; + } + + public function discover() { + $job = $this->getJob(); + $job->addNotice("Starting discovery..."); + + $config = unserialize($job->getConfig()); + + $targets = $config->getVar("targets"); + + // Each target is valid + + // We have a list of targets + $nmap_flags = "--max-rtt-timeout 100 --max-retries 0 -sS -O -A -v -oX " . $this->xmlFile; + + $exec_line = "sudo " . $config->getVar("nmap_binary") . " " . $nmap_flags . " "; + foreach($targets as $target) { + $exec_line .= $target . " "; + } + $job->addNotice("Executing nmap via: " . $exec_line . "\n"); + + $completed = false; + // Open the process + $handle = popen($exec_line, 'r'); // Only need it for reading + while(!feof($handle)) { + // nmap is running! + $line = fgets($handle); + if(strlen(trim($line))) $job->addNotice("NMAP: " . $line); + if(strpos($line, "Nmap done") === 0 || strpos($line, "Nmap finished") === 0) { + // Nmap is finished + $completed = true; + } + } + if(!$completed) { + $job->addError("Nmap failed to complete successfully. Could be permissions issue (check sudo access). Aborting discovery."); + return false; + } + $job->addNotice("Nmap finished discovery. Now reading in result XML."); + $nmapXML = simplexml_load_file($this->xmlFile); + // Read in hosts + $job->addNotice("Number of hosts: " . count($nmapXML->host)); + + foreach($nmapXML->host as $host) { + $job->addNotice('Found ' . $host->address[0]['addr'] . ':' . $host->hostnames[0]->hostname[0]['name'] . '.'); + + $c = new Criteria(); + $c1 = $c->getNewCriterion(NagiosHostPeer::ADDRESS, $host->address[0]['addr']); + $c2 = $c->getNewCriterion(NagiosHostPeer::ADDRESS, $host->hostnames[0]->hostname[0]['name']); + $c1->addOr($c2); + $c->add($c1); + $tempHost = NagiosHostPeer::doSelectOne($c); + if($tempHost) { + $job->addNotice("Device appears to already be in configuration under hostname: " . $host->getName() . ". Skipping."); + continue; + } + $device = new AutodiscoveryDevice(); + $device->setAutodiscoveryJob($job); + $device->setAddress($host->address[0]['addr']); + if(empty($host->hostnames[0]->hostname[0]['name'])) { + $device->setName($host->address[0]['addr']); + $device->setDescription($host->address[0]['addr']); + } + else { + $device->setName($host->hostnames[0]->hostname[0]['name']); + $device->setDescription($host->hostnames[0]->hostname[0]['name']); + } + $device->setHostname($host->hostnames[0]->hostname[0]['name']); + // Right now, if it exists, we pick the top-level matching os string (since it's the highest scored) + if(!empty($host->os[0]->osclass[0]['osfamily'])) { + // We found os family data + $device->setOsfamily($host->os[0]->osclass[0]['osfamily']); + } + if(!empty($host->os[0]->osclass[0]['osgen'])) { + // We found os family data + $device->setOsgen($host->os[0]->osclass[0]['osgen']); + } + if(!empty($host->os[0]->osclass[0]['vendor'])) { + // We found os family data + $device->setOsvendor($host->os[0]->osclass[0]['vendor']); + } + $device->save(); + // Add services + $job->addNotice("Number of ports for this host: " . count($host->ports[0]->port)); + + foreach($host->ports[0]->port as $port) { + // $port signifies as port / possible service, we'll grab that + $service = new AutodiscoveryDeviceService(); + $service->setProtocol($port['protocol']); + $service->setPort($port['portid']); + if(!empty($port->service[0]['name'])) { + $service->setName($port->service[0]['name']); + } + if(!empty($port->service[0]['product'])) { + $service->setProduct($port->service[0]['product']); + } + if(!empty($port->service[0]['version'])) { + $service->setVersion($port->service[0]['version']); + } + if(!empty($port->service[0]['extrainfo'])) { + $service->setExtrainfo($port->service[0]['extrainfo']); + } + $service->setAutodiscoveryDevice($device); + $service->save(); + } + + } + $job->addNotice("Added devices and services."); + + return true; + } +} diff --git a/build.properties b/build.properties new file mode 100755 index 0000000..cb97de7 --- /dev/null +++ b/build.properties @@ -0,0 +1,10 @@ +propel.project = lilac +propel.database = mysql +propel.database.url = mysql:host=localhost;dbname=lilac +propel.targetPackage = +propel.php.dir = ${propel.project.dir}/classes +propel.phpconf.dir = ${propel.project.dir}/includes +propel.sql.dir = ${propel.project.dir}/sqldata +propel.addTimeStamp = false +propel.addGenericAccessors = true +propel.addGenericMutators = true diff --git a/cgi.php b/cgi.php new file mode 100755 index 0000000..384f54c --- /dev/null +++ b/cgi.php @@ -0,0 +1,301 @@ +save(); +} + +if(isset($_POST['request'])) { + if($_POST['request'] == 'update') { + if(isset($_POST['cgi_config']['physical_html_path'])) + $cgiConfig->setPhysicalHtmlPath($_POST['cgi_config']['physical_html_path']); + if(isset($_POST['cgi_config']['url_html_path'])) + $cgiConfig->setUrlHtmlPath($_POST['cgi_config']['url_html_path']); + if(isset($_POST['cgi_config']['use_authentication'])) + $cgiConfig->setUseAuthentication($_POST['cgi_config']['use_authentication']); + if(isset($_POST['cgi_config']['default_user_name'])) + $cgiConfig->setDefaultUserName($_POST['cgi_config']['default_user_name']); + if(isset($_POST['cgi_config']['authorized_for_system_information'])) + $cgiConfig->setAuthorizedForSystemInformation($_POST['cgi_config']['authorized_for_system_information']); + if(isset($_POST['cgi_config']['authorized_for_system_commands'])) + $cgiConfig->setAuthorizedForSystemCommands($_POST['cgi_config']['authorized_for_system_commands']); + if(isset($_POST['cgi_config']['authorized_for_configuration_information'])) + $cgiConfig->setAuthorizedForConfigurationInformation($_POST['cgi_config']['authorized_for_configuration_information']); + if(isset($_POST['cgi_config']['authorized_for_all_hosts'])) + $cgiConfig->setAuthorizedForAllHosts($_POST['cgi_config']['authorized_for_all_hosts']); + if(isset($_POST['cgi_config']['authorized_for_all_host_commands'])) + $cgiConfig->setAuthorizedForAllHostCommands($_POST['cgi_config']['authorized_for_all_host_commands']); + if(isset($_POST['cgi_config']['authorized_for_all_services'])) + $cgiConfig->setAuthorizedForAllServices($_POST['cgi_config']['authorized_for_all_services']); + if(isset($_POST['cgi_config']['authorized_for_all_service_commands'])) + $cgiConfig->setAuthorizedForAllServiceCommands($_POST['cgi_config']['authorized_for_all_service_commands']); + if(isset($_POST['cgi_config']['statusmap_background_image'])) + $cgiConfig->setStatusmapBackgroundImage($_POST['cgi_config']['statusmap_background_image']); + if(isset($_POST['cgi_config']['default_statusmap_layout'])) + $cgiConfig->setDefaultStatusmapLayout($_POST['cgi_config']['default_statusmap_layout']); + if(isset($_POST['cgi_config']['statuswrl_include'])) + $cgiConfig->setStatuswrlInclude($_POST['cgi_config']['statuswrl_include']); + if(isset($_POST['cgi_config']['default_statuswrl_layout'])) + $cgiConfig->setDefaultStatuswrlLayout($_POST['cgi_config']['default_statuswrl_layout']); + if(isset($_POST['cgi_config']['refresh_rate'])) + $cgiConfig->setRefreshRate($_POST['cgi_config']['refresh_rate']); + if(isset($_POST['cgi_config']['host_unreachable_sound'])) + $cgiConfig->setHostUnreachableSound($_POST['cgi_config']['host_unreachable_sound']); + if(isset($_POST['cgi_config']['host_down_sound'])) + $cgiConfig->setHostDownSound($_POST['cgi_config']['host_down_sound']); + if(isset($_POST['cgi_config']['service_critical_sound'])) + $cgiConfig->setServiceCriticalSound($_POST['cgi_config']['service_critical_sound']); + if(isset($_POST['cgi_config']['service_warning_sound'])) + $cgiConfig->setServiceWarningSound($_POST['cgi_config']['service_warning_sound']); + if(isset($_POST['cgi_config']['service_unknown_sound'])) + $cgiConfig->setServiceUnknownSound($_POST['cgi_config']['service_unknown_sound']); + if(isset($_POST['cgi_config']['ping_syntax'])) + $cgiConfig->setPingSyntax($_POST['cgi_config']['ping_syntax']); + + if(isset($_POST['cgi_config']['lock_author_names'])) + $cgiConfig->setLockAuthorNames($_POST['cgi_config']['lock_author_names']); + if(isset($_POST['cgi_config']['escape_html_tags'])) + $cgiConfig->setEscapeHtmlTags($_POST['cgi_config']['escape_html_tags']); + if(isset($_POST['cgi_config']['notes_url_target'])) + $cgiConfig->setNotesUrlTarget($_POST['cgi_config']['notes_url_target']); + if(isset($_POST['cgi_config']['action_url_target'])) + $cgiConfig->setActionUrlTarget($_POST['cgi_config']['action_url_target']); + if(isset($_POST['cgi_config']['enable_splunk_integration'])) + $cgiConfig->setEnableSplunkIntegration($_POST['cgi_config']['enable_splunk_integration']); + if(isset($_POST['cgi_config']['splunk_url'])) + $cgiConfig->setSplunkUrl($_POST['cgi_config']['splunk_url']); + $cgiConfig->save(); + $success = "Updated CGI Configuration."; + } +} + + + + +// Let's make the status map layout select list +$statusmap_layout_list[] = array("values" => "0", "text" => "User-Defined Coordinates"); +$statusmap_layout_list[] = array("values" => "1", "text" => "Depth Layers"); +$statusmap_layout_list[] = array("values" => "2", "text" => "Collapsed Tree"); +$statusmap_layout_list[] = array("values" => "3", "text" => "Balanced Tree"); +$statusmap_layout_list[] = array("values" => "4", "text" => "Circular"); +$statusmap_layout_list[] = array("values" => "5", "text" => "Circular (Marked Up)"); +$statusmap_layout_list[] = array("values" => "6", "text" => "Circular (Marked Down)"); + +// Let's make the status wrl layout select list +$statuswrl_layout_list[] = array("values" => "0", "text" => "User-Defined Coordinates"); +$statuswrl_layout_list[] = array("values" => "1", "text" => "Depth Layers"); +$statuswrl_layout_list[] = array("values" => "2", "text" => "Collapsed Tree"); +$statuswrl_layout_list[] = array("values" => "3", "text" => "Balanced Tree"); +$statuswrl_layout_list[] = array("values" => "4", "text" => "Circular"); + + +if(!isset($_GET['section'])) + $_GET['section'] = 'paths'; + + +// Build subnavigation +$subnav = array( + 'paths' => 'Paths', + 'authentication' => 'Authentication', + 'status' => 'Status', + 'sounds' => 'Sounds', + 'other' => 'Other' + ); + + +print_header("CGI Configuration File Editor"); + + print_window_header("Web Interface Configuration", "100%", "center"); + print_subnav($subnav, $_GET['section'], "section"); + if($_GET['section'] == 'paths') { + + ?> +
+ +
+ Physical HTML Path:
+
+ element_desc("physical_html_path", "nagios_cgi_desc"); ?>
+
+
+ URL HTML Path:
+
+ element_desc("url_html_path", "nagios_cgi_desc"); ?>
+
+
+ +
+ + + +
+ Use Authentication: getUseAuthentication());?>
+ element_desc("use_authentication", "nagios_cgi_desc"); ?>
+
+
+ Default Username:
+ element_desc("default_user_name", "nagios_cgi_desc"); ?>
+
+
+ Authorized for System Information:
+ element_desc("authorized_for_system_information", "nagios_cgi_desc"); ?>
+
+
+ Authorized for System Commands:
+ element_desc("authorized_for_system_commands", "nagios_cgi_desc"); ?>
+
+
+ Authorized for Configuration Information:
+ element_desc("authorized_for_configuration_information", "nagios_cgi_desc"); ?>
+
+
+ Authorized for All Hosts:
+ element_desc("authorized_for_all_hosts", "nagios_cgi_desc"); ?>
+
+
+ Authorized for All Host Commands:
+ element_desc("authorized_for_all_host_commands", "nagios_cgi_desc"); ?>
+
+
+ Authorized for All Services:
+ element_desc("authorized_for_all_services", "nagios_cgi_desc"); ?>
+
+
+ Authorized for All Service Commands:
+ element_desc("authorized_for_all_service_commands", "nagios_cgi_desc"); ?>
+
+
+ +
+ + + +
+ Statusmap Background Image:
+ element_desc("statusmap_background_image", "nagios_cgi_desc"); ?>
+
+
+ Default Statusmap Layout getDefaultStatusmapLayout());?>
+ element_desc("default_statusmap_layout", "nagios_cgi_desc"); ?>
+
+
+ Statuswrl Include:
+ element_desc("statuswrl_include", "nagios_cgi_desc"); ?>
+
+
+ Default Statuswrl Layout getDefaultStatuswrlLayout());?>
+ element_desc("default_statuswrl_layout", "nagios_cgi_desc"); ?>
+
+
+ Refresh Rate:
+ element_desc("refresh_rate", "nagios_cgi_desc"); ?>
+
+
+ +
+ + + +
+ Host Unreachable Sound:
+ element_desc("host_unreachable_sound", "nagios_cgi_desc"); ?>
+
+
+ Host Down Sound:
+ element_desc("host_down_sound", "nagios_cgi_desc"); ?>
+
+
+ Service Critical Sound:
+ element_desc("service_critical_sound", "nagios_cgi_desc"); ?>
+
+
+ Service Warning Sound:
+ element_desc("service_warning_sound", "nagios_cgi_desc"); ?>
+
+
+ Service Unknown Sound:
+ element_desc("service_unknown_sound", "nagios_cgi_desc"); ?>
+
+
+ +
+ + + +
+ Lock Author Names: getLockAuthorNames());?>
+ element_desc("lock_author_names", "nagios_cgi_desc"); ?>
+
+
+ Escape HTML Tags: getEscapeHtmlTags());?>
+ element_desc("escape_html_tags", "nagios_cgi_desc"); ?>
+
+
+ Notes URL Target:
+
+ element_desc("notes_url_target", "nagios_cgi_desc"); ?>
+
+
+ Action URL Target:
+
+ element_desc("action_url_target", "nagios_cgi_desc"); ?>
+
+
+ Ping Syntax:
+
+ element_desc("ping_syntax", "nagios_cgi_desc"); ?>
+
+
+ Enable Splunk Integration: getEnableSplunkIntegration());?>
+ element_desc("enable_splunk_integration", "nagios_cgi_desc"); ?>
+
+
+ Splunk URL:
+
+ element_desc("splunk_url", "nagios_cgi_desc"); ?>
+
+
+ +
+ diff --git a/classes/AutodiscoveryDevice.php b/classes/AutodiscoveryDevice.php new file mode 100755 index 0000000..9b9c7c8 --- /dev/null +++ b/classes/AutodiscoveryDevice.php @@ -0,0 +1,39 @@ +add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->getId()); + $c->addDescendingOrderByColumn(AutodiscoveryDeviceTemplateMatchPeer::PERCENT); + $c->addDescendingOrderByColumn(AutodiscoveryDeviceTemplateMatchPeer::COMPLEXITY); + $matches = AutodiscoveryDeviceTemplateMatchPeer::doSelect($c); + return $matches; + } + +} // AutodiscoveryDevice diff --git a/classes/AutodiscoveryDevicePeer.php b/classes/AutodiscoveryDevicePeer.php new file mode 100755 index 0000000..a3f1842 --- /dev/null +++ b/classes/AutodiscoveryDevicePeer.php @@ -0,0 +1,19 @@ +setTime(time()); + $entry->setType($type); + $entry->setAutodiscoveryJob($this); + $entry->setText($text); + $entry->save(); + return true; + } + public function setStatus($v) { + parent::setStatus($v); + // update the status time + $this->setStatusChangeTime(time()); + } + + public function clearLog() { + $c = new Criteria(); + $c->add(AutodiscoveryLogEntryPeer::JOB, $this->getId()); + AutodiscoveryLogEntryPeer::doDelete($c); + } + + public function addError($text) { + $this->addLogEntry($text, AutodiscoveryLogEntry::TYPE_ERROR); + } + + public function addWarning($text) { + $this->addLogEntry($text, AutodiscoveryLogEntry::TYPE_WARNING); + } + + public function addNotice($text) { + $this->addLogEntry($text, AutodiscoveryLogEntry::TYPE_NOTICE); + } + +} // AutodiscoveryJob diff --git a/classes/AutodiscoveryJobPeer.php b/classes/AutodiscoveryJobPeer.php new file mode 100755 index 0000000..83a23ac --- /dev/null +++ b/classes/AutodiscoveryJobPeer.php @@ -0,0 +1,19 @@ +setStats(serialize(new ImportStats())); + } + + public function addLogEntry($text, $type = 3) { + if(!ExportLogEntry::isValidType($type)) { + return false; + } + $entry = new ExportLogEntry(); + $entry->setTime(time()); + $entry->setType($type); + $entry->setExportJob($this); + $entry->setText($text); + $entry->save(); + return true; + } + + public function setStatus($v) { + parent::setStatus($v); + $this->setStatusChangeTime(time()); + } + + public function clearLog() { + $c = new Criteria(); + $c->add(ExportLogEntryPeer::JOB, $this->getId()); + ExportLogEntryPeer::doDelete($c); + } + + public function addError($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_ERROR); + } + + public function addWarning($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_WARNING); + } + + public function addNotice($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_NOTICE); + } + +} // ExportJob diff --git a/classes/ExportJobPeer.php b/classes/ExportJobPeer.php new file mode 100755 index 0000000..ac54a77 --- /dev/null +++ b/classes/ExportJobPeer.php @@ -0,0 +1,23 @@ +setTime(time()); + $entry->setType($type); + $entry->setImportJob($this); + $entry->setText($text); + $entry->save(); + return true; + } + + public function setStatus($v) { + parent::setStatus($v); + // update the status time + $this->setStatusChangeTime(time()); + } + + public function clearLog() { + $c = new Criteria(); + $c->add(ImportLogEntryPeer::JOB, $this->getId()); + ImportLogEntryPeer::doDelete($c); + } + + public function addError($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_ERROR); + } + + public function addWarning($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_WARNING); + } + + public function addNotice($text) { + $this->addLogEntry($text, ImportLogEntry::TYPE_NOTICE); + } + +} // ImportJob diff --git a/classes/ImportJobPeer.php b/classes/ImportJobPeer.php new file mode 100755 index 0000000..ce481d8 --- /dev/null +++ b/classes/ImportJobPeer.php @@ -0,0 +1,23 @@ +createModulesByHook($hook); + } + + public function renderForHook($hook) { + $mods = $this->getModulesByHook($hook); + foreach($mods as $mod) { + $mod->render(); + } + } + + public function render() { + + } + + public function init() { + + } + +} + diff --git a/classes/Module.php b/classes/Module.php new file mode 100755 index 0000000..4bb17c5 --- /dev/null +++ b/classes/Module.php @@ -0,0 +1,226 @@ +getClassname(); + if((get_class($this) != $module->getClassname())) { + throw new Exception("The creation of this module of type " . get_class($this) . " does not match the classname of the AddOnModule: " . $module->getClassname()); + } + $this->_ormModule = $module; + $this->_context = $context; + $this->_callingModule = $caller; + + // Grab our getParameters + $len = strlen("__m" . $this->_ormModule->getId() . "_"); + foreach($_GET as $getName => $getValue) { + $pos = strpos($getName, "__m" . $this->_ormModule->getId() . "_"); + if($pos === 0) { + // This variable belongs to us + $actualName = substr($getName, $len); + $this->__getParams[$actualName] = $getValue; + } + else { + $this->__notUsGetParams[$getName] = $getValue; + } + } + // Build our postParameters + foreach($_POST as $postName => $postValue) { + $pos = strpos($postName, "__m" . $this->_ormModule->getId() . "_"); + if($pos === 0) { + // This variable belongs to us + $actualName = substr($postName, $len); + $this->__postParams[$actualName] = $postValue; + } + } + // Build our uploadedFiles + foreach($_FILES as $fileName => $fileValue) { + $pos = strpos($fileName, "__m" . $this->_ormModule->getId() . "_"); + if($pos === 0) { + // This variable belongs to us + $actualName = substr($fileName, $len); + $this->__fileParams[$actualName] = $fileValue; + } + } + $this->init(); + } + + final public function getId() { + return $this->_ormModule->getId(); + } + + final public function getContext() { + return $this->_context; + } + + final protected function getParamName($name) { + $newName = "__m" . $this->_ormModule->getId() . "_" . trim($name); + return $newName; + } + + final protected function buildURL($pairs) { + if(!is_array($pairs)) { + throw new Exception("Arguement to buildURL must be an associative array"); + } + $url = $_SERVER['PHP_SELF'] . "?"; + // Add our not us values + $first = true; + foreach($this->__notUsGetParams as $key => $val) { + if(!$first) + $url .= "&"; + $first = false; + $url .= $key . "=" . urlencode($val); + } + foreach($pairs as $key => $val) { + $name = $this->getParamName($key); + if(!$first) + $url .= "&"; + $first = false; + $url .= $name . "=" . urlencode($val); + } + return $url; + } + + final protected function getUrlParam($name) { + if(!array_key_exists($name, $this->__getParams)) + return false; + return $this->__getParams[$name]; + } + + final protected function getPostParam($name) { + if(!array_key_exists($name, $this->__postParams)) + return false; + return $this->__postParams[$name]; + } + + final protected function getUploadedFile($name) { + if(!array_key_exists($name, $this->__uploadedFiles)) + return false; + return $this->__uploadedFiles[$name]; + } + + final protected function getAddOnModule() { + return $this->_ormModule; + } + + final protected function getAddOnUrl() { + $addOn = $this->_ormModule->getAddOnRelatedByAddOn(); + $url = $addOn->getPath(); + if(empty($url)) + return false; + return $url . "/"; + } + + final protected function getCallingModule() { + return $this->_callingModule; + } + + final protected function createModulesByHook($hook, $context = null) { + $c = new Criteria(); + $c->add(AddOnModuleHookPeer::ADD_ON_MODULE, $this->_ormModule->getId()); + $c->add(AddOnModuleHookPeer::NAME, $hook); + $c->setIgnoreCase(true); + $hook = AddOnModuleHookPeer::doSelectOne($c); + if(!$hook) + return false; + $registrations = $hook->getAddOnModuleHookRegistrations(); + $modules = array(); + foreach($registrations as $registration) { + $addOnModule = $registration->getAddOnModuleRelatedByAddOnModule(); + if($addOnModule) { + // Okay, let's load up the class. + // First, make sure we include the class file. + if(!file_exists(dirname(__FILE__) . "/../addons/" . $addOnModule->getAddOnRelatedByAddOn()->getPath() . "/modules/" . $addOnModule->getClassName() . ".php")) { + throw new Exception("The module class file for " . $addOnModule->getClassName() . " could not be found."); + } + require_once(dirname(__FILE__) . "/../addons/" . $addOnModule->getAddOnRelatedByAddOn()->getPath() . "/modules/" . $addOnModule->getClassName() . ".php"); + $className = $addOnModule->getClassName(); + $modules[] = new $className($addOnModule, $context == null ? $this->getContext() : $context, $this); + } + } + return $modules; + } + + final protected function getDynamicData($name = null) { + $c = new Criteria(); + $c->add(AddOnModuleDynamicDataPeer::ADD_ON_MODULE, $this->_ormModule->getId()); + if($name != null) + $c->add(AddOnModuleDynamicDataPeer::NAME, $name); + $dynData = AddOnModuleDynamicDataPeer::doSelect($c); + $data = array(); + if(!empty($dynData)) { + foreach($dynData as $segment) + $data[$segment->getName()] = $segment->getData(); + } + return $data; + } + + final protected function deleteDynamicdata($name) { + $c = new Criteria(); + $c->add(AddOnModuleDynamicDataPeer::ADD_ON_MODULE, $this->_ormModule->getId()); + $c->add(AddOnModuleDynamicDataPeer::NAME, $name); + $dynData = AddOnModuleDynamicDataPeer::doSelectOne($c); + if(empty($dynData)) { + return true; + } + $dynData->delete(); + return true; + } + + + final protected function dynamicDataExists($name) { + $c = new Criteria(); + $c->add(AddOnModuleDynamicDataPeer::ADD_ON_MODULE, $this->_ormModule->getId()); + $c->add(AddOnModuleDynamicDataPeer::NAME, $name); + $dynData = AddOnModuleDynamicDataPeer::doSelectOne($c); + if(!empty($dynData)) { + return true; + } + return false; + + } + + final protected function setDynamicData($name, $data) { + if(trim($name) == '') { + throw new Exception("Name of dynamic data to be set cannot be blank."); + } + $c = new Criteria(); + $c->add(AddOnModuleDynamicDataPeer::ADD_ON_MODULE, $this->_ormModule->getId()); + $c->add(AddOnModuleDynamicDataPeer::NAME, $name); + $dynData = AddOnModuleDynamicDataPeer::doSelectOne($c); + if(!empty($dynData)) { + $dynData->setData($data); + $dynData->save(); + return true; + } + $dynData = new AddOnModuleDynamicData(); + $dynData->setAddOnModuleRelatedByAddOnModule($this->_ormModule); + $dynData->setName($name); + $dynData->setData($data); + $dynData->save(); + return true; + } + + abstract public function init(); + abstract public function render(); +} + +interface MenuItem { + public function getTitle(); + public function getDescription(); + public function getIcon(); +} + diff --git a/classes/NagiosBrokerModule.php b/classes/NagiosBrokerModule.php new file mode 100755 index 0000000..41e4a08 --- /dev/null +++ b/classes/NagiosBrokerModule.php @@ -0,0 +1,24 @@ +setName($source['command_name']); + if(isset($source['command_desc'])) $this->setDescription($source['command_desc']); + if(isset($source['command_line'])) $this->setLine($source['command_line']); + } + + +} // NagiosCommand diff --git a/classes/NagiosCommandPeer.php b/classes/NagiosCommandPeer.php new file mode 100755 index 0000000..dd0f71d --- /dev/null +++ b/classes/NagiosCommandPeer.php @@ -0,0 +1,38 @@ +add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + return $command; + } + + +} // NagiosCommandPeer diff --git a/classes/NagiosContact.php b/classes/NagiosContact.php new file mode 100755 index 0000000..dd5d19f --- /dev/null +++ b/classes/NagiosContact.php @@ -0,0 +1,100 @@ +add(NagiosTimeperiodPeer::NAME, $name); + $timeperiod = NagiosTimeperiodPeer::doSelectOne($c); + if(!empty($timeperiod)) { + $this->setNagiosTimeperiodRelatedByServiceNotificationPeriod($timeperiod); + return true; + } + return false; + } + + public function setHostNotificationPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $timeperiod = NagiosTimeperiodPeer::doSelectOne($c); + if(!empty($timeperiod)) { + $this->setNagiosTimeperiodRelatedByHostNotificationPeriod($timeperiod); + return true; + } + return false; + } + + public function addServiceNotificationCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $command = NagiosCommandPeer::doSelectOne($c); + if(!empty($command)) { + $notificationCommand = new NagiosContactNotificationCommand(); + $notificationCommand->setType("service"); + $notificationCommand->setNagiosContact($this); + $notificationCommand->setNagiosCommand($command); + $notificationCommand->save(); + return true; + } + return false; + } + + public function addHostNotificationCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $command = NagiosCommandPeer::doSelectOne($c); + if(!empty($command)) { + $notificationCommand = new NagiosContactNotificationCommand(); + $notificationCommand->setType("host"); + $notificationCommand->setNagiosContact($this); + $notificationCommand->setNagiosCommand($command); + $notificationCommand->save(); + return true; + } + return false; + } + + public function joinNagiosContactGroupByName($name) { + $c = new Criteria(); + $c->add(NagiosContactGroupPeer::NAME, $name); + $group = NagiosContactGroupPeer::doSelectOne($c); + if(!empty($group)) { + $membership = new NagiosContactGroupMember(); + $membership->setNagiosContact($this); + $membership->setNagiosContactGroup($group); + $membership->save(); + return true; + } + return false; + } + + public function addAddress($text) { + $address = new NagiosContactAddress(); + $address->setNagiosContact($this); + $address->setAddress($text); + $address->save(); + return true; + } + +} // NagiosContact diff --git a/classes/NagiosContactAddress.php b/classes/NagiosContactAddress.php new file mode 100755 index 0000000..44bc2b3 --- /dev/null +++ b/classes/NagiosContactAddress.php @@ -0,0 +1,23 @@ +add(NagiosContactPeer::NAME, $name); + $contact = NagiosContactPeer::doSelectOne($c); + if(!empty($contact)) { + $membership = new NagiosContactGroupMember(); + $membership->setNagiosContactGroup($this); + $membership->setNagiosContact($contact); + $membership->save(); + return true; + } + return false; + } +} // NagiosContactGroup diff --git a/classes/NagiosContactGroupMember.php b/classes/NagiosContactGroupMember.php new file mode 100755 index 0000000..1d66715 --- /dev/null +++ b/classes/NagiosContactGroupMember.php @@ -0,0 +1,23 @@ +add(NagiosContactGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $contactgroup = NagiosContactGroupPeer::doSelectOne($c); + if(!$contactgroup) + return false; + return $contactgroup; + } + +} // NagiosContactGroupPeer diff --git a/classes/NagiosContactNotificationCommand.php b/classes/NagiosContactNotificationCommand.php new file mode 100755 index 0000000..a01bc6e --- /dev/null +++ b/classes/NagiosContactNotificationCommand.php @@ -0,0 +1,23 @@ +add(NagiosContactPeer::NAME, $name); + $c->setIgnoreCase(true); + $contact = NagiosContactPeer::doSelectOne($c); + if(!$contact) + return false; + return $contact; + } + +} // NagiosContactPeer diff --git a/classes/NagiosDependency.php b/classes/NagiosDependency.php new file mode 100755 index 0000000..6fd9576 --- /dev/null +++ b/classes/NagiosDependency.php @@ -0,0 +1,45 @@ +getNagiosService()) + return "service"; + if($this->getNagiosServiceTemplate()) + return "servicetemplate"; + if($this->getNagiosHost()) + return "host"; + if($this->getNagiosHostTemplate()) + return "hosttemplate"; + if($this->getNagiosHostgroup()) + return "hostgroup"; + + } + + public function setDependencyPeriodByName($name) { + $timeperiod = NagiosTimeperiodPeer::getByName($name); + if(!$timeperiod) + return false; + $this->setNagiosTimeperiod($timeperiod); + $this->save(); + } + +} // NagiosDependency diff --git a/classes/NagiosDependencyPeer.php b/classes/NagiosDependencyPeer.php new file mode 100755 index 0000000..e80e96e --- /dev/null +++ b/classes/NagiosDependencyPeer.php @@ -0,0 +1,27 @@ +getNagiosService()) + return "service"; + if($this->getNagiosHost()) + return "host"; + if($this->getNagiosHostgroup()) + return "hostgroup"; + } + +} // NagiosDependencyTarget diff --git a/classes/NagiosDependencyTargetPeer.php b/classes/NagiosDependencyTargetPeer.php new file mode 100755 index 0000000..25193ae --- /dev/null +++ b/classes/NagiosDependencyTargetPeer.php @@ -0,0 +1,19 @@ +add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->getId()); + $c->addAscendingOrderByColumn(NagiosHostTemplateInheritancePeer::ORDER); + + $inheritanceTemplates = NagiosHostTemplateInheritancePeer::doSelect($c); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $inheritanceItem) { + $hostTemplate = $inheritanceItem->getNagiosHostTemplateRelatedByTargetTemplate(); + $templateValues = $hostTemplate->getValues(true); + $values = array_merge($values, $templateValues); + } + } + foreach(NagiosHostPeer::getFieldNames() as $fieldName) { + $colName = NagiosHostPeer::translateFieldName($fieldName, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); + // At this point, $fieldName is the fieldname for each column in our table record + $colName = strtolower(substr($colName, strlen("nagios_host."))); + // $colName is now the abbreviated column name. + + switch($colName) { + case 'maximum_check_attempts': + $colName = 'max_check_attempts'; + break; + } + $methodName = "get" . $fieldName; + if(method_exists($this, $methodName)) { + $val = $this->{$methodName}(); + + if($val !== null) { + + // Yay, let's populate + $values[$colName] = array( + 'inherited' => $inherited, + 'source' => array('id' => $this->getId(), 'name' => $this->getName()), + 'value' => $val + ); + } + } + + } + return $values; + } + + function getInheritedCommandParameters($self = true) { + $parameterList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $parameters = $hostTemplate->getInheritedCommandParameters(false); + $parameterList = array_merge($parameterList, $parameters); + } + } + if(!$self) { + $parameters = $this->getNagiosHostCheckCommandParameters(); + array_merge($parameterList, $parameters); + } + return $parameterList; + } + + + function getInheritedDependencies($self = true) { + $dependenciesList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $dependencies = $hostTemplate->getInheritedDependencies(false); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + } + if(!$self) { + $dependencies = $this->getNagiosDependencys(); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + return $dependenciesList; + } + + function getInheritedEscalations($self = true) { + $escalationsList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $escalations = $hostTemplate->getInheritedEscalations(false); + $escalationsList = array_merge($escalationsList, $escalations); + } + } + if(!$self) { + $escalations = $this->getNagiosEscalations(); + $escalationsList = array_merge($escalationsList, $escalations); + } + return $escalationsList; + } + + function getInheritedServices($self = true) { + $servicesList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $services = $hostTemplate->getInheritedServices(false); + $servicesList = array_merge($servicesList, $services); + } + } + if(!$self) { + + $services = $this->getNagiosServices(); + $servicesList = array_merge($servicesList, $services); + } + return $servicesList; + } + + function getInheritedHostGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $hostgroups = $hostTemplate->getInheritedHostGroups(false); + $groupList = array_merge($groupList, $hostgroups); + } + } + if(!$self) { + $hostgroupMemberships = $this->getNagiosHostgroupMemberships(); + foreach($hostgroupMemberships as $membership) { + $hostgroup = $membership->getNagiosHostGroup(); + $groupList[] = $hostgroup; + } + } + return $groupList; + } + + function getInheritedContacts($self = true) { + $contactsList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $contacts = $hostTemplate->getInheritedContacts(false); + $contactsList = array_merge($contactsList, $contacts); + } + } + if(!$self) { + $contactMemberships = $this->getNagiosHostContactMembers(); + foreach($contactMemberships as $membership) { + $contact = $membership->getNagiosContact(); + $contactsList[] = $contact; + } + } + return $contactsList; + } + + + function getInheritedContactGroups($self = true) { + $groupList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $contactgroups = $hostTemplate->getInheritedContactGroups(false); + $groupList = array_merge($groupList, $contactgroups); + } + } + if(!$self) { + $contatgroupMemberships = $this->getNagiosHostContactgroups(); + foreach($contatgroupMemberships as $membership) { + $contactgroup = $membership->getNagiosContactGroup(); + $groupList[] = $contactgroup; + } + } + return $groupList; + } + + public function getNumberOfChildren() { + $c = new Criteria(); + $c->add(NagiosHostParentPeer::PARENT_HOST , $this->getId()); + + return NagiosHostPeer::doCount($c); + } + + function getNagiosHostTemplateInheritances() { + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->getId()); + $c->addAscendingOrderByColumn(NagiosHostTemplateInheritancePeer::ORDER); + + $list = array(); + $inheritanceTemplates = NagiosHostTemplateInheritancePeer::doSelect($c); + + foreach($inheritanceTemplates as $inheritanceItem) { + $list[] = $inheritanceItem->getNagiosHostTemplateRelatedByTargetTemplate(); + } + + + return $list; + } + + function addCheckCommandParameter($value) { + $parameter = new NagiosHostCheckCommandParameter(); + $parameter->setNagiosHost($this); + $parameter->setParameter($value); + $parameter->save(); + return true; + } + + + function getInheritedCommandWithParameters($cmdObj = null) { + $self = false; + if($cmdObj === null) { + $self = true; + // Initialize array + $cmdObj = array( + 'command' => null, + 'parameters' => array() + ); + } + $inheritedTemplates = $this->getNagiosHostTemplateInheritances(); + // Inheritedtemplates is our collection of templates that we directly inherit from. Let's grab 'em + foreach($inheritedTemplates as $template) { + $cmdObj = $template->getInheritedCommandWithParameters($cmdObj); + } + // Okay, let's check ourselves + if($this->getNagiosCommandRelatedByCheckCommand()) { + $cmdObj['command'] = array('inherited' => ($self ? false : true), + 'source' => $this, + 'command' => $this->getNagiosCommandRelatedByCheckCommand()); + } + $parameters = $this->getNagiosHostCheckCommandParameters(); + foreach($parameters as $param) { + $cmdObj['parameters'][] = array( + 'inherited' => ($self ? false : true), + 'source' => $this, + 'parameter' => $param + ); + } + return $cmdObj; + } + + function setCheckCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByCheckCommand($command); + $this->save(); + return true; + } + + function setCheckPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByCheckPeriod($command); + $this->save(); + return true; + } + + function setEventHandlerByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByEventHandler($command); + $this->save(); + return true; + } + function setNotificationPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByNotificationPeriod($command); + $this->save(); + return true; + } + + /** + * Returns just the first parnet of the host. + */ + function getParentHost() { + $c = new Criteria(); + $c->add(NagiosHostParentPeer::CHILD_HOST, $this->getId()); + $relationship = NagiosHostParentPeer::doSelectOne($c); + if(!count($relationship)) { + return null; + } + return $relationship->getNagiosHostRelatedByParentHost()->getId(); + } + + function getChildrenHosts() { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME); + $sql = "SELECT nagios_host.* FROM nagios_host_parent INNER JOIN nagios_host ON nagios_host.id = nagios_host_parent.child_host WHERE nagios_host_parent.parent_host = " . $this->getId() . " ORDER BY nagios_host.name"; + $stmt = $con->prepare($sql); + $stmt->execute(); + $children = NagiosHostPeer::populateObjects($stmt); + return $children; + } + + function addParentByName($name) { + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $name); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) + return false; + + // Okay, let's first see if there's a parent relationship around + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostParentPeer::CHILD_HOST, $this->getId()); + $c->add(NagiosHostParentPeer::PARENT_HOST, $host->getId()); + $relationship = NagiosHostParentPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + // Okay, relationship doesn't exist, let's add it! + $relationship = new NagiosHostParent(); + $relationship->setNagiosHostRelatedByChildHost($this); + $relationship->setNagiosHostRelatedByParentHost($host); + $relationship->save(); + return true; + } + + function addHostgroupByName($name) { + $c = new Criteria(); + $c->add(NagiosHostgroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $hostgroup = NagiosHostgroupPeer::doSelectOne($c); + if(!$hostgroup) + return false; + // Okay, hostgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostgroupMembershipPeer::HOST, $this->getId()); + $c->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $hostgroup->getId()); + $relationship = NagiosHostgroupMembershipPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosHostgroupMembership(); + $relationship->setNagiosHost($this); + $relationship->setNagiosHostgroup($hostgroup); + $relationship->save(); + return true; + } + + function addContactByName($name) { + $c = new Criteria(); + $c->add(NagiosContactPeer::NAME, $name); + $c->setIgnoreCase(true); + $contact = NagiosContactPeer::doSelectOne($c); + if(!$contact) + return false; + // Okay, contact is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostContactMemberPeer::HOST, $this->getId()); + $c->add(NagiosHostContactMemberPeer::CONTACT, $contact->getId()); + $relationship = NagiosHostContactMemberPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosHostContactMember(); + $relationship->setNagiosHost($this); + $relationship->setNagiosContact($contact); + $relationship->save(); + return true; + } + + function addContactGroupByName($name) { + $c = new Criteria(); + $c->add(NagiosContactGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $contactgroup = NagiosContactGroupPeer::doSelectOne($c); + if(!$contactgroup) + return false; + // Okay, contactgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostContactgroupPeer::HOST, $this->getId()); + $c->add(NagiosHostContactgroupPeer::CONTACTGROUP, $contactgroup->getId()); + $relationship = NagiosHostContactgroupPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosHostContactgroup(); + $relationship->setNagiosHost($this); + $relationship->setNagiosContactGroup($contactgroup); + $relationship->save(); + return true; + } + + function addTemplateInheritance($name) { + // First get the template by name + $template = NagiosHostTemplatePeer::getByName($name); + if(!$template) + return false; + // Check to see if inheritance already exists + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->getId()); + $c->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $template->getId()); + $relationship = NagiosHostTemplateInheritancePeer::doSelectOne($c); + if($relationship) + return false; + } + // Okay, create new one + $relationship = new NagiosHostTemplateInheritance(); + $relationship->setNagiosHost($this); + $relationship->setNagiosHostTemplateRelatedByTargetTemplate($template); + $relationship->save(); + return true; + } + + function getNagiosHostCheckCommandParameters($criteria = null, PropelPDO $con = null) { + if($criteria == null) + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(NagiosHostCheckCommandParameterPeer::ID); + return parent::getNagiosHostCheckCommandParameters($criteria); + } + + +} // NagiosHost diff --git a/classes/NagiosHostCheckCommandParameter.php b/classes/NagiosHostCheckCommandParameter.php new file mode 100755 index 0000000..0468f3f --- /dev/null +++ b/classes/NagiosHostCheckCommandParameter.php @@ -0,0 +1,23 @@ +add(NagiosHostPeer::NAME, $name); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) { + return false; + } + return $host; + } + + public function getTopLevelHosts() { + $con = Propel::getConnection(BaseNagiosHostPeer::DATABASE_NAME); + $sql = "SELECT * from nagios_host WHERE (select count(*) FROM nagios_host_parent WHERE nagios_host_parent.child_host = nagios_host.id) = 0 ORDER BY nagios_host.name"; + $stmt = $con->prepare($sql); + $stmt->execute(); + $hosts = NagiosHostPeer::populateObjects($stmt); + return $hosts; + } + +} // NagiosHostPeer diff --git a/classes/NagiosHostTemplate.php b/classes/NagiosHostTemplate.php new file mode 100755 index 0000000..e8d1e5d --- /dev/null +++ b/classes/NagiosHostTemplate.php @@ -0,0 +1,523 @@ +getNagiosHostTemplateInheritancesRelatedByTargetTemplateJoinNagiosHost(); + foreach($inheritances as $inheritance) { + if($inheritance->getNagiosHostTemplateRelatedBySourceTemplate()) { + // This is a template which inherits us, grab it's hosts! + $affectedHosts = $inheritance->getNagiosHostTemplateRelatedBySourceTemplate()->getAffectedHosts($affectedHosts); + } + else { + $host = $inheritance->getNagiosHost(); + if(!array_key_exists($host->getName(), $affectedHosts)) { + $affectedHosts[$host->getName()] = $host; + } + } + } + return $affectedHosts; + } + + + /** + * Returns multi-dimension + * + * @param unknown_type $hosttemplateinfo + * @param unknown_type $hosttemplateinfoSources + * @return unknown + */ + public function getValues($inherited = false) { + $values = array(); + + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosHostTemplateInheritancePeer::ORDER); + + $inheritanceTemplates = NagiosHostTemplateInheritancePeer::doSelect($c); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $inheritanceItem) { + $hostTemplate = $inheritanceItem->getNagiosHostTemplateRelatedByTargetTemplate(); + $templateValues = $hostTemplate->getValues(true); + $values = array_merge($values, $templateValues); + } + } + foreach(NagiosHostTemplatePeer::getFieldNames() as $fieldName) { + $colName = NagiosHostTemplatePeer::translateFieldName($fieldName, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); + // At this point, $fieldName is the fieldname for each column in our table record + $colName = strtolower(substr($colName, strlen("nagios_host_template."))); + // $colName is now the abbreviated column name. + + switch($colName) { + case 'maximum_check_attempts': + $colName = 'max_check_attempts'; + break; + } + $methodName = "get" . $fieldName; + if(method_exists($this, $methodName)) { + $val = $this->{$methodName}(); + + if($val !== null) { + + // Yay, let's populate + $values[$colName] = array( + 'inherited' => $inherited, + 'source' => array('id' => $this->getId(), 'name' => $this->getName()), + 'value' => $val + ); + } + } + + } + return $values; + } + + function getInheritedCommandParameters($self = true) { + $parameterList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $parameters = $hostTemplate->getInheritedCommandParameters(false); + $parameterList = array_merge($parameterList, $parameters); + } + } + if(!$self) { + $parameters = $this->getNagiosHostCheckCommandParameters(); + array_merge($parameterList, $parameters); + } + return $parameterList; + } + + function getInheritedDependencies($self = true) { + $dependenciesList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $dependencies = $hostTemplate->getInheritedDependencies(false); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + } + if(!$self) { + $dependencies = $this->getNagiosDependencys(); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + return $dependenciesList; + } + + function getInheritedEscalations($self = true) { + $escalationsList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $escalations = $hostTemplate->getInheritedEscalations(false); + $escalationsList = array_merge($escalationsList, $escalations); + } + } + if(!$self) { + $escalations = $this->getNagiosEscalations(); + $escalationsList = array_merge($escalationsList, $escalations); + } + return $escalationsList; + } + + function getInheritedServices($self = true) { + $servicesList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $services = $hostTemplate->getInheritedServices(false); + $servicesList = array_merge($servicesList, $services); + } + } + if(!$self) { + + $services = $this->getNagiosServices(); + $servicesList = array_merge($servicesList, $services); + } + return $servicesList; + } + + function getInheritedHostGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $hostgroups = $hostTemplate->getInheritedHostGroups(false); + $groupList = array_merge($groupList, $hostgroups); + } + } + if(!$self) { + $hostgroupMemberships = $this->getNagiosHostgroupMemberships(); + foreach($hostgroupMemberships as $membership) { + $hostgroup = $membership->getNagiosHostGroup(); + $groupList[] = $hostgroup; + } + } + return $groupList; + } + + function getInheritedContactGroups($self = true) { + $groupList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $contactgroups = $hostTemplate->getInheritedContactGroups(false); + $groupList = array_merge($groupList, $contactgroups); + } + } + if(!$self) { + $contactgroupMemberships = $this->getNagiosHostContactgroups(); + foreach($contactgroupMemberships as $membership) { + $contactgroup = $membership->getNagiosContactGroup(); + $groupList[] = $contactgroup; + } + } + return $groupList; + } + + function getInheritedContacts($self = true) { + $contactsList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $contacts = $hostTemplate->getInheritedContacts(false); + $contactsList = array_merge($contactsList, $contacts); + } + } + if(!$self) { + $contactMemberships = $this->getNagiosHostContactMembers(); + foreach($contactMemberships as $membership) { + $contact = $membership->getNagiosContact(); + $contactsList[] = $contact; + } + } + return $contactsList; + } + + function getInheritedNagiosAutodiscoveryServiceFilters($self = true) { + $filterList = array(); + + $inheritanceTemplates = $this->getNagiosHostTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $hostTemplate) { + $filters = $hostTemplate->getInheritedNagiosAutodiscoveryServiceFilters(false); + $filterList = array_merge($filterList, $filters); + } + } + if(!$self) { + $filters = $this->getNagiosHostTemplateAutodiscoveryServices(); + $filterList = array_merge($filterList, $filters); + } + return $filterList; + } + + function getNagiosHostTemplateInheritances() { + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosHostTemplateInheritancePeer::ORDER); + + $list = array(); + $inheritanceTemplates = NagiosHostTemplateInheritancePeer::doSelect($c); + foreach($inheritanceTemplates as $inheritanceItem) { + $list[] = $inheritanceItem->getNagiosHostTemplateRelatedByTargetTemplate(); + } + + + return $list; + } + + function getInheritedCommandWithParameters($cmdObj = null) { + $self = false; + if($cmdObj === null) { + $self = true; + // Initialize array + $cmdObj = array( + 'command' => null, + 'parameters' => array() + ); + } + $inheritedTemplates = $this->getNagiosHostTemplateInheritances(); + // Inheritedtemplates is our collection of templates that we directly inherit from. Let's grab 'em + foreach($inheritedTemplates as $template) { + $cmdObj = $template->getInheritedCommandWithParameters($cmdObj); + } + // Okay, let's check ourselves + if($this->getNagiosCommandRelatedByCheckCommand()) { + $cmdObj['command'] = array('inherited' => ($self ? false : true), + 'source' => $this, + 'command' => $this->getNagiosCommandRelatedByCheckCommand()); + } + $parameters = $this->getNagiosHostCheckCommandParameters(); + foreach($parameters as $param) { + $cmdObj['parameters'][] = array( + 'inherited' => ($self ? false : true), + 'source' => $this, + 'parameter' => $param + ); + } + return $cmdObj; + } + + function addCheckCommandParameter($value) { + $parameter = new NagiosHostCheckCommandParameter(); + $parameter->setNagiosHostTemplate($this); + $parameter->setParameter($value); + $parameter->save(); + return true; + } + + + function setCheckCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByCheckCommand($command); + $this->save(); + return true; + } + + function setCheckPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByCheckPeriod($command); + $this->save(); + return true; + } + + function setEventHandlerByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByEventHandler($command); + $this->save(); + return true; + } + function setNotificationPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByNotificationPeriod($command); + $this->save(); + return true; + } + + function addParentByName($name) { + $parentId = $this->getParentHost(); + + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $name); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) + return false; + + if(empty($parentId)) { + $this->setParentHost($host->getId()); + return true; + } + // Okay, let's first see if there's a parent relationship around + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->getId()); + $c->add(NagiosHostParentPeer::PARENT_HOST, $host->getId()); + $relationship = NagiosHostParentPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + // Okay, relationship doesn't exist, let's add it! + $relationship = new NagiosHostParent(); + $relationship->setNagiosHostTemplate($this); + $relationship->setNagiosHostRelatedByParentHost($host); + $relationship->save(); + return true; + } + + function addHostgroupByName($name) { + $c = new Criteria(); + $c->add(NagiosHostgroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $hostgroup = NagiosHostgroupPeer::doSelectOne($c); + if(!$hostgroup) { + return false; + } + // Okay, hostgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->getId()); + $c->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $hostgroup->getId()); + $relationship = NagiosHostgroupMembershipPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosHostgroupMembership(); + $relationship->setNagiosHostTemplate($this); + $relationship->setNagiosHostgroup($hostgroup); + $relationship->save(); + return true; + } + + function addContactByName($name) { + $c = new Criteria(); + $c->add(NagiosContactPeer::NAME, $name); + $c->setIgnoreCase(true); + $contact = NagiosContactPeer::doSelectOne($c); + if(!$contact) + return false; + // Okay, contact is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostContactMemberPeer::TEMPLATE, $this->getId()); + $c->add(NagiosHostContactMemberPeer::CONTACT, $contact->getId()); + $relationship = NagiosHostContactMemberPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosHostContactMember(); + $relationship->setNagiosHostTemplate($this); + $relationship->setNagiosContact($contact); + $relationship->save(); + return true; + } + + function addContactGroupByName($name) { + $c = new Criteria(); + $c->add(NagiosContactGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $contactgroup = NagiosContactGroupPeer::doSelectOne($c); + if(!$contactgroup) { + return false; + } + // Okay, contactgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->getId()); + $c->add(NagiosHostContactgroupPeer::CONTACTGROUP, $contactgroup->getId()); + $relationship = NagiosHostContactgroupPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosHostContactgroup(); + $relationship->setNagiosHostTemplate($this); + $relationship->setNagiosContactGroup($contactgroup); + $relationship->save(); + return true; + } + function integrityCheck() { + // Get our services + $services = $this->getNagiosServices(); + foreach($services as $service) { + $service->integrityCheck(); + } + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosHostTemplateInheritancePeer::ORDER); + $inheritanceTemplates = NagiosHostTemplateInheritancePeer::doSelect($c); + foreach($inheritanceTemplates as $inheritance) { + $template = $inheritance->getNagiosHostTemplateRelatedByTargetTemplate(); + $template->integrityCheck(); + } + } + + function addTemplateInheritance($name) { + // First get the template by name + $template = NagiosHostTemplatePeer::getByName($name); + if(!$template) { + return false; + } + // Check to see if inheritance already exists + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $template->getId()); + $relationship = NagiosHostTemplateInheritancePeer::doSelectOne($c); + if($relationship) { + return false; + } + } + // Okay, create new one + $relationship = new NagiosHostTemplateInheritance(); + $relationship->setNagiosHostTemplateRelatedBySourceTemplate($this); + $relationship->setNagiosHostTemplateRelatedByTargetTemplate($template); + $relationship->save(); + return true; + } + + function getNagiosHostCheckCommandParameters($criteria = null, PropelPDO $con = null) { + if($criteria == null) + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(NagiosHostCheckCommandParameterPeer::ID); + return parent::getNagiosHostCheckCommandParameters($criteria); + } + +} // NagiosHostTemplate diff --git a/classes/NagiosHostTemplateAutodiscoveryService.php b/classes/NagiosHostTemplateAutodiscoveryService.php new file mode 100755 index 0000000..af2b764 --- /dev/null +++ b/classes/NagiosHostTemplateAutodiscoveryService.php @@ -0,0 +1,30 @@ +add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $targetTemplateId); + $inheritances = NagiosHostTemplateInheritancePeer::doSelect($c); + foreach($inheritances as $inheritance) { + if(NagiosHostTemplateInheritance::isCircular($inheritance->getTargetTemplate(), $originalSourceTemplateId)) + return true; + } + } + return false; + } + + public function delete(PropelPDO $con = null) { + parent::delete($con); + // Check our service dependencies + $targetTemplate = $this->getNagiosHostTemplateRelatedByTargetTemplate(); + $targetTemplate->integrityCheck(); + + } + + public function save(PropelPDO $con = null) { + if(NagiosHostTemplateInheritance::isCircular($this->getTargetTemplate(), $this->getSourceTemplate())) { + throw new Exception("Adding that inheritance would create a circular chain."); + } + else { + parent::save($con); // Okay, we've saved + } + } + +} // NagiosHostTemplateInheritance diff --git a/classes/NagiosHostTemplateInheritancePeer.php b/classes/NagiosHostTemplateInheritancePeer.php new file mode 100755 index 0000000..1eedf19 --- /dev/null +++ b/classes/NagiosHostTemplateInheritancePeer.php @@ -0,0 +1,21 @@ +add(NagiosHostTemplatePeer::NAME, $name); + $c->setIgnoreCase(true); + $template = NagiosHostTemplatePeer::doSelectOne($c); + if(!$template) { + return false; + } + return $template; + } + +} // NagiosHostTemplatePeer diff --git a/classes/NagiosHostgroup.php b/classes/NagiosHostgroup.php new file mode 100755 index 0000000..457e860 --- /dev/null +++ b/classes/NagiosHostgroup.php @@ -0,0 +1,110 @@ +add(NagiosHostgroupMembershipPeer::HOST, NULL, Criteria::ISNOTNULL); + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->getId()); + $memberships = NagiosHostgroupMembershipPeer::doSelect($criteria); + foreach($memberships as $member) { + $host = $member->getNagiosHost(); + if(!array_key_exists($host->getName(), $members)) { + $members[$host->getName()] = $host; + } + } + $criteria = new Criteria(); + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, NULL, Criteria::ISNOTNULL); + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->getId()); + $memberships = NagiosHostgroupMembershipPeer::doSelect($criteria); + foreach($memberships as $member) { + $template = $member->getNagiosHostTemplate(); + $members = $template->getAffectedHosts($members); + } + return $members; + } + + public function addMembersByHostgroup($name) { + // First get hostgroup + $hostgroup = NagiosHostgroupPeer::getByName($name); + if(!$hostgroup) { + return false; + } + // Get the members + $memberships = $hostgroup->getNagiosHostgroupMemberships(); + foreach($memberships as $membership) { + $host = $membership->getNagiosHost(); + // Check to see if we already have this in our member list + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->getId()); + $c->add(NagiosHostgroupMembershipPeer::HOST, $host->getId()); + $relationship = NagiosHostgroupMembershipPeer::doSelectOne($c); + if($relationship) + continue; + } + // Create new relationship + $relationship = new NagiosHostgroupMembership(); + $relationship->setNagiosHost($host); + $relationship->setNagiosHostgroup($this); + $relationship->save(); + } + return true; + } + + public function addMemberByName($name) { + // Support for adding ALL hosts + if($name == "*") { + $hosts = NagiosHostPeer::doSelect(new Criteria()); + foreach($hosts as $host) { + $this->addMemberByName($host->getName()); + } + return true; + } + $host = NagiosHostPeer::getByName($name); + if(!$host) { + return false; + } + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->getId()); + $c->add(NagiosHostgroupMembershipPeer::HOST, $host->getId()); + $relationship = NagiosHostgroupMembershipPeer::doSelectOne($c); + if($relationship) + return true; // Already exists. + } + // Create new relationship + $relationship = new NagiosHostgroupMembership(); + $relationship->setNagiosHost($host); + $relationship->setNagiosHostgroup($this); + $relationship->save(); + return true; + } + +} // NagiosHostgroup diff --git a/classes/NagiosHostgroupMembership.php b/classes/NagiosHostgroupMembership.php new file mode 100755 index 0000000..823d1f6 --- /dev/null +++ b/classes/NagiosHostgroupMembership.php @@ -0,0 +1,23 @@ +add(NagiosHostgroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $hostgroup = NagiosHostgroupPeer::doSelectOne($c); + if(!$hostgroup) + return false; + return $hostgroup; + } + +} // NagiosHostgroupPeer diff --git a/classes/NagiosMainConfiguration.php b/classes/NagiosMainConfiguration.php new file mode 100755 index 0000000..1757e9f --- /dev/null +++ b/classes/NagiosMainConfiguration.php @@ -0,0 +1,122 @@ +$method(); + if($val !== null) { + $values[$fieldName] = array(); + + $values[$fieldName]['value'] = $val; + $values[$fieldName]['source']['id'] = null; + $values[$fieldName]['inherited'] = false; + } + } + return $values; + } + + public function setGlobalHostEventHandlerByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setGlobalHostEventHandler($command->getId()); + return true; + } + return false; + } + + public function setGlobalServiceEventHandlerByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setGlobalServiceEventHandler($command->getId()); + return true; + } + return false; + } + + public function setHostPerfdataCommandByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setHostPerfdataCommand($command->getId()); + return true; + } + return false; + } + + public function setServicePerfdataCommandByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setServicePerfdataCommand($command->getId()); + return true; + } + return false; + } + + public function setHostPerfdataFileProcessingCommandByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setHostPerfdataFileProcessingCommand($command->getId()); + return true; + } + return false; + } + + public function setServicePerfdataFileProcessingCommandByName($command_name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if($command) { + $this->setServicePerfdataFileProcessingCommand($command->getId()); + return true; + } + return false; + } + + +} // NagiosMainConfiguration diff --git a/classes/NagiosMainConfigurationPeer.php b/classes/NagiosMainConfigurationPeer.php new file mode 100755 index 0000000..fc2ac39 --- /dev/null +++ b/classes/NagiosMainConfigurationPeer.php @@ -0,0 +1,27 @@ +getNagiosHost()) { + return "Host " . $this->getNagiosHost()->getName(); + } + else { + if($this->getNagiosHostTemplate()) { + return "Host Template " . $this->getNagiosHostTemplate()->getName(); + } + else { + if($this->getNagiosHostgroup()) { + return "Hostgroup " . $this->getNagiosHostgroup()->getName(); + } + } + } + return null; + } + + public function getValues($inherited = false) { + $values = array(); + + $c = new Criteria(); + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosServiceTemplateInheritancePeer::ORDER); + + $inheritanceTemplates = NagiosServiceTemplateInheritancePeer::doSelect($c); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $inheritanceItem) { + $serviceTemplate = $inheritanceItem->getNagiosServiceTemplateRelatedByTargetTemplate(); + $templateValues = $serviceTemplate->getValues(true); + $values = array_merge($values, $templateValues); + } + } + foreach(NagiosServicePeer::getFieldNames() as $fieldName) { + $colName = NagiosServicePeer::translateFieldName($fieldName, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); + // At this point, $fieldName is the fieldname for each column in our table record + $colName = strtolower(substr($colName, strlen("nagios_service."))); + // $colName is now the abbreviated column name. + + switch($colName) { + case 'maximum_check_attempts': + $colName = 'max_check_attempts'; + break; + } + $methodName = "get" . $fieldName; + if(method_exists($this, $methodName)) { + $val = $this->{$methodName}(); + + + if($val !== null) { + + // Yay, let's populate + $values[$colName] = array( + 'inherited' => $inherited, + 'source' => array('id' => $this->getId(), 'name' => $this->getDescription()), + 'value' => $val + ); + } + } + + } + return $values; + } + + function getInheritedCommandParameters($self = true) { + $parameterList = array(); + + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $parameters = $serviceTemplate->getInheritedCommandParameters(false); + $parameterList = array_merge($parameterList, $parameters); + } + } + if(!$self) { + $parameters = $this->getNagiosServiceCheckCommandParameters(); + array_merge($parameterList, $parameters); + } + return $parameterList; + } + + function getInheritedDependencies($self = true) { + $dependenciesList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $dependencies = $serviceTemplate->getInheritedDependencies(false); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + } + if(!$self) { + $dependencies = $this->getNagiosDependencys(); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + return $dependenciesList; + } + + function getInheritedEscalations($self = true) { + $escalationsList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $escalations = $serviceTemplate->getInheritedEscalations(false); + $escalationsList = array_merge($escalationsList, $escalations); + } + } + if(!$self) { + $escalations = $this->getNagiosEscalations(); + $escalationsList = array_merge($escalationsList, $escalations); + } + return $escalationsList; + } + + function getInheritedServiceGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $servicegroup = $serviceTemplate->getInheritedServiceGroups(false); + $groupList = array_merge($groupList, $servicegroup); + } + } + if(!$self) { + $servicegroupMemberships = $this->getNagiosServiceGroupMembers(); + foreach($servicegroupMemberships as $membership) { + $servicegroup = $membership->getNagiosServiceGroup(); + $groupList[] = $servicegroup; + } + } + return $groupList; + } + + function getInheritedContacts($self = true) { + $contactsList = array(); + + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $contacts = $serviceTemplate->getInheritedContacts(false); + $contactsList = array_merge($contactsList, $contacts); + } + } + if(!$self) { + $contactMemberships = $this->getNagiosServiceContactMembers(); + foreach($contactMemberships as $membership) { + $contact = $membership->getNagiosContact(); + $contactsList[] = $contact; + } + } + return $contactsList; + } + + + function getInheritedContactGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $contactgroups = $serviceTemplate->getInheritedContactGroups(false); + $groupList = array_merge($groupList, $contactgroups); + } + } + if(!$self) { + $contatgroupMemberships = $this->getNagiosServiceContactGroupMembers(); + foreach($contatgroupMemberships as $membership) { + $contactgroup = $membership->getNagiosContactGroup(); + $groupList[] = $contactgroup; + } + } + return $groupList; + } + + function addCheckCommandParameter($value) { + $parameter = new NagiosServiceCheckCommandParameter(); + $parameter->setNagiosService($this); + $parameter->setParameter($value); + $parameter->save(); + return true; + } + + + function getInheritedCommandWithParameters($cmdObj = null) { + $self = false; + if($cmdObj === null) { + $self = true; + // Initialize array + $cmdObj = array( + 'command' => null, + 'parameters' => array() + ); + } + $inheritedTemplates = $this->getNagiosServiceTemplateInheritances(); + // Inheritedtemplates is our collection of templates that we directly inherit from. Let's grab 'em + foreach($inheritedTemplates as $template) { + $cmdObj = $template->getInheritedCommandWithParameters($cmdObj); + } + // Okay, let's check ourselves + if($this->getNagiosCommandRelatedByCheckCommand()) { + $cmdObj['command'] = array('inherited' => ($self ? false : true), + 'source' => $this, + 'command' => $this->getNagiosCommandRelatedByCheckCommand()); + } + $parameters = $this->getNagiosServiceCheckCommandParameters(); + foreach($parameters as $param) { + $cmdObj['parameters'][] = array( + 'inherited' => ($self ? false : true), + 'source' => $this, + 'parameter' => $param + ); + } + return $cmdObj; + } + + function getNagiosServiceTemplateInheritances() { + $c = new Criteria(); + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE , $this->getId()); + $c->addAscendingOrderByColumn(NagiosServiceTemplateInheritancePeer::ORDER); + + $list = array(); + $inheritanceTemplates = NagiosServiceTemplateInheritancePeer::doSelect($c); + foreach($inheritanceTemplates as $inheritanceItem) { + $list[] = $inheritanceItem->getNagiosServiceTemplateRelatedByTargetTemplate(); + } + + + return $list; + } + + function integrityCheck() { + // Get NagiosDependencyTargets with Target service being this service + $c = new Criteria(); + $c->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->getId()); + $targets = NagiosDependencyTargetPeer::doSelect($c); + foreach($targets as $target) { + $found = false; + // Get host + $host = $target->getNagiosHost(); + $services = $host->getNagiosServices(); + foreach($services as $service) { + if($service->getId() == $this->getId()) { + $found = true; + break; + } + } + if(!$found) { + $services = $host->getInheritedServices(); + foreach($services as $service) { + if($service->getId() == $this->getId()) { + $found = true; + break; + } + } + } + if(!$found) { + $target->delete(); + } + } + } + + function setCheckCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByCheckCommand($command); + $this->save(); + return true; + } + + function setCheckPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByCheckPeriod($command); + $this->save(); + return true; + } + + function setEventHandlerByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByEventHandler($command); + $this->save(); + return true; + } + function setNotificationPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByNotificationPeriod($command); + $this->save(); + return true; + } + + function addServicegroupByName($name) { + $c = new Criteria(); + $c->add(NagiosServiceGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $servicegroup = NagiosServiceGroupPeer::doSelectOne($c); + if(!$servicegroup) { + return false; + } + // Okay, servicegroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceGroupMemberPeer::SERVICE, $this->getId()); + $c->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $servicegroup->getId()); + $relationship = NagiosServiceGroupMemberPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosServiceGroupMember(); + $relationship->setNagiosService($this); + $relationship->setNagiosServiceGroup($servicegroup); + $relationship->save(); + return true; + } + + function addContactByName($name) { + $c = new Criteria(); + $c->add(NagiosContactPeer::NAME, $name); + $c->setIgnoreCase(true); + $contact = NagiosContactPeer::doSelectOne($c); + if(!$contact) + return false; + // Okay, contact is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceContactMemberPeer::SERVICE, $this->getId()); + $c->add(NagiosServiceContactMemberPeer::CONTACT, $contact->getId()); + $relationship = NagiosServiceContactMemberPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosServiceContactMember(); + $relationship->setNagiosService($this); + $relationship->setNagiosContact($contact); + $relationship->save(); + return true; + } + + function addContactGroupByName($name) { + $c = new Criteria(); + $c->add(NagiosContactGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $contactgroup = NagiosContactGroupPeer::doSelectOne($c); + if(!$contactgroup) { + return false; + } + // Okay, contactgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->getId()); + $c->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $contactgroup->getId()); + $relationship = NagiosServiceContactGroupMemberPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosServiceContactGroupMember(); + $relationship->setNagiosService($this); + $relationship->setNagiosContactGroup($contactgroup); + $relationship->save(); + return true; + } + + function addTemplateInheritance($name) { + // First get the template by name + $template = NagiosServiceTemplatePeer::getByName($name); + if(!$template) { + return false; + } + // Check to see if inheritance already exists + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->getId()); + $c->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $template->getId()); + $relationship = NagiosServiceTemplateInheritancePeer::doSelectOne($c); + if($relationship) { + return false; + } + } + // Okay, create new one + $relationship = new NagiosServiceTemplateInheritance(); + $relationship->setNagiosService($this); + $relationship->setNagiosServiceTemplateRelatedByTargetTemplate($template); + $relationship->save(); + return true; + } + + function getNagiosServiceCheckCommandParameters($criteria = null, PropelPDO $con = null) { + if($criteria == null) + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(NagiosServiceCheckCommandParameterPeer::ID); + return parent::getNagiosServiceCheckCommandParameters($criteria); + } + +} // NagiosService diff --git a/classes/NagiosServiceCheckCommandParameter.php b/classes/NagiosServiceCheckCommandParameter.php new file mode 100755 index 0000000..f91ef0d --- /dev/null +++ b/classes/NagiosServiceCheckCommandParameter.php @@ -0,0 +1,23 @@ +add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->getId()); + $c->add(NagiosServiceGroupMemberPeer::SERVICE, $service->getId()); + $membership = NagiosServiceGroupMemberPeer::doSelectOne($c); + if($membership) + return true; + $membership = new NagiosServiceGroupMember(); + $membership->setNagiosServiceGroup($this); + $membership->setNagiosService($service); + $membership->save(); + return true; + } + + public function addMembersByServiceGroup($name) { + // First get servicegroup + $servicegroup = NagiosServiceGroupPeer::getByName($name); + if(!$servicegroup) { + return false; + } + // Get the members + $memberships = $servicegroup->getNagiosServiceGroupMembers(); + foreach($memberships as $membership) { + $service = $membership->getNagiosService(); + // Check to see if we already have this in our member list + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->getId()); + $c->add(NagiosServiceGroupMemberPeer::SERVICE, $service->getId()); + $relationship = NagiosServiceGroupMemberPeer::doSelectOne($c); + if($relationship) + continue; + } + // Create new relationship + $relationship = new NagiosServiceGroupMember(); + $relationship->setNagiosService($service); + $relationship->setNagiosServiceGroup($this); + $relationship->save(); + } + return true; + } + +} // NagiosServiceGroup diff --git a/classes/NagiosServiceGroupMember.php b/classes/NagiosServiceGroupMember.php new file mode 100755 index 0000000..0634356 --- /dev/null +++ b/classes/NagiosServiceGroupMember.php @@ -0,0 +1,23 @@ +add(NagiosServiceGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $servicegroup = NagiosServiceGroupPeer::doSelectOne($c); + if(!$servicegroup) + return false; + return $servicegroup; + } +} // NagiosServiceGroupPeer diff --git a/classes/NagiosServicePeer.php b/classes/NagiosServicePeer.php new file mode 100755 index 0000000..7400372 --- /dev/null +++ b/classes/NagiosServicePeer.php @@ -0,0 +1,89 @@ +getNagiosServices(); + $inheritedServices = $host->getInheritedServices(); + $totalCount += count($inheritedServices); + $totalCount += count($services); + } + return $totalCount; + } + + public static function getByHostAndDescription($hostname, $description) { + // First get host + $host = NagiosHostPeer::getByName($hostname); + if(!$host) + return false; + $c = new Criteria(); + $c->add(NagiosServicePeer::HOST, $host->getId()); + $c->add(NagiosServicePeer::DESCRIPTION, $description); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if(!$service) + return false; + return $service; + } + + public static function getByHostgroupAndDescription($hostgroupname, $description) { + // First get hostgroup + $hostgroup = NagiosHostgroupPeer::getByName($hostgroupname); + if(!$hostgroup) + return false; + $c = new Criteria(); + $c->add(NagiosServicePeer::HOSTGROUP, $hostgroup->getId()); + $c->add(NagiosServicePeer::DESCRIPTION, $description); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if(!$service) + return false; + return $service; + + } + + public static function getByHostTemplateAndDescription($hostTemplateName, $description) { + // First get host template + $template = NagiosHostTemplatePeer::getByName($hostTemplateName); + if(!$template) + return false; + $c = new Criteria(); + $c->add(NagiosServicePeer::HOST_TEMPLATE, $template->getId()); + $c->add(NagiosServicePeer::DESCRIPTION, $description); + $c->setIgnoreCase(true); + $service = NagiosServicePeer::doSelectOne($c); + if(!$service) + return false; + return $service; + } + + +} // NagiosServicePeer diff --git a/classes/NagiosServiceTemplate.php b/classes/NagiosServiceTemplate.php new file mode 100755 index 0000000..2cfcf43 --- /dev/null +++ b/classes/NagiosServiceTemplate.php @@ -0,0 +1,401 @@ +add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosServiceTemplateInheritancePeer::ORDER); + + $inheritanceTemplates = NagiosServiceTemplateInheritancePeer::doSelect($c); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $inheritanceItem) { + $serviceTemplate = $inheritanceItem->getNagiosServiceTemplateRelatedByTargetTemplate(); + $templateValues = $serviceTemplate->getValues(true); + $values = array_merge($values, $templateValues); + } + } + foreach(NagiosServiceTemplatePeer::getFieldNames() as $fieldName) { + $colName = NagiosServiceTemplatePeer::translateFieldName($fieldName, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); + // At this point, $fieldName is the fieldname for each column in our table record + $colName = strtolower(substr($colName, strlen("nagios_service_template."))); + // $colName is now the abbreviated column name. + + switch($colName) { + case 'maximum_check_attempts': + $colName = 'max_check_attempts'; + break; + } + $methodName = "get" . $fieldName; + if(method_exists($this, $methodName)) { + $val = $this->{$methodName}(); + + if($val !== null) { + + // Yay, let's populate + $values[$colName] = array( + 'inherited' => $inherited, + 'source' => array('id' => $this->getId(), 'name' => $this->getName()), + 'value' => $val + ); + } + } + + } + return $values; + } + + function getInheritedCommandParameters($self = true) { + $parameterList = array(); + + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $parameters = $serviceTemplate->getInheritedCommandParameters(false); + $parameterList = array_merge($parameterList, $parameters); + } + } + if(!$self) { + $parameters = $this->getNagiosServiceCheckCommandParameters(); + array_merge($parameterList, $parameters); + } + return $parameterList; + } + + function getInheritedDependencies($self = true) { + $dependenciesList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $dependencies = $serviceTemplate->getInheritedDependencies(false); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + } + if(!$self) { + $dependencies = $this->getNagiosDependencys(); + $dependenciesList = array_merge($dependenciesList, $dependencies); + } + return $dependenciesList; + } + + function getInheritedEscalations($self = true) { + $escalationsList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $escalations = $serviceTemplate->getInheritedEscalations(false); + $escalationsList = array_merge($escalationsList, $escalations); + } + } + if(!$self) { + $escalations = $this->getNagiosEscalations(); + $escalationsList = array_merge($escalationsList, $escalations); + } + return $escalationsList; + } + + function getInheritedServiceGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $servicegroup = $serviceTemplate->getInheritedServiceGroups(false); + $groupList = array_merge($groupList, $servicegroup); + } + } + if(!$self) { + $servicegroupMemberships = $this->getNagiosServiceGroupMembers(); + foreach($servicegroupMemberships as $membership) { + $servicegroup = $membership->getNagiosServiceGroup(); + $groupList[] = $servicegroup; + } + } + return $groupList; + } + + function getInheritedContactGroups($self = true) { + $groupList = array(); + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $contactgroups = $serviceTemplate->getInheritedContactGroups(false); + $groupList = array_merge($groupList, $contactgroups); + } + } + if(!$self) { + $contatgroupMemberships = $this->getNagiosServiceContactGroupMembers(); + foreach($contatgroupMemberships as $membership) { + $contactgroup = $membership->getNagiosContactGroup(); + $groupList[] = $contactgroup; + } + } + return $groupList; + } + + function getInheritedContacts($self = true) { + $contactsList = array(); + + $inheritanceTemplates = $this->getNagiosServiceTemplateInheritances(); + + if(count($inheritanceTemplates)) { + // This template has inherited templates, let's bring their values in + foreach($inheritanceTemplates as $serviceTemplate) { + $contacts = $serviceTemplate->getInheritedContacts(false); + $contactsList = array_merge($contactsList, $contacts); + } + } + if(!$self) { + $contactMemberships = $this->getNagiosServiceContactMembers(); + foreach($contactMemberships as $membership) { + $contact = $membership->getNagiosContact(); + $contactsList[] = $contact; + } + } + return $contactsList; + } + + function getNagiosServiceTemplateInheritances() { + $c = new Criteria(); + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->addAscendingOrderByColumn(NagiosServiceTemplateInheritancePeer::ORDER); + + $list = array(); + $inheritanceTemplates = NagiosServiceTemplateInheritancePeer::doSelect($c); + foreach($inheritanceTemplates as $inheritanceItem) { + $list[] = $inheritanceItem->getNagiosServiceTemplateRelatedByTargetTemplate(); + } + + + return $list; + } + + function addCheckCommandParameter($value) { + $parameter = new NagiosServiceCheckCommandParameter(); + $parameter->setNagiosServiceTemplate($this); + $parameter->setParameter($value); + $parameter->save(); + return true; + } + + function getInheritedCommandWithParameters($cmdObj = null) { + $self = false; + if($cmdObj === null) { + $self = true; + // Initialize array + $cmdObj = array( + 'command' => null, + 'parameters' => array() + ); + } + $inheritedTemplates = $this->getNagiosServiceTemplateInheritances(); + // Inheritedtemplates is our collection of templates that we directly inherit from. Let's grab 'em + foreach($inheritedTemplates as $template) { + $cmdObj = $template->getInheritedCommandWithParameters($cmdObj); + } + // Okay, let's check ourselves + if($this->getNagiosCommandRelatedByCheckCommand()) { + $cmdObj['command'] = array('inherited' => ($self ? false : true), + 'source' => $this, + 'command' => $this->getNagiosCommandRelatedByCheckCommand()); + } + $parameters = $this->getNagiosServiceCheckCommandParameters(); + foreach($parameters as $param) { + $cmdObj['parameters'][] = array( + 'inherited' => ($self ? false : true), + 'source' => $this, + 'parameter' => $param + ); + } + return $cmdObj; + } + + function setCheckCommandByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByCheckCommand($command); + $this->save(); + return true; + } + + function setCheckPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByCheckPeriod($command); + $this->save(); + return true; + } + + function setEventHandlerByName($name) { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosCommandPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosCommandRelatedByEventHandler($command); + $this->save(); + return true; + } + function setNotificationPeriodByName($name) { + $c = new Criteria(); + $c->add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $command = NagiosTimeperiodPeer::doSelectOne($c); + if(!$command) + return false; + $this->setNagiosTimeperiodRelatedByNotificationPeriod($command); + $this->save(); + return true; + } + + function addServicegroupByName($name) { + $c = new Criteria(); + $c->add(NagiosServiceGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $servicegroup = NagiosServiceGroupPeer::doSelectOne($c); + if(!$servicegroup) { + return false; + } + // Okay, servicegroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->getId()); + $c->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $servicegroup->getId()); + $relationship = NagiosServiceGroupMemberPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosServiceGroupMember(); + $relationship->setNagiosServiceTemplate($this); + $relationship->setNagiosServiceGroup($servicegroup); + $relationship->save(); + return true; + } + + function addContactByName($name) { + $c = new Criteria(); + $c->add(NagiosContactPeer::NAME, $name); + $c->setIgnoreCase(true); + $contact = NagiosContactPeer::doSelectOne($c); + if(!$contact) + return false; + // Okay, contact is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->getId()); + $c->add(NagiosServiceContactMemberPeer::CONTACT, $contact->getId()); + $relationship = NagiosServiceContactMemberPeer::doSelectOne($c); + if($relationship) + return false; + } + $relationship = new NagiosServiceContactMember(); + $relationship->setNagiosServiceTemplate($this); + $relationship->setNagiosContact($contact); + $relationship->save(); + return true; + } + + function addContactGroupByName($name) { + $c = new Criteria(); + $c->add(NagiosContactGroupPeer::NAME, $name); + $c->setIgnoreCase(true); + $contactgroup = NagiosContactGroupPeer::doSelectOne($c); + if(!$contactgroup) { + return false; + } + // Okay, contactgroup is valid, check for relationship + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->getId()); + $c->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $contactgroup->getId()); + $relationship = NagiosServiceContactGroupMemberPeer::doSelectOne($c); + if($relationship) { + return false; + } + } + $relationship = new NagiosServiceContactGroupMember(); + $relationship->setNagiosServiceTemplate($this); + $relationship->setNagiosContactGroup($contactgroup); + $relationship->save(); + return true; + } + + function addTemplateInheritance($name) { + // First get the template by name + $template = NagiosServiceTemplatePeer::getByName($name); + if(!$template) { + return false; + } + // Check to see if inheritance already exists + $id = $this->getId(); + if(!empty($id)) { + $c = new Criteria(); + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->getId()); + $c->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $template->getId()); + $relationship = NagiosServiceTemplateInheritancePeer::doSelectOne($c); + if($relationship) { + return false; + } + } + // Okay, create new one + $relationship = new NagiosServiceTemplateInheritance(); + $relationship->setNagiosServiceTemplateRelatedBySourceTemplate($this); + $relationship->setNagiosServiceTemplateRelatedByTargetTemplate($template); + $relationship->save(); + return true; + } + + function getNagiosServiceCheckCommandParameters($criteria = null, PropelPDO $con = null) { + if($criteria == null) + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(NagiosServiceCheckCommandParameterPeer::ID); + return parent::getNagiosServiceCheckCommandParameters($criteria); + } + + + +} // NagiosServiceTemplate diff --git a/classes/NagiosServiceTemplateInheritance.php b/classes/NagiosServiceTemplateInheritance.php new file mode 100755 index 0000000..1e0fb36 --- /dev/null +++ b/classes/NagiosServiceTemplateInheritance.php @@ -0,0 +1,66 @@ +add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $targetTemplateId); + $inheritances = NagiosServiceTemplateInheritancePeer::doSelect($c); + foreach($inheritances as $inheritance) { + if(NagiosServiceTemplateInheritance::isCircular($inheritance->getTargetTemplate(), $originalSourceTemplateId)) + return true; + } + } + return false; + } + + public function save(PropelPDO $con = null) { + if(NagiosServiceTemplateInheritance::isCircular($this->getTargetTemplate(), $this->getSourceTemplate())) { + throw new Exception("Adding that inheritance would create a circular chain."); + } + else { + parent::save($con); // Okay, we've saved + } + } + +} // NagiosServiceTemplateInheritance diff --git a/classes/NagiosServiceTemplateInheritancePeer.php b/classes/NagiosServiceTemplateInheritancePeer.php new file mode 100755 index 0000000..6e5d10d --- /dev/null +++ b/classes/NagiosServiceTemplateInheritancePeer.php @@ -0,0 +1,19 @@ +add(NagiosServiceTemplatePeer::NAME, $name); + $c->setIgnoreCase(true); + $template = NagiosServiceTemplatePeer::doSelectOne($c); + if(!$template) { + return false; + } + return $template; + } + +} // NagiosServiceTemplatePeer diff --git a/classes/NagiosTimeperiod.php b/classes/NagiosTimeperiod.php new file mode 100755 index 0000000..9f90660 --- /dev/null +++ b/classes/NagiosTimeperiod.php @@ -0,0 +1,23 @@ +add(NagiosTimeperiodPeer::NAME, $name); + $c->setIgnoreCase(true); + $timeperiod = NagiosTimeperiodPeer::doSelectOne($c); + if(!$timeperiod) + return false; + return $timeperiod; + } + +} // NagiosTimeperiodPeer diff --git a/classes/map/AutodiscoveryDeviceMapBuilder.php b/classes/map/AutodiscoveryDeviceMapBuilder.php new file mode 100755 index 0000000..0545268 --- /dev/null +++ b/classes/map/AutodiscoveryDeviceMapBuilder.php @@ -0,0 +1,89 @@ +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(AutodiscoveryDevicePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(AutodiscoveryDevicePeer::TABLE_NAME); + $tMap->setPhpName('AutodiscoveryDevice'); + $tMap->setClassname('AutodiscoveryDevice'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('JOB_ID', 'JobId', 'INTEGER', 'autodiscovery_job', 'ID', true, null); + + $tMap->addColumn('ADDRESS', 'Address', 'VARCHAR', true, 255); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 255); + + $tMap->addColumn('HOSTNAME', 'Hostname', 'VARCHAR', false, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', false, 255); + + $tMap->addColumn('OSVENDOR', 'Osvendor', 'VARCHAR', false, 255); + + $tMap->addColumn('OSFAMILY', 'Osfamily', 'VARCHAR', false, 255); + + $tMap->addColumn('OSGEN', 'Osgen', 'VARCHAR', false, 255); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', true, null); + + $tMap->addForeignKey('PROPOSED_PARENT', 'ProposedParent', 'INTEGER', 'nagios_host', 'ID', false, null); + + } // doBuild() + +} // AutodiscoveryDeviceMapBuilder diff --git a/classes/map/AutodiscoveryDeviceServiceMapBuilder.php b/classes/map/AutodiscoveryDeviceServiceMapBuilder.php new file mode 100755 index 0000000..735c5c6 --- /dev/null +++ b/classes/map/AutodiscoveryDeviceServiceMapBuilder.php @@ -0,0 +1,83 @@ +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(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(AutodiscoveryDeviceServicePeer::TABLE_NAME); + $tMap->setPhpName('AutodiscoveryDeviceService'); + $tMap->setClassname('AutodiscoveryDeviceService'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('DEVICE_ID', 'DeviceId', 'INTEGER', 'autodiscovery_device', 'ID', true, null); + + $tMap->addColumn('PROTOCOL', 'Protocol', 'VARCHAR', true, 255); + + $tMap->addColumn('PORT', 'Port', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('PRODUCT', 'Product', 'VARCHAR', true, 255); + + $tMap->addColumn('VERSION', 'Version', 'VARCHAR', true, 255); + + $tMap->addColumn('EXTRAINFO', 'Extrainfo', 'VARCHAR', true, 255); + + } // doBuild() + +} // AutodiscoveryDeviceServiceMapBuilder diff --git a/classes/map/AutodiscoveryDeviceTemplateMatchMapBuilder.php b/classes/map/AutodiscoveryDeviceTemplateMatchMapBuilder.php new file mode 100755 index 0000000..5c15707 --- /dev/null +++ b/classes/map/AutodiscoveryDeviceTemplateMatchMapBuilder.php @@ -0,0 +1,77 @@ +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(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + $tMap->setPhpName('AutodiscoveryDeviceTemplateMatch'); + $tMap->setClassname('AutodiscoveryDeviceTemplateMatch'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('DEVICE_ID', 'DeviceId', 'INTEGER', 'autodiscovery_device', 'ID', true, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', true, null); + + $tMap->addColumn('PERCENT', 'Percent', 'FLOAT', true, null); + + $tMap->addColumn('COMPLEXITY', 'Complexity', 'INTEGER', true, null); + + } // doBuild() + +} // AutodiscoveryDeviceTemplateMatchMapBuilder diff --git a/classes/map/AutodiscoveryJobMapBuilder.php b/classes/map/AutodiscoveryJobMapBuilder.php new file mode 100755 index 0000000..5b22b00 --- /dev/null +++ b/classes/map/AutodiscoveryJobMapBuilder.php @@ -0,0 +1,89 @@ +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(AutodiscoveryJobPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(AutodiscoveryJobPeer::TABLE_NAME); + $tMap->setPhpName('AutodiscoveryJob'); + $tMap->setClassname('AutodiscoveryJob'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', true, 255); + + $tMap->addColumn('CONFIG', 'Config', 'LONGVARCHAR', true, null); + + $tMap->addColumn('START_TIME', 'StartTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('END_TIME', 'EndTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATUS', 'Status', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUS_CODE', 'StatusCode', 'INTEGER', true, null); + + $tMap->addColumn('STATUS_CHANGE_TIME', 'StatusChangeTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATS', 'Stats', 'LONGVARCHAR', true, null); + + $tMap->addColumn('CMD', 'Cmd', 'VARCHAR', false, 255); + + } // doBuild() + +} // AutodiscoveryJobMapBuilder diff --git a/classes/map/AutodiscoveryLogEntryMapBuilder.php b/classes/map/AutodiscoveryLogEntryMapBuilder.php new file mode 100755 index 0000000..d810743 --- /dev/null +++ b/classes/map/AutodiscoveryLogEntryMapBuilder.php @@ -0,0 +1,77 @@ +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(AutodiscoveryLogEntryPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(AutodiscoveryLogEntryPeer::TABLE_NAME); + $tMap->setPhpName('AutodiscoveryLogEntry'); + $tMap->setClassname('AutodiscoveryLogEntry'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('JOB', 'Job', 'INTEGER', 'autodiscovery_job', 'ID', false, null); + + $tMap->addColumn('TIME', 'Time', 'TIMESTAMP', true, null); + + $tMap->addColumn('TEXT', 'Text', 'LONGVARCHAR', true, null); + + $tMap->addColumn('TYPE', 'Type', 'INTEGER', true, null); + + } // doBuild() + +} // AutodiscoveryLogEntryMapBuilder diff --git a/classes/map/ExportJobMapBuilder.php b/classes/map/ExportJobMapBuilder.php new file mode 100755 index 0000000..825ca27 --- /dev/null +++ b/classes/map/ExportJobMapBuilder.php @@ -0,0 +1,89 @@ +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(ExportJobPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ExportJobPeer::TABLE_NAME); + $tMap->setPhpName('ExportJob'); + $tMap->setClassname('ExportJob'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', true, 255); + + $tMap->addColumn('CONFIG', 'Config', 'LONGVARCHAR', true, null); + + $tMap->addColumn('START_TIME', 'StartTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('END_TIME', 'EndTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATUS', 'Status', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUS_CODE', 'StatusCode', 'INTEGER', true, null); + + $tMap->addColumn('STATUS_CHANGE_TIME', 'StatusChangeTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATS', 'Stats', 'LONGVARCHAR', true, null); + + $tMap->addColumn('CMD', 'Cmd', 'VARCHAR', false, 255); + + } // doBuild() + +} // ExportJobMapBuilder diff --git a/classes/map/ExportLogEntryMapBuilder.php b/classes/map/ExportLogEntryMapBuilder.php new file mode 100755 index 0000000..dfda1e9 --- /dev/null +++ b/classes/map/ExportLogEntryMapBuilder.php @@ -0,0 +1,77 @@ +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(ExportLogEntryPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ExportLogEntryPeer::TABLE_NAME); + $tMap->setPhpName('ExportLogEntry'); + $tMap->setClassname('ExportLogEntry'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('JOB', 'Job', 'INTEGER', 'export_job', 'ID', false, null); + + $tMap->addColumn('TIME', 'Time', 'TIMESTAMP', true, null); + + $tMap->addColumn('TEXT', 'Text', 'LONGVARCHAR', true, null); + + $tMap->addColumn('TYPE', 'Type', 'INTEGER', true, null); + + } // doBuild() + +} // ExportLogEntryMapBuilder diff --git a/classes/map/ImportErrorMapBuilder.php b/classes/map/ImportErrorMapBuilder.php new file mode 100755 index 0000000..7be2fed --- /dev/null +++ b/classes/map/ImportErrorMapBuilder.php @@ -0,0 +1,77 @@ +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('lilac'); + + $tMap = $this->dbMap->addTable('import_error'); + $tMap->setPhpName('ImportError'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addForeignKey('JOB', 'Job', 'int', CreoleTypes::INTEGER, 'import_job', 'ID', false, null); + + $tMap->addColumn('TEXT', 'Text', 'string', CreoleTypes::BLOB, false, null); + + $tMap->addColumn('TYPE', 'Type', 'int', CreoleTypes::INTEGER, false, null); + + } // doBuild() + +} // ImportErrorMapBuilder diff --git a/classes/map/ImportJobMapBuilder.php b/classes/map/ImportJobMapBuilder.php new file mode 100755 index 0000000..f447607 --- /dev/null +++ b/classes/map/ImportJobMapBuilder.php @@ -0,0 +1,89 @@ +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(ImportJobPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ImportJobPeer::TABLE_NAME); + $tMap->setPhpName('ImportJob'); + $tMap->setClassname('ImportJob'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', true, 255); + + $tMap->addColumn('CONFIG', 'Config', 'LONGVARCHAR', true, null); + + $tMap->addColumn('START_TIME', 'StartTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('END_TIME', 'EndTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATUS', 'Status', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUS_CODE', 'StatusCode', 'INTEGER', true, null); + + $tMap->addColumn('STATUS_CHANGE_TIME', 'StatusChangeTime', 'TIMESTAMP', false, null); + + $tMap->addColumn('STATS', 'Stats', 'LONGVARCHAR', true, null); + + $tMap->addColumn('CMD', 'Cmd', 'VARCHAR', false, 255); + + } // doBuild() + +} // ImportJobMapBuilder diff --git a/classes/map/ImportLogEntryMapBuilder.php b/classes/map/ImportLogEntryMapBuilder.php new file mode 100755 index 0000000..9c6d153 --- /dev/null +++ b/classes/map/ImportLogEntryMapBuilder.php @@ -0,0 +1,77 @@ +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(ImportLogEntryPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ImportLogEntryPeer::TABLE_NAME); + $tMap->setPhpName('ImportLogEntry'); + $tMap->setClassname('ImportLogEntry'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('JOB', 'Job', 'INTEGER', 'import_job', 'ID', false, null); + + $tMap->addColumn('TIME', 'Time', 'TIMESTAMP', true, null); + + $tMap->addColumn('TEXT', 'Text', 'LONGVARCHAR', true, null); + + $tMap->addColumn('TYPE', 'Type', 'INTEGER', true, null); + + } // doBuild() + +} // ImportLogEntryMapBuilder diff --git a/classes/map/LabelMapBuilder.php b/classes/map/LabelMapBuilder.php new file mode 100755 index 0000000..4758c31 --- /dev/null +++ b/classes/map/LabelMapBuilder.php @@ -0,0 +1,75 @@ +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(LabelPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(LabelPeer::TABLE_NAME); + $tMap->setPhpName('Label'); + $tMap->setClassname('Label'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('SECTION', 'Section', 'VARCHAR', false, 255); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 255); + + $tMap->addColumn('LABEL', 'Label', 'LONGVARCHAR', false, null); + + } // doBuild() + +} // LabelMapBuilder diff --git a/classes/map/LilacConfigurationMapBuilder.php b/classes/map/LilacConfigurationMapBuilder.php new file mode 100755 index 0000000..47df7a9 --- /dev/null +++ b/classes/map/LilacConfigurationMapBuilder.php @@ -0,0 +1,71 @@ +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(LilacConfigurationPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(LilacConfigurationPeer::TABLE_NAME); + $tMap->setPhpName('LilacConfiguration'); + $tMap->setClassname('LilacConfiguration'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('VERSION', 'Version', 'VARCHAR', false, 255); + + } // doBuild() + +} // LilacConfigurationMapBuilder diff --git a/classes/map/ModuleHookMapBuilder.php b/classes/map/ModuleHookMapBuilder.php new file mode 100755 index 0000000..7994be0 --- /dev/null +++ b/classes/map/ModuleHookMapBuilder.php @@ -0,0 +1,73 @@ +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(ModuleHookPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ModuleHookPeer::TABLE_NAME); + $tMap->setPhpName('ModuleHook'); + $tMap->setClassname('ModuleHook'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('MODULE', 'Module', 'INTEGER', 'module', 'ID', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 255); + + } // doBuild() + +} // ModuleHookMapBuilder diff --git a/classes/map/ModuleMapBuilder.php b/classes/map/ModuleMapBuilder.php new file mode 100755 index 0000000..6afbb43 --- /dev/null +++ b/classes/map/ModuleMapBuilder.php @@ -0,0 +1,77 @@ +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(ModulePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(ModulePeer::TABLE_NAME); + $tMap->setPhpName('Module'); + $tMap->setClassname('Module'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addForeignKey('ADD_ON', 'AddOn', 'INTEGER', 'add_on', 'ID', true, null); + + $tMap->addColumn('CLASSNAME', 'Classname', 'VARCHAR', true, 255); + + $tMap->addForeignKey('HOOK', 'Hook', 'INTEGER', 'module_hook', 'ID', false, null); + + } // doBuild() + +} // ModuleMapBuilder diff --git a/classes/map/NagiosBrokerModuleMapBuilder.php b/classes/map/NagiosBrokerModuleMapBuilder.php new file mode 100755 index 0000000..182cca0 --- /dev/null +++ b/classes/map/NagiosBrokerModuleMapBuilder.php @@ -0,0 +1,71 @@ +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(NagiosBrokerModulePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosBrokerModulePeer::TABLE_NAME); + $tMap->setPhpName('NagiosBrokerModule'); + $tMap->setClassname('NagiosBrokerModule'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('LINE', 'Line', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosBrokerModuleMapBuilder diff --git a/classes/map/NagiosCgiConfigurationMapBuilder.php b/classes/map/NagiosCgiConfigurationMapBuilder.php new file mode 100755 index 0000000..69d89f1 --- /dev/null +++ b/classes/map/NagiosCgiConfigurationMapBuilder.php @@ -0,0 +1,125 @@ +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(NagiosCgiConfigurationPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosCgiConfigurationPeer::TABLE_NAME); + $tMap->setPhpName('NagiosCgiConfiguration'); + $tMap->setClassname('NagiosCgiConfiguration'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('PHYSICAL_HTML_PATH', 'PhysicalHtmlPath', 'VARCHAR', false, 255); + + $tMap->addColumn('URL_HTML_PATH', 'UrlHtmlPath', 'VARCHAR', false, 255); + + $tMap->addColumn('USE_AUTHENTICATION', 'UseAuthentication', 'BOOLEAN', false, null); + + $tMap->addColumn('DEFAULT_USER_NAME', 'DefaultUserName', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_SYSTEM_INFORMATION', 'AuthorizedForSystemInformation', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_SYSTEM_COMMANDS', 'AuthorizedForSystemCommands', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_CONFIGURATION_INFORMATION', 'AuthorizedForConfigurationInformation', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_ALL_HOSTS', 'AuthorizedForAllHosts', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_ALL_HOST_COMMANDS', 'AuthorizedForAllHostCommands', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_ALL_SERVICES', 'AuthorizedForAllServices', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTHORIZED_FOR_ALL_SERVICE_COMMANDS', 'AuthorizedForAllServiceCommands', 'VARCHAR', false, 255); + + $tMap->addColumn('LOCK_AUTHOR_NAMES', 'LockAuthorNames', 'BOOLEAN', false, null); + + $tMap->addColumn('STATUSMAP_BACKGROUND_IMAGE', 'StatusmapBackgroundImage', 'VARCHAR', false, 255); + + $tMap->addColumn('DEFAULT_STATUSMAP_LAYOUT', 'DefaultStatusmapLayout', 'TINYINT', false, null); + + $tMap->addColumn('STATUSWRL_INCLUDE', 'StatuswrlInclude', 'VARCHAR', false, 255); + + $tMap->addColumn('DEFAULT_STATUSWRL_LAYOUT', 'DefaultStatuswrlLayout', 'TINYINT', false, null); + + $tMap->addColumn('REFRESH_RATE', 'RefreshRate', 'INTEGER', false, null); + + $tMap->addColumn('HOST_UNREACHABLE_SOUND', 'HostUnreachableSound', 'VARCHAR', false, 255); + + $tMap->addColumn('HOST_DOWN_SOUND', 'HostDownSound', 'VARCHAR', false, 255); + + $tMap->addColumn('SERVICE_CRITICAL_SOUND', 'ServiceCriticalSound', 'VARCHAR', false, 255); + + $tMap->addColumn('SERVICE_WARNING_SOUND', 'ServiceWarningSound', 'VARCHAR', false, 255); + + $tMap->addColumn('SERVICE_UNKNOWN_SOUND', 'ServiceUnknownSound', 'VARCHAR', false, 255); + + $tMap->addColumn('PING_SYNTAX', 'PingSyntax', 'VARCHAR', false, 255); + + $tMap->addColumn('ESCAPE_HTML_TAGS', 'EscapeHtmlTags', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTES_URL_TARGET', 'NotesUrlTarget', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL_TARGET', 'ActionUrlTarget', 'VARCHAR', false, 255); + + $tMap->addColumn('ENABLE_SPLUNK_INTEGRATION', 'EnableSplunkIntegration', 'BOOLEAN', false, null); + + $tMap->addColumn('SPLUNK_URL', 'SplunkUrl', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosCgiConfigurationMapBuilder diff --git a/classes/map/NagiosCommandMapBuilder.php b/classes/map/NagiosCommandMapBuilder.php new file mode 100755 index 0000000..afc1206 --- /dev/null +++ b/classes/map/NagiosCommandMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosCommandPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosCommandPeer::TABLE_NAME); + $tMap->setPhpName('NagiosCommand'); + $tMap->setClassname('NagiosCommand'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('LINE', 'Line', 'LONGVARCHAR', true, null); + + $tMap->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, 255); + + } // doBuild() + +} // NagiosCommandMapBuilder diff --git a/classes/map/NagiosContactAddressMapBuilder.php b/classes/map/NagiosContactAddressMapBuilder.php new file mode 100755 index 0000000..4200066 --- /dev/null +++ b/classes/map/NagiosContactAddressMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosContactAddressPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosContactAddressPeer::TABLE_NAME); + $tMap->setPhpName('NagiosContactAddress'); + $tMap->setClassname('NagiosContactAddress'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('CONTACT', 'Contact', 'INTEGER', 'nagios_contact', 'ID', true, null); + + $tMap->addColumn('ADDRESS', 'Address', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosContactAddressMapBuilder diff --git a/classes/map/NagiosContactGroupMapBuilder.php b/classes/map/NagiosContactGroupMapBuilder.php new file mode 100755 index 0000000..4b1c084 --- /dev/null +++ b/classes/map/NagiosContactGroupMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosContactGroupPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosContactGroupPeer::TABLE_NAME); + $tMap->setPhpName('NagiosContactGroup'); + $tMap->setClassname('NagiosContactGroup'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosContactGroupMapBuilder diff --git a/classes/map/NagiosContactGroupMemberMapBuilder.php b/classes/map/NagiosContactGroupMemberMapBuilder.php new file mode 100755 index 0000000..bea23d6 --- /dev/null +++ b/classes/map/NagiosContactGroupMemberMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosContactGroupMemberPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosContactGroupMemberPeer::TABLE_NAME); + $tMap->setPhpName('NagiosContactGroupMember'); + $tMap->setClassname('NagiosContactGroupMember'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('CONTACT', 'Contact', 'INTEGER', 'nagios_contact', 'ID', true, null); + + $tMap->addForeignKey('CONTACTGROUP', 'Contactgroup', 'INTEGER', 'nagios_contact_group', 'ID', true, null); + + } // doBuild() + +} // NagiosContactGroupMemberMapBuilder diff --git a/classes/map/NagiosContactMapBuilder.php b/classes/map/NagiosContactMapBuilder.php new file mode 100755 index 0000000..c97aae6 --- /dev/null +++ b/classes/map/NagiosContactMapBuilder.php @@ -0,0 +1,111 @@ +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(NagiosContactPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosContactPeer::TABLE_NAME); + $tMap->setPhpName('NagiosContact'); + $tMap->setClassname('NagiosContact'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + $tMap->addColumn('EMAIL', 'Email', 'VARCHAR', false, 255); + + $tMap->addColumn('PAGER', 'Pager', 'VARCHAR', false, 255); + + $tMap->addColumn('HOST_NOTIFICATIONS_ENABLED', 'HostNotificationsEnabled', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATIONS_ENABLED', 'ServiceNotificationsEnabled', 'BOOLEAN', true, null); + + $tMap->addForeignKey('HOST_NOTIFICATION_PERIOD', 'HostNotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_NOTIFICATION_PERIOD', 'ServiceNotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('HOST_NOTIFICATION_ON_DOWN', 'HostNotificationOnDown', 'BOOLEAN', true, null); + + $tMap->addColumn('HOST_NOTIFICATION_ON_UNREACHABLE', 'HostNotificationOnUnreachable', 'BOOLEAN', true, null); + + $tMap->addColumn('HOST_NOTIFICATION_ON_RECOVERY', 'HostNotificationOnRecovery', 'BOOLEAN', true, null); + + $tMap->addColumn('HOST_NOTIFICATION_ON_FLAPPING', 'HostNotificationOnFlapping', 'BOOLEAN', true, null); + + $tMap->addColumn('HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME', 'HostNotificationOnScheduledDowntime', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATION_ON_WARNING', 'ServiceNotificationOnWarning', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATION_ON_UNKNOWN', 'ServiceNotificationOnUnknown', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATION_ON_CRITICAL', 'ServiceNotificationOnCritical', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATION_ON_RECOVERY', 'ServiceNotificationOnRecovery', 'BOOLEAN', true, null); + + $tMap->addColumn('SERVICE_NOTIFICATION_ON_FLAPPING', 'ServiceNotificationOnFlapping', 'BOOLEAN', true, null); + + $tMap->addColumn('CAN_SUBMIT_COMMANDS', 'CanSubmitCommands', 'BOOLEAN', true, null); + + $tMap->addColumn('RETAIN_STATUS_INFORMATION', 'RetainStatusInformation', 'BOOLEAN', true, null); + + $tMap->addColumn('RETAIN_NONSTATUS_INFORMATION', 'RetainNonstatusInformation', 'BOOLEAN', true, null); + + } // doBuild() + +} // NagiosContactMapBuilder diff --git a/classes/map/NagiosContactNotificationCommandMapBuilder.php b/classes/map/NagiosContactNotificationCommandMapBuilder.php new file mode 100755 index 0000000..b368d41 --- /dev/null +++ b/classes/map/NagiosContactNotificationCommandMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosContactNotificationCommandPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosContactNotificationCommandPeer::TABLE_NAME); + $tMap->setPhpName('NagiosContactNotificationCommand'); + $tMap->setClassname('NagiosContactNotificationCommand'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('CONTACT_ID', 'ContactId', 'INTEGER', 'nagios_contact', 'ID', true, null); + + $tMap->addForeignKey('COMMAND', 'Command', 'INTEGER', 'nagios_command', 'ID', true, null); + + $tMap->addColumn('TYPE', 'Type', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosContactNotificationCommandMapBuilder diff --git a/classes/map/NagiosDependencyMapBuilder.php b/classes/map/NagiosDependencyMapBuilder.php new file mode 100755 index 0000000..f41d91d --- /dev/null +++ b/classes/map/NagiosDependencyMapBuilder.php @@ -0,0 +1,117 @@ +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(NagiosDependencyPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosDependencyPeer::TABLE_NAME); + $tMap->setPhpName('NagiosDependency'); + $tMap->setClassname('NagiosDependency'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_TEMPLATE', 'ServiceTemplate', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('HOSTGROUP', 'Hostgroup', 'INTEGER', 'nagios_hostgroup', 'ID', false, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 255); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_UP', 'ExecutionFailureCriteriaUp', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_DOWN', 'ExecutionFailureCriteriaDown', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_UNREACHABLE', 'ExecutionFailureCriteriaUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_PENDING', 'ExecutionFailureCriteriaPending', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_OK', 'ExecutionFailureCriteriaOk', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_WARNING', 'ExecutionFailureCriteriaWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_UNKNOWN', 'ExecutionFailureCriteriaUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTION_FAILURE_CRITERIA_CRITICAL', 'ExecutionFailureCriteriaCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_OK', 'NotificationFailureCriteriaOk', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_WARNING', 'NotificationFailureCriteriaWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_UNKNOWN', 'NotificationFailureCriteriaUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_CRITICAL', 'NotificationFailureCriteriaCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_PENDING', 'NotificationFailureCriteriaPending', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_UP', 'NotificationFailureCriteriaUp', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_DOWN', 'NotificationFailureCriteriaDown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE', 'NotificationFailureCriteriaUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('INHERITS_PARENT', 'InheritsParent', 'BOOLEAN', false, null); + + $tMap->addForeignKey('DEPENDENCY_PERIOD', 'DependencyPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + } // doBuild() + +} // NagiosDependencyMapBuilder diff --git a/classes/map/NagiosDependencyTargetMapBuilder.php b/classes/map/NagiosDependencyTargetMapBuilder.php new file mode 100755 index 0000000..8c989ff --- /dev/null +++ b/classes/map/NagiosDependencyTargetMapBuilder.php @@ -0,0 +1,77 @@ +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(NagiosDependencyTargetPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosDependencyTargetPeer::TABLE_NAME); + $tMap->setPhpName('NagiosDependencyTarget'); + $tMap->setClassname('NagiosDependencyTarget'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('DEPENDENCY', 'Dependency', 'INTEGER', 'nagios_dependency', 'ID', false, null); + + $tMap->addForeignKey('TARGET_HOST', 'TargetHost', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('TARGET_SERVICE', 'TargetService', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('TARGET_HOSTGROUP', 'TargetHostgroup', 'INTEGER', 'nagios_hostgroup', 'ID', false, null); + + } // doBuild() + +} // NagiosDependencyTargetMapBuilder diff --git a/classes/map/NagiosEscalationContactMapBuilder.php b/classes/map/NagiosEscalationContactMapBuilder.php new file mode 100755 index 0000000..df0f8dc --- /dev/null +++ b/classes/map/NagiosEscalationContactMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosEscalationContactPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosEscalationContactPeer::TABLE_NAME); + $tMap->setPhpName('NagiosEscalationContact'); + $tMap->setClassname('NagiosEscalationContact'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('ESCALATION', 'Escalation', 'INTEGER', 'nagios_escalation', 'ID', true, null); + + $tMap->addForeignKey('CONTACT', 'Contact', 'INTEGER', 'nagios_contact', 'ID', true, null); + + } // doBuild() + +} // NagiosEscalationContactMapBuilder diff --git a/classes/map/NagiosEscalationContactgroupMapBuilder.php b/classes/map/NagiosEscalationContactgroupMapBuilder.php new file mode 100755 index 0000000..0a4a710 --- /dev/null +++ b/classes/map/NagiosEscalationContactgroupMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosEscalationContactgroupPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosEscalationContactgroupPeer::TABLE_NAME); + $tMap->setPhpName('NagiosEscalationContactgroup'); + $tMap->setClassname('NagiosEscalationContactgroup'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('ESCALATION', 'Escalation', 'INTEGER', 'nagios_escalation', 'ID', true, null); + + $tMap->addForeignKey('CONTACTGROUP', 'Contactgroup', 'INTEGER', 'nagios_contact_group', 'ID', true, null); + + } // doBuild() + +} // NagiosEscalationContactgroupMapBuilder diff --git a/classes/map/NagiosEscalationMapBuilder.php b/classes/map/NagiosEscalationMapBuilder.php new file mode 100755 index 0000000..1b2750f --- /dev/null +++ b/classes/map/NagiosEscalationMapBuilder.php @@ -0,0 +1,103 @@ +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(NagiosEscalationPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosEscalationPeer::TABLE_NAME); + $tMap->setPhpName('NagiosEscalation'); + $tMap->setClassname('NagiosEscalation'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', true, 255); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('HOSTGROUP', 'Hostgroup', 'INTEGER', 'nagios_hostgroup', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_TEMPLATE', 'ServiceTemplate', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addColumn('FIRST_NOTIFICATION', 'FirstNotification', 'INTEGER', false, null); + + $tMap->addColumn('LAST_NOTIFICATION', 'LastNotification', 'INTEGER', false, null); + + $tMap->addColumn('NOTIFICATION_INTERVAL', 'NotificationInterval', 'INTEGER', false, null); + + $tMap->addForeignKey('ESCALATION_PERIOD', 'EscalationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_UP', 'EscalationOptionsUp', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_DOWN', 'EscalationOptionsDown', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_UNREACHABLE', 'EscalationOptionsUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_OK', 'EscalationOptionsOk', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_WARNING', 'EscalationOptionsWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_UNKNOWN', 'EscalationOptionsUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('ESCALATION_OPTIONS_CRITICAL', 'EscalationOptionsCritical', 'BOOLEAN', false, null); + + } // doBuild() + +} // NagiosEscalationMapBuilder diff --git a/classes/map/NagiosHostCheckCommandParameterMapBuilder.php b/classes/map/NagiosHostCheckCommandParameterMapBuilder.php new file mode 100755 index 0000000..7c3e772 --- /dev/null +++ b/classes/map/NagiosHostCheckCommandParameterMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostCheckCommandParameter'); + $tMap->setClassname('NagiosHostCheckCommandParameter'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addColumn('PARAMETER', 'Parameter', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosHostCheckCommandParameterMapBuilder diff --git a/classes/map/NagiosHostContactMemberMapBuilder.php b/classes/map/NagiosHostContactMemberMapBuilder.php new file mode 100755 index 0000000..326bc64 --- /dev/null +++ b/classes/map/NagiosHostContactMemberMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosHostContactMemberPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostContactMemberPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostContactMember'); + $tMap->setClassname('NagiosHostContactMember'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('TEMPLATE', 'Template', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('CONTACT', 'Contact', 'INTEGER', 'nagios_contact', 'ID', false, null); + + } // doBuild() + +} // NagiosHostContactMemberMapBuilder diff --git a/classes/map/NagiosHostContactgroupMapBuilder.php b/classes/map/NagiosHostContactgroupMapBuilder.php new file mode 100755 index 0000000..6ef512d --- /dev/null +++ b/classes/map/NagiosHostContactgroupMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosHostContactgroupPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostContactgroupPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostContactgroup'); + $tMap->setClassname('NagiosHostContactgroup'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('CONTACTGROUP', 'Contactgroup', 'INTEGER', 'nagios_contact_group', 'ID', true, null); + + } // doBuild() + +} // NagiosHostContactgroupMapBuilder diff --git a/classes/map/NagiosHostMapBuilder.php b/classes/map/NagiosHostMapBuilder.php new file mode 100755 index 0000000..027638a --- /dev/null +++ b/classes/map/NagiosHostMapBuilder.php @@ -0,0 +1,167 @@ +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(NagiosHostPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHost'); + $tMap->setClassname('NagiosHost'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + $tMap->addColumn('DISPLAY_NAME', 'DisplayName', 'VARCHAR', true, 255); + + $tMap->addColumn('INITIAL_STATE', 'InitialState', 'VARCHAR', false, 1); + + $tMap->addColumn('ADDRESS', 'Address', 'VARCHAR', true, 255); + + $tMap->addForeignKey('CHECK_COMMAND', 'CheckCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('RETRY_INTERVAL', 'RetryInterval', 'INTEGER', false, null); + + $tMap->addColumn('FIRST_NOTIFICATION_DELAY', 'FirstNotificationDelay', 'INTEGER', false, null); + + $tMap->addColumn('MAXIMUM_CHECK_ATTEMPTS', 'MaximumCheckAttempts', 'INTEGER', false, null); + + $tMap->addColumn('CHECK_INTERVAL', 'CheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('PASSIVE_CHECKS_ENABLED', 'PassiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_PERIOD', 'CheckPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('OBSESS_OVER_HOST', 'ObsessOverHost', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_FRESHNESS', 'CheckFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('FRESHNESS_THRESHOLD', 'FreshnessThreshold', 'INTEGER', false, null); + + $tMap->addColumn('ACTIVE_CHECKS_ENABLED', 'ActiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECKS_ENABLED', 'ChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('EVENT_HANDLER', 'EventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('EVENT_HANDLER_ENABLED', 'EventHandlerEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('LOW_FLAP_THRESHOLD', 'LowFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('HIGH_FLAP_THRESHOLD', 'HighFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('FLAP_DETECTION_ENABLED', 'FlapDetectionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('PROCESS_PERF_DATA', 'ProcessPerfData', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_STATUS_INFORMATION', 'RetainStatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_NONSTATUS_INFORMATION', 'RetainNonstatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_INTERVAL', 'NotificationInterval', 'INTEGER', false, null); + + $tMap->addForeignKey('NOTIFICATION_PERIOD', 'NotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('NOTIFICATIONS_ENABLED', 'NotificationsEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_DOWN', 'NotificationOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_UNREACHABLE', 'NotificationOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_RECOVERY', 'NotificationOnRecovery', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_FLAPPING', 'NotificationOnFlapping', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_SCHEDULED_DOWNTIME', 'NotificationOnScheduledDowntime', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UP', 'StalkingOnUp', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_DOWN', 'StalkingOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UNREACHABLE', 'StalkingOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('FAILURE_PREDICTION_ENABLED', 'FailurePredictionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UP', 'FlapDetectionOnUp', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_DOWN', 'FlapDetectionOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UNREACHABLE', 'FlapDetectionOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE', 'IconImage', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE_ALT', 'IconImageAlt', 'VARCHAR', false, 255); + + $tMap->addColumn('VRML_IMAGE', 'VrmlImage', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUSMAP_IMAGE', 'StatusmapImage', 'VARCHAR', false, 255); + + $tMap->addColumn('TWO_D_COORDS', 'TwoDCoords', 'VARCHAR', false, 255); + + $tMap->addColumn('THREE_D_COORDS', 'ThreeDCoords', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosHostMapBuilder diff --git a/classes/map/NagiosHostParentMapBuilder.php b/classes/map/NagiosHostParentMapBuilder.php new file mode 100755 index 0000000..e394931 --- /dev/null +++ b/classes/map/NagiosHostParentMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosHostParentPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostParentPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostParent'); + $tMap->setClassname('NagiosHostParent'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('CHILD_HOST', 'ChildHost', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('CHILD_HOST_TEMPLATE', 'ChildHostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('PARENT_HOST', 'ParentHost', 'INTEGER', 'nagios_host', 'ID', false, null); + + } // doBuild() + +} // NagiosHostParentMapBuilder diff --git a/classes/map/NagiosHostTemplateAutodiscoveryServiceMapBuilder.php b/classes/map/NagiosHostTemplateAutodiscoveryServiceMapBuilder.php new file mode 100755 index 0000000..0991756 --- /dev/null +++ b/classes/map/NagiosHostTemplateAutodiscoveryServiceMapBuilder.php @@ -0,0 +1,83 @@ +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(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostTemplateAutodiscoveryService'); + $tMap->setClassname('NagiosHostTemplateAutodiscoveryService'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', false, 255); + + $tMap->addColumn('PROTOCOL', 'Protocol', 'VARCHAR', false, 255); + + $tMap->addColumn('PORT', 'Port', 'VARCHAR', false, 255); + + $tMap->addColumn('PRODUCT', 'Product', 'VARCHAR', false, 255); + + $tMap->addColumn('VERSION', 'Version', 'VARCHAR', false, 255); + + $tMap->addColumn('EXTRA_INFORMATION', 'ExtraInformation', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosHostTemplateAutodiscoveryServiceMapBuilder diff --git a/classes/map/NagiosHostTemplateInheritanceMapBuilder.php b/classes/map/NagiosHostTemplateInheritanceMapBuilder.php new file mode 100755 index 0000000..0a5e080 --- /dev/null +++ b/classes/map/NagiosHostTemplateInheritanceMapBuilder.php @@ -0,0 +1,77 @@ +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(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostTemplateInheritancePeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostTemplateInheritance'); + $tMap->setClassname('NagiosHostTemplateInheritance'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SOURCE_HOST', 'SourceHost', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('SOURCE_TEMPLATE', 'SourceTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('TARGET_TEMPLATE', 'TargetTemplate', 'INTEGER', 'nagios_host_template', 'ID', true, null); + + $tMap->addColumn('ORDER', 'Order', 'INTEGER', true, null); + + } // doBuild() + +} // NagiosHostTemplateInheritanceMapBuilder diff --git a/classes/map/NagiosHostTemplateMapBuilder.php b/classes/map/NagiosHostTemplateMapBuilder.php new file mode 100755 index 0000000..41cdf57 --- /dev/null +++ b/classes/map/NagiosHostTemplateMapBuilder.php @@ -0,0 +1,173 @@ +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(NagiosHostTemplatePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostTemplatePeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostTemplate'); + $tMap->setClassname('NagiosHostTemplate'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', false, 255); + + $tMap->addColumn('INITIAL_STATE', 'InitialState', 'VARCHAR', false, 1); + + $tMap->addForeignKey('CHECK_COMMAND', 'CheckCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('RETRY_INTERVAL', 'RetryInterval', 'INTEGER', false, null); + + $tMap->addColumn('FIRST_NOTIFICATION_DELAY', 'FirstNotificationDelay', 'INTEGER', false, null); + + $tMap->addColumn('MAXIMUM_CHECK_ATTEMPTS', 'MaximumCheckAttempts', 'INTEGER', false, null); + + $tMap->addColumn('CHECK_INTERVAL', 'CheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('PASSIVE_CHECKS_ENABLED', 'PassiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_PERIOD', 'CheckPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('OBSESS_OVER_HOST', 'ObsessOverHost', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_FRESHNESS', 'CheckFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('FRESHNESS_THRESHOLD', 'FreshnessThreshold', 'INTEGER', false, null); + + $tMap->addColumn('ACTIVE_CHECKS_ENABLED', 'ActiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECKS_ENABLED', 'ChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('EVENT_HANDLER', 'EventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('EVENT_HANDLER_ENABLED', 'EventHandlerEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('LOW_FLAP_THRESHOLD', 'LowFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('HIGH_FLAP_THRESHOLD', 'HighFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('FLAP_DETECTION_ENABLED', 'FlapDetectionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('PROCESS_PERF_DATA', 'ProcessPerfData', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_STATUS_INFORMATION', 'RetainStatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_NONSTATUS_INFORMATION', 'RetainNonstatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_INTERVAL', 'NotificationInterval', 'INTEGER', false, null); + + $tMap->addForeignKey('NOTIFICATION_PERIOD', 'NotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('NOTIFICATIONS_ENABLED', 'NotificationsEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_DOWN', 'NotificationOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_UNREACHABLE', 'NotificationOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_RECOVERY', 'NotificationOnRecovery', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_FLAPPING', 'NotificationOnFlapping', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_SCHEDULED_DOWNTIME', 'NotificationOnScheduledDowntime', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UP', 'StalkingOnUp', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_DOWN', 'StalkingOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UNREACHABLE', 'StalkingOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('FAILURE_PREDICTION_ENABLED', 'FailurePredictionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UP', 'FlapDetectionOnUp', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_DOWN', 'FlapDetectionOnDown', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UNREACHABLE', 'FlapDetectionOnUnreachable', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE', 'IconImage', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE_ALT', 'IconImageAlt', 'VARCHAR', false, 255); + + $tMap->addColumn('VRML_IMAGE', 'VrmlImage', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUSMAP_IMAGE', 'StatusmapImage', 'VARCHAR', false, 255); + + $tMap->addColumn('TWO_D_COORDS', 'TwoDCoords', 'VARCHAR', false, 255); + + $tMap->addColumn('THREE_D_COORDS', 'ThreeDCoords', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTODISCOVERY_ADDRESS_FILTER', 'AutodiscoveryAddressFilter', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTODISCOVERY_HOSTNAME_FILTER', 'AutodiscoveryHostnameFilter', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTODISCOVERY_OS_FAMILY_FILTER', 'AutodiscoveryOsFamilyFilter', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTODISCOVERY_OS_GENERATION_FILTER', 'AutodiscoveryOsGenerationFilter', 'VARCHAR', false, 255); + + $tMap->addColumn('AUTODISCOVERY_OS_VENDOR_FILTER', 'AutodiscoveryOsVendorFilter', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosHostTemplateMapBuilder diff --git a/classes/map/NagiosHostgroupMapBuilder.php b/classes/map/NagiosHostgroupMapBuilder.php new file mode 100755 index 0000000..92018a6 --- /dev/null +++ b/classes/map/NagiosHostgroupMapBuilder.php @@ -0,0 +1,79 @@ +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(NagiosHostgroupPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostgroupPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostgroup'); + $tMap->setClassname('NagiosHostgroup'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosHostgroupMapBuilder diff --git a/classes/map/NagiosHostgroupMembershipMapBuilder.php b/classes/map/NagiosHostgroupMembershipMapBuilder.php new file mode 100755 index 0000000..92323d4 --- /dev/null +++ b/classes/map/NagiosHostgroupMembershipMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosHostgroupMembershipPeer::TABLE_NAME); + $tMap->setPhpName('NagiosHostgroupMembership'); + $tMap->setClassname('NagiosHostgroupMembership'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('HOSTGROUP', 'Hostgroup', 'INTEGER', 'nagios_hostgroup', 'ID', true, null); + + } // doBuild() + +} // NagiosHostgroupMembershipMapBuilder diff --git a/classes/map/NagiosMainConfigurationMapBuilder.php b/classes/map/NagiosMainConfigurationMapBuilder.php new file mode 100755 index 0000000..1a4ce06 --- /dev/null +++ b/classes/map/NagiosMainConfigurationMapBuilder.php @@ -0,0 +1,319 @@ +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(NagiosMainConfigurationPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosMainConfigurationPeer::TABLE_NAME); + $tMap->setPhpName('NagiosMainConfiguration'); + $tMap->setClassname('NagiosMainConfiguration'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('CONFIG_DIR', 'ConfigDir', 'VARCHAR', false, 255); + + $tMap->addColumn('LOG_FILE', 'LogFile', 'VARCHAR', false, 255); + + $tMap->addColumn('TEMP_FILE', 'TempFile', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUS_FILE', 'StatusFile', 'VARCHAR', false, 255); + + $tMap->addColumn('STATUS_UPDATE_INTERVAL', 'StatusUpdateInterval', 'INTEGER', false, null); + + $tMap->addColumn('NAGIOS_USER', 'NagiosUser', 'VARCHAR', false, 255); + + $tMap->addColumn('NAGIOS_GROUP', 'NagiosGroup', 'VARCHAR', false, 255); + + $tMap->addColumn('ENABLE_NOTIFICATIONS', 'EnableNotifications', 'BOOLEAN', false, null); + + $tMap->addColumn('EXECUTE_SERVICE_CHECKS', 'ExecuteServiceChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('ACCEPT_PASSIVE_SERVICE_CHECKS', 'AcceptPassiveServiceChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('ENABLE_EVENT_HANDLERS', 'EnableEventHandlers', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_ROTATION_METHOD', 'LogRotationMethod', 'CHAR', false, null); + + $tMap->addColumn('LOG_ARCHIVE_PATH', 'LogArchivePath', 'VARCHAR', false, 255); + + $tMap->addColumn('CHECK_EXTERNAL_COMMANDS', 'CheckExternalCommands', 'BOOLEAN', false, null); + + $tMap->addColumn('COMMAND_CHECK_INTERVAL', 'CommandCheckInterval', 'VARCHAR', false, 255); + + $tMap->addColumn('COMMAND_FILE', 'CommandFile', 'VARCHAR', false, 255); + + $tMap->addColumn('LOCK_FILE', 'LockFile', 'VARCHAR', false, 255); + + $tMap->addColumn('RETAIN_STATE_INFORMATION', 'RetainStateInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('STATE_RETENTION_FILE', 'StateRetentionFile', 'VARCHAR', false, 255); + + $tMap->addColumn('RETENTION_UPDATE_INTERVAL', 'RetentionUpdateInterval', 'INTEGER', false, null); + + $tMap->addColumn('USE_RETAINED_PROGRAM_STATE', 'UseRetainedProgramState', 'BOOLEAN', false, null); + + $tMap->addColumn('USE_SYSLOG', 'UseSyslog', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_NOTIFICATIONS', 'LogNotifications', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_SERVICE_RETRIES', 'LogServiceRetries', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_HOST_RETRIES', 'LogHostRetries', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_EVENT_HANDLERS', 'LogEventHandlers', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_INITIAL_STATES', 'LogInitialStates', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_EXTERNAL_COMMANDS', 'LogExternalCommands', 'BOOLEAN', false, null); + + $tMap->addColumn('LOG_PASSIVE_CHECKS', 'LogPassiveChecks', 'BOOLEAN', false, null); + + $tMap->addForeignKey('GLOBAL_HOST_EVENT_HANDLER', 'GlobalHostEventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addForeignKey('GLOBAL_SERVICE_EVENT_HANDLER', 'GlobalServiceEventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('EXTERNAL_COMMAND_BUFFER_SLOTS', 'ExternalCommandBufferSlots', 'INTEGER', false, null); + + $tMap->addColumn('SLEEP_TIME', 'SleepTime', 'FLOAT', false, null); + + $tMap->addColumn('SERVICE_INTERLEAVE_FACTOR', 'ServiceInterleaveFactor', 'CHAR', false, null); + + $tMap->addColumn('MAX_CONCURRENT_CHECKS', 'MaxConcurrentChecks', 'INTEGER', false, null); + + $tMap->addColumn('SERVICE_REAPER_FREQUENCY', 'ServiceReaperFrequency', 'INTEGER', false, null); + + $tMap->addColumn('INTERVAL_LENGTH', 'IntervalLength', 'INTEGER', false, null); + + $tMap->addColumn('USE_AGGRESSIVE_HOST_CHECKING', 'UseAggressiveHostChecking', 'BOOLEAN', false, null); + + $tMap->addColumn('ENABLE_FLAP_DETECTION', 'EnableFlapDetection', 'BOOLEAN', false, null); + + $tMap->addColumn('LOW_SERVICE_FLAP_THRESHOLD', 'LowServiceFlapThreshold', 'FLOAT', false, null); + + $tMap->addColumn('HIGH_SERVICE_FLAP_THRESHOLD', 'HighServiceFlapThreshold', 'FLOAT', false, null); + + $tMap->addColumn('LOW_HOST_FLAP_THRESHOLD', 'LowHostFlapThreshold', 'FLOAT', false, null); + + $tMap->addColumn('HIGH_HOST_FLAP_THRESHOLD', 'HighHostFlapThreshold', 'FLOAT', false, null); + + $tMap->addColumn('SOFT_STATE_DEPENDENCIES', 'SoftStateDependencies', 'BOOLEAN', false, null); + + $tMap->addColumn('SERVICE_CHECK_TIMEOUT', 'ServiceCheckTimeout', 'INTEGER', false, null); + + $tMap->addColumn('HOST_CHECK_TIMEOUT', 'HostCheckTimeout', 'INTEGER', false, null); + + $tMap->addColumn('EVENT_HANDLER_TIMEOUT', 'EventHandlerTimeout', 'INTEGER', false, null); + + $tMap->addColumn('NOTIFICATION_TIMEOUT', 'NotificationTimeout', 'INTEGER', false, null); + + $tMap->addColumn('OCSP_TIMEOUT', 'OcspTimeout', 'INTEGER', false, null); + + $tMap->addColumn('OHCP_TIMEOUT', 'OhcpTimeout', 'INTEGER', false, null); + + $tMap->addColumn('PERFDATA_TIMEOUT', 'PerfdataTimeout', 'INTEGER', false, null); + + $tMap->addColumn('OBSESS_OVER_SERVICES', 'ObsessOverServices', 'BOOLEAN', false, null); + + $tMap->addForeignKey('OCSP_COMMAND', 'OcspCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('PROCESS_PERFORMANCE_DATA', 'ProcessPerformanceData', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_FOR_ORPHANED_SERVICES', 'CheckForOrphanedServices', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_SERVICE_FRESHNESS', 'CheckServiceFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('FRESHNESS_CHECK_INTERVAL', 'FreshnessCheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('DATE_FORMAT', 'DateFormat', 'VARCHAR', false, 255); + + $tMap->addColumn('ILLEGAL_OBJECT_NAME_CHARS', 'IllegalObjectNameChars', 'VARCHAR', false, 255); + + $tMap->addColumn('ILLEGAL_MACRO_OUTPUT_CHARS', 'IllegalMacroOutputChars', 'VARCHAR', false, 255); + + $tMap->addColumn('ADMIN_EMAIL', 'AdminEmail', 'VARCHAR', false, 255); + + $tMap->addColumn('ADMIN_PAGER', 'AdminPager', 'VARCHAR', false, 255); + + $tMap->addColumn('EXECUTE_HOST_CHECKS', 'ExecuteHostChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('SERVICE_INTER_CHECK_DELAY_METHOD', 'ServiceInterCheckDelayMethod', 'VARCHAR', false, 255); + + $tMap->addColumn('USE_RETAINED_SCHEDULING_INFO', 'UseRetainedSchedulingInfo', 'BOOLEAN', false, null); + + $tMap->addColumn('ACCEPT_PASSIVE_HOST_CHECKS', 'AcceptPassiveHostChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('MAX_SERVICE_CHECK_SPREAD', 'MaxServiceCheckSpread', 'INTEGER', false, null); + + $tMap->addColumn('HOST_INTER_CHECK_DELAY_METHOD', 'HostInterCheckDelayMethod', 'VARCHAR', false, 255); + + $tMap->addColumn('MAX_HOST_CHECK_SPREAD', 'MaxHostCheckSpread', 'INTEGER', false, null); + + $tMap->addColumn('AUTO_RESCHEDULE_CHECKS', 'AutoRescheduleChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('AUTO_RESCHEDULING_INTERVAL', 'AutoReschedulingInterval', 'INTEGER', false, null); + + $tMap->addColumn('AUTO_RESCHEDULING_WINDOW', 'AutoReschedulingWindow', 'INTEGER', false, null); + + $tMap->addColumn('OCHP_TIMEOUT', 'OchpTimeout', 'INTEGER', false, null); + + $tMap->addColumn('OBSESS_OVER_HOSTS', 'ObsessOverHosts', 'BOOLEAN', false, null); + + $tMap->addForeignKey('OCHP_COMMAND', 'OchpCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('CHECK_HOST_FRESHNESS', 'CheckHostFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('HOST_FRESHNESS_CHECK_INTERVAL', 'HostFreshnessCheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('SERVICE_FRESHNESS_CHECK_INTERVAL', 'ServiceFreshnessCheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('USE_REGEXP_MATCHING', 'UseRegexpMatching', 'BOOLEAN', false, null); + + $tMap->addColumn('USE_TRUE_REGEXP_MATCHING', 'UseTrueRegexpMatching', 'BOOLEAN', false, null); + + $tMap->addColumn('EVENT_BROKER_OPTIONS', 'EventBrokerOptions', 'VARCHAR', false, 255); + + $tMap->addColumn('DAEMON_DUMPS_CORE', 'DaemonDumpsCore', 'BOOLEAN', false, null); + + $tMap->addForeignKey('HOST_PERFDATA_COMMAND', 'HostPerfdataCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_PERFDATA_COMMAND', 'ServicePerfdataCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('HOST_PERFDATA_FILE', 'HostPerfdataFile', 'VARCHAR', false, 255); + + $tMap->addColumn('HOST_PERFDATA_FILE_TEMPLATE', 'HostPerfdataFileTemplate', 'VARCHAR', false, 255); + + $tMap->addColumn('SERVICE_PERFDATA_FILE', 'ServicePerfdataFile', 'VARCHAR', false, 255); + + $tMap->addColumn('SERVICE_PERFDATA_FILE_TEMPLATE', 'ServicePerfdataFileTemplate', 'VARCHAR', false, 255); + + $tMap->addColumn('HOST_PERFDATA_FILE_MODE', 'HostPerfdataFileMode', 'CHAR', false, null); + + $tMap->addColumn('SERVICE_PERFDATA_FILE_MODE', 'ServicePerfdataFileMode', 'CHAR', false, null); + + $tMap->addForeignKey('HOST_PERFDATA_FILE_PROCESSING_COMMAND', 'HostPerfdataFileProcessingCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_PERFDATA_FILE_PROCESSING_COMMAND', 'ServicePerfdataFileProcessingCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('HOST_PERFDATA_FILE_PROCESSING_INTERVAL', 'HostPerfdataFileProcessingInterval', 'INTEGER', false, null); + + $tMap->addColumn('SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL', 'ServicePerfdataFileProcessingInterval', 'INTEGER', false, null); + + $tMap->addColumn('OBJECT_CACHE_FILE', 'ObjectCacheFile', 'VARCHAR', false, 255); + + $tMap->addColumn('PRECACHED_OBJECT_FILE', 'PrecachedObjectFile', 'VARCHAR', false, 255); + + $tMap->addColumn('RETAINED_HOST_ATTRIBUTE_MASK', 'RetainedHostAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('RETAINED_SERVICE_ATTRIBUTE_MASK', 'RetainedServiceAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('RETAINED_PROCESS_HOST_ATTRIBUTE_MASK', 'RetainedProcessHostAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK', 'RetainedProcessServiceAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('RETAINED_CONTACT_HOST_ATTRIBUTE_MASK', 'RetainedContactHostAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK', 'RetainedContactServiceAttributeMask', 'INTEGER', false, null); + + $tMap->addColumn('CHECK_RESULT_REAPER_FREQUENCY', 'CheckResultReaperFrequency', 'INTEGER', false, null); + + $tMap->addColumn('MAX_CHECK_RESULT_REAPER_TIME', 'MaxCheckResultReaperTime', 'INTEGER', false, null); + + $tMap->addColumn('CHECK_RESULT_PATH', 'CheckResultPath', 'VARCHAR', false, 255); + + $tMap->addColumn('MAX_CHECK_RESULT_FILE_AGE', 'MaxCheckResultFileAge', 'INTEGER', false, null); + + $tMap->addColumn('TRANSLATE_PASSIVE_HOST_CHECKS', 'TranslatePassiveHostChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('PASSIVE_HOST_CHECKS_ARE_SOFT', 'PassiveHostChecksAreSoft', 'BOOLEAN', false, null); + + $tMap->addColumn('ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS', 'EnablePredictiveHostDependencyChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS', 'EnablePredictiveServiceDependencyChecks', 'BOOLEAN', false, null); + + $tMap->addColumn('CACHED_HOST_CHECK_HORIZON', 'CachedHostCheckHorizon', 'INTEGER', false, null); + + $tMap->addColumn('CACHED_SERVICE_CHECK_HORIZON', 'CachedServiceCheckHorizon', 'INTEGER', false, null); + + $tMap->addColumn('USE_LARGE_INSTALLATION_TWEAKS', 'UseLargeInstallationTweaks', 'BOOLEAN', false, null); + + $tMap->addColumn('FREE_CHILD_PROCESS_MEMORY', 'FreeChildProcessMemory', 'BOOLEAN', false, null); + + $tMap->addColumn('CHILD_PROCESSES_FORK_TWICE', 'ChildProcessesForkTwice', 'BOOLEAN', false, null); + + $tMap->addColumn('ENABLE_ENVIRONMENT_MACROS', 'EnableEnvironmentMacros', 'BOOLEAN', false, null); + + $tMap->addColumn('ADDITIONAL_FRESHNESS_LATENCY', 'AdditionalFreshnessLatency', 'INTEGER', false, null); + + $tMap->addColumn('ENABLE_EMBEDDED_PERL', 'EnableEmbeddedPerl', 'BOOLEAN', false, null); + + $tMap->addColumn('USE_EMBEDDED_PERL_IMPLICITLY', 'UseEmbeddedPerlImplicitly', 'BOOLEAN', false, null); + + $tMap->addColumn('P1_FILE', 'P1File', 'VARCHAR', false, 255); + + $tMap->addColumn('USE_TIMEZONE', 'UseTimezone', 'VARCHAR', false, 255); + + $tMap->addColumn('DEBUG_FILE', 'DebugFile', 'VARCHAR', false, 255); + + $tMap->addColumn('DEBUG_LEVEL', 'DebugLevel', 'INTEGER', false, null); + + $tMap->addColumn('DEBUG_VERBOSITY', 'DebugVerbosity', 'INTEGER', false, null); + + $tMap->addColumn('MAX_DEBUG_FILE_SIZE', 'MaxDebugFileSize', 'INTEGER', false, null); + + } // doBuild() + +} // NagiosMainConfigurationMapBuilder diff --git a/classes/map/NagiosResourceMapBuilder.php b/classes/map/NagiosResourceMapBuilder.php new file mode 100755 index 0000000..3e8d6d5 --- /dev/null +++ b/classes/map/NagiosResourceMapBuilder.php @@ -0,0 +1,133 @@ +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(NagiosResourcePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosResourcePeer::TABLE_NAME); + $tMap->setPhpName('NagiosResource'); + $tMap->setClassname('NagiosResource'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('USER1', 'User1', 'VARCHAR', false, 255); + + $tMap->addColumn('USER2', 'User2', 'VARCHAR', false, 255); + + $tMap->addColumn('USER3', 'User3', 'VARCHAR', false, 255); + + $tMap->addColumn('USER4', 'User4', 'VARCHAR', false, 255); + + $tMap->addColumn('USER5', 'User5', 'VARCHAR', false, 255); + + $tMap->addColumn('USER6', 'User6', 'VARCHAR', false, 255); + + $tMap->addColumn('USER7', 'User7', 'VARCHAR', false, 255); + + $tMap->addColumn('USER8', 'User8', 'VARCHAR', false, 255); + + $tMap->addColumn('USER9', 'User9', 'VARCHAR', false, 255); + + $tMap->addColumn('USER10', 'User10', 'VARCHAR', false, 255); + + $tMap->addColumn('USER11', 'User11', 'VARCHAR', false, 255); + + $tMap->addColumn('USER12', 'User12', 'VARCHAR', false, 255); + + $tMap->addColumn('USER13', 'User13', 'VARCHAR', false, 255); + + $tMap->addColumn('USER14', 'User14', 'VARCHAR', false, 255); + + $tMap->addColumn('USER15', 'User15', 'VARCHAR', false, 255); + + $tMap->addColumn('USER16', 'User16', 'VARCHAR', false, 255); + + $tMap->addColumn('USER17', 'User17', 'VARCHAR', false, 255); + + $tMap->addColumn('USER18', 'User18', 'VARCHAR', false, 255); + + $tMap->addColumn('USER19', 'User19', 'VARCHAR', false, 255); + + $tMap->addColumn('USER20', 'User20', 'VARCHAR', false, 255); + + $tMap->addColumn('USER21', 'User21', 'VARCHAR', false, 255); + + $tMap->addColumn('USER22', 'User22', 'VARCHAR', false, 255); + + $tMap->addColumn('USER23', 'User23', 'VARCHAR', false, 255); + + $tMap->addColumn('USER24', 'User24', 'VARCHAR', false, 255); + + $tMap->addColumn('USER25', 'User25', 'VARCHAR', false, 255); + + $tMap->addColumn('USER26', 'User26', 'VARCHAR', false, 255); + + $tMap->addColumn('USER27', 'User27', 'VARCHAR', false, 255); + + $tMap->addColumn('USER28', 'User28', 'VARCHAR', false, 255); + + $tMap->addColumn('USER29', 'User29', 'VARCHAR', false, 255); + + $tMap->addColumn('USER30', 'User30', 'VARCHAR', false, 255); + + $tMap->addColumn('USER31', 'User31', 'VARCHAR', false, 255); + + $tMap->addColumn('USER32', 'User32', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosResourceMapBuilder diff --git a/classes/map/NagiosServiceCheckCommandParameterMapBuilder.php b/classes/map/NagiosServiceCheckCommandParameterMapBuilder.php new file mode 100755 index 0000000..70d7ce9 --- /dev/null +++ b/classes/map/NagiosServiceCheckCommandParameterMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceCheckCommandParameter'); + $tMap->setClassname('NagiosServiceCheckCommandParameter'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('TEMPLATE', 'Template', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addColumn('PARAMETER', 'Parameter', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosServiceCheckCommandParameterMapBuilder diff --git a/classes/map/NagiosServiceContactGroupMemberMapBuilder.php b/classes/map/NagiosServiceContactGroupMemberMapBuilder.php new file mode 100755 index 0000000..dd69b3c --- /dev/null +++ b/classes/map/NagiosServiceContactGroupMemberMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceContactGroupMember'); + $tMap->setClassname('NagiosServiceContactGroupMember'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('TEMPLATE', 'Template', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('CONTACT_GROUP', 'ContactGroup', 'INTEGER', 'nagios_contact_group', 'ID', false, null); + + } // doBuild() + +} // NagiosServiceContactGroupMemberMapBuilder diff --git a/classes/map/NagiosServiceContactMemberMapBuilder.php b/classes/map/NagiosServiceContactMemberMapBuilder.php new file mode 100755 index 0000000..4e012a2 --- /dev/null +++ b/classes/map/NagiosServiceContactMemberMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosServiceContactMemberPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceContactMemberPeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceContactMember'); + $tMap->setClassname('NagiosServiceContactMember'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('TEMPLATE', 'Template', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('CONTACT', 'Contact', 'INTEGER', 'nagios_contact', 'ID', false, null); + + } // doBuild() + +} // NagiosServiceContactMemberMapBuilder diff --git a/classes/map/NagiosServiceGroupMapBuilder.php b/classes/map/NagiosServiceGroupMapBuilder.php new file mode 100755 index 0000000..e8eb477 --- /dev/null +++ b/classes/map/NagiosServiceGroupMapBuilder.php @@ -0,0 +1,79 @@ +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(NagiosServiceGroupPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceGroupPeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceGroup'); + $tMap->setClassname('NagiosServiceGroup'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosServiceGroupMapBuilder diff --git a/classes/map/NagiosServiceGroupMemberMapBuilder.php b/classes/map/NagiosServiceGroupMemberMapBuilder.php new file mode 100755 index 0000000..0c7ce25 --- /dev/null +++ b/classes/map/NagiosServiceGroupMemberMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceGroupMemberPeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceGroupMember'); + $tMap->setClassname('NagiosServiceGroupMember'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SERVICE', 'Service', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('TEMPLATE', 'Template', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('SERVICE_GROUP', 'ServiceGroup', 'INTEGER', 'nagios_service_group', 'ID', false, null); + + } // doBuild() + +} // NagiosServiceGroupMemberMapBuilder diff --git a/classes/map/NagiosServiceMapBuilder.php b/classes/map/NagiosServiceMapBuilder.php new file mode 100755 index 0000000..638f643 --- /dev/null +++ b/classes/map/NagiosServiceMapBuilder.php @@ -0,0 +1,169 @@ +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(NagiosServicePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServicePeer::TABLE_NAME); + $tMap->setPhpName('NagiosService'); + $tMap->setClassname('NagiosService'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', false, 255); + + $tMap->addColumn('DISPLAY_NAME', 'DisplayName', 'VARCHAR', false, 255); + + $tMap->addForeignKey('HOST', 'Host', 'INTEGER', 'nagios_host', 'ID', false, null); + + $tMap->addForeignKey('HOST_TEMPLATE', 'HostTemplate', 'INTEGER', 'nagios_host_template', 'ID', false, null); + + $tMap->addForeignKey('HOSTGROUP', 'Hostgroup', 'INTEGER', 'nagios_hostgroup', 'ID', false, null); + + $tMap->addColumn('INITIAL_STATE', 'InitialState', 'VARCHAR', false, 1); + + $tMap->addColumn('IS_VOLATILE', 'IsVolatile', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_COMMAND', 'CheckCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('MAXIMUM_CHECK_ATTEMPTS', 'MaximumCheckAttempts', 'INTEGER', false, null); + + $tMap->addColumn('NORMAL_CHECK_INTERVAL', 'NormalCheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('RETRY_INTERVAL', 'RetryInterval', 'INTEGER', false, null); + + $tMap->addColumn('FIRST_NOTIFICATION_DELAY', 'FirstNotificationDelay', 'INTEGER', false, null); + + $tMap->addColumn('ACTIVE_CHECKS_ENABLED', 'ActiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('PASSIVE_CHECKS_ENABLED', 'PassiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_PERIOD', 'CheckPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('PARALLELIZE_CHECK', 'ParallelizeCheck', 'BOOLEAN', false, null); + + $tMap->addColumn('OBSESS_OVER_SERVICE', 'ObsessOverService', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_FRESHNESS', 'CheckFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('FRESHNESS_THRESHOLD', 'FreshnessThreshold', 'INTEGER', false, null); + + $tMap->addForeignKey('EVENT_HANDLER', 'EventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('EVENT_HANDLER_ENABLED', 'EventHandlerEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('LOW_FLAP_THRESHOLD', 'LowFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('HIGH_FLAP_THRESHOLD', 'HighFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('FLAP_DETECTION_ENABLED', 'FlapDetectionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_OK', 'FlapDetectionOnOk', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_WARNING', 'FlapDetectionOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_CRITICAL', 'FlapDetectionOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UNKNOWN', 'FlapDetectionOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('PROCESS_PERF_DATA', 'ProcessPerfData', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_STATUS_INFORMATION', 'RetainStatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_NONSTATUS_INFORMATION', 'RetainNonstatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_INTERVAL', 'NotificationInterval', 'INTEGER', false, null); + + $tMap->addForeignKey('NOTIFICATION_PERIOD', 'NotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('NOTIFICATION_ON_WARNING', 'NotificationOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_UNKNOWN', 'NotificationOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_CRITICAL', 'NotificationOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_RECOVERY', 'NotificationOnRecovery', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_FLAPPING', 'NotificationOnFlapping', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_SCHEDULED_DOWNTIME', 'NotificationOnScheduledDowntime', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATIONS_ENABLED', 'NotificationsEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_OK', 'StalkingOnOk', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_WARNING', 'StalkingOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UNKNOWN', 'StalkingOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_CRITICAL', 'StalkingOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('FAILURE_PREDICTION_ENABLED', 'FailurePredictionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE', 'IconImage', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE_ALT', 'IconImageAlt', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosServiceMapBuilder diff --git a/classes/map/NagiosServiceTemplateInheritanceMapBuilder.php b/classes/map/NagiosServiceTemplateInheritanceMapBuilder.php new file mode 100755 index 0000000..b6123a9 --- /dev/null +++ b/classes/map/NagiosServiceTemplateInheritanceMapBuilder.php @@ -0,0 +1,77 @@ +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(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceTemplateInheritance'); + $tMap->setClassname('NagiosServiceTemplateInheritance'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('SOURCE_SERVICE', 'SourceService', 'INTEGER', 'nagios_service', 'ID', false, null); + + $tMap->addForeignKey('SOURCE_TEMPLATE', 'SourceTemplate', 'INTEGER', 'nagios_service_template', 'ID', false, null); + + $tMap->addForeignKey('TARGET_TEMPLATE', 'TargetTemplate', 'INTEGER', 'nagios_service_template', 'ID', true, null); + + $tMap->addColumn('ORDER', 'Order', 'INTEGER', true, null); + + } // doBuild() + +} // NagiosServiceTemplateInheritanceMapBuilder diff --git a/classes/map/NagiosServiceTemplateMapBuilder.php b/classes/map/NagiosServiceTemplateMapBuilder.php new file mode 100755 index 0000000..bc1c106 --- /dev/null +++ b/classes/map/NagiosServiceTemplateMapBuilder.php @@ -0,0 +1,163 @@ +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(NagiosServiceTemplatePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosServiceTemplatePeer::TABLE_NAME); + $tMap->setPhpName('NagiosServiceTemplate'); + $tMap->setClassname('NagiosServiceTemplate'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('DESCRIPTION', 'Description', 'VARCHAR', false, 255); + + $tMap->addColumn('INITIAL_STATE', 'InitialState', 'VARCHAR', false, 1); + + $tMap->addColumn('IS_VOLATILE', 'IsVolatile', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_COMMAND', 'CheckCommand', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('MAXIMUM_CHECK_ATTEMPTS', 'MaximumCheckAttempts', 'INTEGER', false, null); + + $tMap->addColumn('NORMAL_CHECK_INTERVAL', 'NormalCheckInterval', 'INTEGER', false, null); + + $tMap->addColumn('RETRY_INTERVAL', 'RetryInterval', 'INTEGER', false, null); + + $tMap->addColumn('FIRST_NOTIFICATION_DELAY', 'FirstNotificationDelay', 'INTEGER', false, null); + + $tMap->addColumn('ACTIVE_CHECKS_ENABLED', 'ActiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('PASSIVE_CHECKS_ENABLED', 'PassiveChecksEnabled', 'BOOLEAN', false, null); + + $tMap->addForeignKey('CHECK_PERIOD', 'CheckPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('PARALLELIZE_CHECK', 'ParallelizeCheck', 'BOOLEAN', false, null); + + $tMap->addColumn('OBSESS_OVER_SERVICE', 'ObsessOverService', 'BOOLEAN', false, null); + + $tMap->addColumn('CHECK_FRESHNESS', 'CheckFreshness', 'BOOLEAN', false, null); + + $tMap->addColumn('FRESHNESS_THRESHOLD', 'FreshnessThreshold', 'INTEGER', false, null); + + $tMap->addForeignKey('EVENT_HANDLER', 'EventHandler', 'INTEGER', 'nagios_command', 'ID', false, null); + + $tMap->addColumn('EVENT_HANDLER_ENABLED', 'EventHandlerEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('LOW_FLAP_THRESHOLD', 'LowFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('HIGH_FLAP_THRESHOLD', 'HighFlapThreshold', 'INTEGER', false, null); + + $tMap->addColumn('FLAP_DETECTION_ENABLED', 'FlapDetectionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_OK', 'FlapDetectionOnOk', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_WARNING', 'FlapDetectionOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_CRITICAL', 'FlapDetectionOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('FLAP_DETECTION_ON_UNKNOWN', 'FlapDetectionOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('PROCESS_PERF_DATA', 'ProcessPerfData', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_STATUS_INFORMATION', 'RetainStatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('RETAIN_NONSTATUS_INFORMATION', 'RetainNonstatusInformation', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_INTERVAL', 'NotificationInterval', 'INTEGER', false, null); + + $tMap->addForeignKey('NOTIFICATION_PERIOD', 'NotificationPeriod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('NOTIFICATION_ON_WARNING', 'NotificationOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_UNKNOWN', 'NotificationOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_CRITICAL', 'NotificationOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_RECOVERY', 'NotificationOnRecovery', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_FLAPPING', 'NotificationOnFlapping', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATION_ON_SCHEDULED_DOWNTIME', 'NotificationOnScheduledDowntime', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTIFICATIONS_ENABLED', 'NotificationsEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_OK', 'StalkingOnOk', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_WARNING', 'StalkingOnWarning', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_UNKNOWN', 'StalkingOnUnknown', 'BOOLEAN', false, null); + + $tMap->addColumn('STALKING_ON_CRITICAL', 'StalkingOnCritical', 'BOOLEAN', false, null); + + $tMap->addColumn('FAILURE_PREDICTION_ENABLED', 'FailurePredictionEnabled', 'BOOLEAN', false, null); + + $tMap->addColumn('NOTES', 'Notes', 'VARCHAR', false, 255); + + $tMap->addColumn('NOTES_URL', 'NotesUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ACTION_URL', 'ActionUrl', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE', 'IconImage', 'VARCHAR', false, 255); + + $tMap->addColumn('ICON_IMAGE_ALT', 'IconImageAlt', 'VARCHAR', false, 255); + + } // doBuild() + +} // NagiosServiceTemplateMapBuilder diff --git a/classes/map/NagiosTimeperiodEntryMapBuilder.php b/classes/map/NagiosTimeperiodEntryMapBuilder.php new file mode 100755 index 0000000..4022c94 --- /dev/null +++ b/classes/map/NagiosTimeperiodEntryMapBuilder.php @@ -0,0 +1,75 @@ +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(NagiosTimeperiodEntryPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosTimeperiodEntryPeer::TABLE_NAME); + $tMap->setPhpName('NagiosTimeperiodEntry'); + $tMap->setClassname('NagiosTimeperiodEntry'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('TIMEPERIOD_ID', 'TimeperiodId', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addColumn('ENTRY', 'Entry', 'VARCHAR', true, 255); + + $tMap->addColumn('VALUE', 'Value', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosTimeperiodEntryMapBuilder diff --git a/classes/map/NagiosTimeperiodExcludeMapBuilder.php b/classes/map/NagiosTimeperiodExcludeMapBuilder.php new file mode 100755 index 0000000..c12962a --- /dev/null +++ b/classes/map/NagiosTimeperiodExcludeMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosTimeperiodExcludePeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosTimeperiodExcludePeer::TABLE_NAME); + $tMap->setPhpName('NagiosTimeperiodExclude'); + $tMap->setClassname('NagiosTimeperiodExclude'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addForeignKey('TIMEPERIOD_ID', 'TimeperiodId', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + $tMap->addForeignKey('EXCLUDED_TIMEPERIOD', 'ExcludedTimeperiod', 'INTEGER', 'nagios_timeperiod', 'ID', false, null); + + } // doBuild() + +} // NagiosTimeperiodExcludeMapBuilder diff --git a/classes/map/NagiosTimeperiodMapBuilder.php b/classes/map/NagiosTimeperiodMapBuilder.php new file mode 100755 index 0000000..46d47d4 --- /dev/null +++ b/classes/map/NagiosTimeperiodMapBuilder.php @@ -0,0 +1,73 @@ +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(NagiosTimeperiodPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(NagiosTimeperiodPeer::TABLE_NAME); + $tMap->setPhpName('NagiosTimeperiod'); + $tMap->setClassname('NagiosTimeperiod'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NAME', 'Name', 'VARCHAR', true, 255); + + $tMap->addColumn('ALIAS', 'Alias', 'VARCHAR', true, 255); + + } // doBuild() + +} // NagiosTimeperiodMapBuilder diff --git a/classes/om/BaseAutodiscoveryDevice.php b/classes/om/BaseAutodiscoveryDevice.php new file mode 100755 index 0000000..cd57b14 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDevice.php @@ -0,0 +1,1792 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [job_id] column value. + * + * @return int + */ + public function getJobId() + { + return $this->job_id; + } + + /** + * Get the [address] column value. + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [hostname] column value. + * + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [osvendor] column value. + * + * @return string + */ + public function getOsvendor() + { + return $this->osvendor; + } + + /** + * Get the [osfamily] column value. + * + * @return string + */ + public function getOsfamily() + { + return $this->osfamily; + } + + /** + * Get the [osgen] column value. + * + * @return string + */ + public function getOsgen() + { + return $this->osgen; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [proposed_parent] column value. + * + * @return int + */ + public function getProposedParent() + { + return $this->proposed_parent; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [job_id] column. + * + * @param int $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setJobId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->job_id !== $v) { + $this->job_id = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::JOB_ID; + } + + if ($this->aAutodiscoveryJob !== null && $this->aAutodiscoveryJob->getId() !== $v) { + $this->aAutodiscoveryJob = null; + } + + return $this; + } // setJobId() + + /** + * Set the value of [address] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setAddress($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address !== $v) { + $this->address = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::ADDRESS; + } + + return $this; + } // setAddress() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [hostname] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setHostname($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->hostname !== $v) { + $this->hostname = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::HOSTNAME; + } + + return $this; + } // setHostname() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [osvendor] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setOsvendor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->osvendor !== $v) { + $this->osvendor = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::OSVENDOR; + } + + return $this; + } // setOsvendor() + + /** + * Set the value of [osfamily] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setOsfamily($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->osfamily !== $v) { + $this->osfamily = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::OSFAMILY; + } + + return $this; + } // setOsfamily() + + /** + * Set the value of [osgen] column. + * + * @param string $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setOsgen($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->osgen !== $v) { + $this->osgen = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::OSGEN; + } + + return $this; + } // setOsgen() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [proposed_parent] column. + * + * @param int $v new value + * @return AutodiscoveryDevice The current object (for fluent API support) + */ + public function setProposedParent($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->proposed_parent !== $v) { + $this->proposed_parent = $v; + $this->modifiedColumns[] = AutodiscoveryDevicePeer::PROPOSED_PARENT; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setProposedParent() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->job_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->address = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->hostname = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->osvendor = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->osfamily = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->osgen = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->host_template = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->proposed_parent = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 11; // 11 = AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AutodiscoveryDevice object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aAutodiscoveryJob !== null && $this->job_id !== $this->aAutodiscoveryJob->getId()) { + $this->aAutodiscoveryJob = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHost !== null && $this->proposed_parent !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = AutodiscoveryDevicePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aAutodiscoveryJob = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + $this->collAutodiscoveryDeviceServices = null; + $this->lastAutodiscoveryDeviceServiceCriteria = null; + + $this->collAutodiscoveryDeviceTemplateMatchs = null; + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + AutodiscoveryDevicePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + AutodiscoveryDevicePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aAutodiscoveryJob !== null) { + if ($this->aAutodiscoveryJob->isModified() || $this->aAutodiscoveryJob->isNew()) { + $affectedRows += $this->aAutodiscoveryJob->save($con); + } + $this->setAutodiscoveryJob($this->aAutodiscoveryJob); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = AutodiscoveryDevicePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AutodiscoveryDevicePeer::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 + + $this->setNew(false); + } else { + $affectedRows += AutodiscoveryDevicePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collAutodiscoveryDeviceServices !== null) { + foreach ($this->collAutodiscoveryDeviceServices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs !== null) { + foreach ($this->collAutodiscoveryDeviceTemplateMatchs as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aAutodiscoveryJob !== null) { + if (!$this->aAutodiscoveryJob->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aAutodiscoveryJob->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + + if (($retval = AutodiscoveryDevicePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collAutodiscoveryDeviceServices !== null) { + foreach ($this->collAutodiscoveryDeviceServices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs !== null) { + foreach ($this->collAutodiscoveryDeviceTemplateMatchs as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDevicePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getJobId(); + break; + case 2: + return $this->getAddress(); + break; + case 3: + return $this->getName(); + break; + case 4: + return $this->getHostname(); + break; + case 5: + return $this->getDescription(); + break; + case 6: + return $this->getOsvendor(); + break; + case 7: + return $this->getOsfamily(); + break; + case 8: + return $this->getOsgen(); + break; + case 9: + return $this->getHostTemplate(); + break; + case 10: + return $this->getProposedParent(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = AutodiscoveryDevicePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getJobId(), + $keys[2] => $this->getAddress(), + $keys[3] => $this->getName(), + $keys[4] => $this->getHostname(), + $keys[5] => $this->getDescription(), + $keys[6] => $this->getOsvendor(), + $keys[7] => $this->getOsfamily(), + $keys[8] => $this->getOsgen(), + $keys[9] => $this->getHostTemplate(), + $keys[10] => $this->getProposedParent(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDevicePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setJobId($value); + break; + case 2: + $this->setAddress($value); + break; + case 3: + $this->setName($value); + break; + case 4: + $this->setHostname($value); + break; + case 5: + $this->setDescription($value); + break; + case 6: + $this->setOsvendor($value); + break; + case 7: + $this->setOsfamily($value); + break; + case 8: + $this->setOsgen($value); + break; + case 9: + $this->setHostTemplate($value); + break; + case 10: + $this->setProposedParent($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = AutodiscoveryDevicePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setJobId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAddress($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setHostname($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setOsvendor($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setOsfamily($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setOsgen($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setHostTemplate($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setProposedParent($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(AutodiscoveryDevicePeer::DATABASE_NAME); + + if ($this->isColumnModified(AutodiscoveryDevicePeer::ID)) $criteria->add(AutodiscoveryDevicePeer::ID, $this->id); + if ($this->isColumnModified(AutodiscoveryDevicePeer::JOB_ID)) $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->job_id); + if ($this->isColumnModified(AutodiscoveryDevicePeer::ADDRESS)) $criteria->add(AutodiscoveryDevicePeer::ADDRESS, $this->address); + if ($this->isColumnModified(AutodiscoveryDevicePeer::NAME)) $criteria->add(AutodiscoveryDevicePeer::NAME, $this->name); + if ($this->isColumnModified(AutodiscoveryDevicePeer::HOSTNAME)) $criteria->add(AutodiscoveryDevicePeer::HOSTNAME, $this->hostname); + if ($this->isColumnModified(AutodiscoveryDevicePeer::DESCRIPTION)) $criteria->add(AutodiscoveryDevicePeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(AutodiscoveryDevicePeer::OSVENDOR)) $criteria->add(AutodiscoveryDevicePeer::OSVENDOR, $this->osvendor); + if ($this->isColumnModified(AutodiscoveryDevicePeer::OSFAMILY)) $criteria->add(AutodiscoveryDevicePeer::OSFAMILY, $this->osfamily); + if ($this->isColumnModified(AutodiscoveryDevicePeer::OSGEN)) $criteria->add(AutodiscoveryDevicePeer::OSGEN, $this->osgen); + if ($this->isColumnModified(AutodiscoveryDevicePeer::HOST_TEMPLATE)) $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(AutodiscoveryDevicePeer::PROPOSED_PARENT)) $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->proposed_parent); + + 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(AutodiscoveryDevicePeer::DATABASE_NAME); + + $criteria->add(AutodiscoveryDevicePeer::ID, $this->id); + + 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 AutodiscoveryDevice (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) + { + + $copyObj->setJobId($this->job_id); + + $copyObj->setAddress($this->address); + + $copyObj->setName($this->name); + + $copyObj->setHostname($this->hostname); + + $copyObj->setDescription($this->description); + + $copyObj->setOsvendor($this->osvendor); + + $copyObj->setOsfamily($this->osfamily); + + $copyObj->setOsgen($this->osgen); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setProposedParent($this->proposed_parent); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getAutodiscoveryDeviceServices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDeviceService($relObj->copy($deepCopy)); + } + } + + foreach ($this->getAutodiscoveryDeviceTemplateMatchs() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDeviceTemplateMatch($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 AutodiscoveryDevice 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); + $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 AutodiscoveryDevicePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AutodiscoveryDevicePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a AutodiscoveryJob object. + * + * @param AutodiscoveryJob $v + * @return AutodiscoveryDevice The current object (for fluent API support) + * @throws PropelException + */ + public function setAutodiscoveryJob(AutodiscoveryJob $v = null) + { + if ($v === null) { + $this->setJobId(NULL); + } else { + $this->setJobId($v->getId()); + } + + $this->aAutodiscoveryJob = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the AutodiscoveryJob object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDevice($this); + } + + return $this; + } + + + /** + * Get the associated AutodiscoveryJob object + * + * @param PropelPDO Optional Connection object. + * @return AutodiscoveryJob The associated AutodiscoveryJob object. + * @throws PropelException + */ + public function getAutodiscoveryJob(PropelPDO $con = null) + { + if ($this->aAutodiscoveryJob === null && ($this->job_id !== null)) { + $c = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + $c->add(AutodiscoveryJobPeer::ID, $this->job_id); + $this->aAutodiscoveryJob = AutodiscoveryJobPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aAutodiscoveryJob->addAutodiscoveryDevices($this); + */ + } + return $this->aAutodiscoveryJob; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return AutodiscoveryDevice The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDevice($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addAutodiscoveryDevices($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return AutodiscoveryDevice The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setProposedParent(NULL); + } else { + $this->setProposedParent($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDevice($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->proposed_parent !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->proposed_parent); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addAutodiscoveryDevices($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Clears out the collAutodiscoveryDeviceServices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDeviceServices() + */ + public function clearAutodiscoveryDeviceServices() + { + $this->collAutodiscoveryDeviceServices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDeviceServices collection (array). + * + * By default this just sets the collAutodiscoveryDeviceServices collection to an empty array (like clearcollAutodiscoveryDeviceServices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDeviceServices() + { + $this->collAutodiscoveryDeviceServices = array(); + } + + /** + * Gets an array of AutodiscoveryDeviceService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this AutodiscoveryDevice has previously been saved, it will retrieve + * related AutodiscoveryDeviceServices from storage. If this AutodiscoveryDevice is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDeviceService[] + * @throws PropelException + */ + public function getAutodiscoveryDeviceServices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDeviceServices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDeviceServices = array(); + } else { + + $criteria->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $this->id); + + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + $this->collAutodiscoveryDeviceServices = AutodiscoveryDeviceServicePeer::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. + + + $criteria->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $this->id); + + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceServiceCriteria) || !$this->lastAutodiscoveryDeviceServiceCriteria->equals($criteria)) { + $this->collAutodiscoveryDeviceServices = AutodiscoveryDeviceServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceServiceCriteria = $criteria; + return $this->collAutodiscoveryDeviceServices; + } + + /** + * Returns the number of related AutodiscoveryDeviceService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDeviceService objects. + * @throws PropelException + */ + public function countAutodiscoveryDeviceServices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDeviceServices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $this->id); + + $count = AutodiscoveryDeviceServicePeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceServiceCriteria) || !$this->lastAutodiscoveryDeviceServiceCriteria->equals($criteria)) { + $count = AutodiscoveryDeviceServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDeviceServices); + } + } else { + $count = count($this->collAutodiscoveryDeviceServices); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDeviceService object to this object + * through the AutodiscoveryDeviceService foreign key attribute. + * + * @param AutodiscoveryDeviceService $l AutodiscoveryDeviceService + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDeviceService(AutodiscoveryDeviceService $l) + { + if ($this->collAutodiscoveryDeviceServices === null) { + $this->initAutodiscoveryDeviceServices(); + } + if (!in_array($l, $this->collAutodiscoveryDeviceServices, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDeviceServices, $l); + $l->setAutodiscoveryDevice($this); + } + } + + /** + * Clears out the collAutodiscoveryDeviceTemplateMatchs collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDeviceTemplateMatchs() + */ + public function clearAutodiscoveryDeviceTemplateMatchs() + { + $this->collAutodiscoveryDeviceTemplateMatchs = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDeviceTemplateMatchs collection (array). + * + * By default this just sets the collAutodiscoveryDeviceTemplateMatchs collection to an empty array (like clearcollAutodiscoveryDeviceTemplateMatchs()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDeviceTemplateMatchs() + { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } + + /** + * Gets an array of AutodiscoveryDeviceTemplateMatch objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this AutodiscoveryDevice has previously been saved, it will retrieve + * related AutodiscoveryDeviceTemplateMatchs from storage. If this AutodiscoveryDevice is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDeviceTemplateMatch[] + * @throws PropelException + */ + public function getAutodiscoveryDeviceTemplateMatchs($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::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. + + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = $criteria; + return $this->collAutodiscoveryDeviceTemplateMatchs; + } + + /** + * Returns the number of related AutodiscoveryDeviceTemplateMatch objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException + */ + public function countAutodiscoveryDeviceTemplateMatchs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + $count = AutodiscoveryDeviceTemplateMatchPeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $count = AutodiscoveryDeviceTemplateMatchPeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDeviceTemplateMatchs); + } + } else { + $count = count($this->collAutodiscoveryDeviceTemplateMatchs); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDeviceTemplateMatch object to this object + * through the AutodiscoveryDeviceTemplateMatch foreign key attribute. + * + * @param AutodiscoveryDeviceTemplateMatch $l AutodiscoveryDeviceTemplateMatch + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDeviceTemplateMatch(AutodiscoveryDeviceTemplateMatch $l) + { + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + $this->initAutodiscoveryDeviceTemplateMatchs(); + } + if (!in_array($l, $this->collAutodiscoveryDeviceTemplateMatchs, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDeviceTemplateMatchs, $l); + $l->setAutodiscoveryDevice($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this AutodiscoveryDevice is new, it will return + * an empty collection; or if this AutodiscoveryDevice has previously + * been saved, it will retrieve related AutodiscoveryDeviceTemplateMatchs 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 AutodiscoveryDevice. + */ + public function getAutodiscoveryDeviceTemplateMatchsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = $criteria; + + return $this->collAutodiscoveryDeviceTemplateMatchs; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collAutodiscoveryDeviceServices) { + foreach ((array) $this->collAutodiscoveryDeviceServices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collAutodiscoveryDeviceTemplateMatchs) { + foreach ((array) $this->collAutodiscoveryDeviceTemplateMatchs as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collAutodiscoveryDeviceServices = null; + $this->collAutodiscoveryDeviceTemplateMatchs = null; + $this->aAutodiscoveryJob = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + } + +} // BaseAutodiscoveryDevice diff --git a/classes/om/BaseAutodiscoveryDevicePeer.php b/classes/om/BaseAutodiscoveryDevicePeer.php new file mode 100755 index 0000000..614ea83 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDevicePeer.php @@ -0,0 +1,1754 @@ + array ('Id', 'JobId', 'Address', 'Name', 'Hostname', 'Description', 'Osvendor', 'Osfamily', 'Osgen', 'HostTemplate', 'ProposedParent', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'jobId', 'address', 'name', 'hostname', 'description', 'osvendor', 'osfamily', 'osgen', 'hostTemplate', 'proposedParent', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::JOB_ID, self::ADDRESS, self::NAME, self::HOSTNAME, self::DESCRIPTION, self::OSVENDOR, self::OSFAMILY, self::OSGEN, self::HOST_TEMPLATE, self::PROPOSED_PARENT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'job_id', 'address', 'name', 'hostname', 'description', 'osvendor', 'osfamily', 'osgen', 'host_template', 'proposed_parent', ), + 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, 'JobId' => 1, 'Address' => 2, 'Name' => 3, 'Hostname' => 4, 'Description' => 5, 'Osvendor' => 6, 'Osfamily' => 7, 'Osgen' => 8, 'HostTemplate' => 9, 'ProposedParent' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'jobId' => 1, 'address' => 2, 'name' => 3, 'hostname' => 4, 'description' => 5, 'osvendor' => 6, 'osfamily' => 7, 'osgen' => 8, 'hostTemplate' => 9, 'proposedParent' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::JOB_ID => 1, self::ADDRESS => 2, self::NAME => 3, self::HOSTNAME => 4, self::DESCRIPTION => 5, self::OSVENDOR => 6, self::OSFAMILY => 7, self::OSGEN => 8, self::HOST_TEMPLATE => 9, self::PROPOSED_PARENT => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'job_id' => 1, 'address' => 2, 'name' => 3, 'hostname' => 4, 'description' => 5, 'osvendor' => 6, 'osfamily' => 7, 'osgen' => 8, 'host_template' => 9, 'proposed_parent' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new AutodiscoveryDeviceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AutodiscoveryDevicePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AutodiscoveryDevicePeer::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) + { + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::ID); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::JOB_ID); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::ADDRESS); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::NAME); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::HOSTNAME); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::DESCRIPTION); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::OSVENDOR); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::OSFAMILY); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::OSGEN); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(AutodiscoveryDevicePeer::PROPOSED_PARENT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return AutodiscoveryDevice + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AutodiscoveryDevicePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return AutodiscoveryDevicePeer::populateObjects(AutodiscoveryDevicePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param AutodiscoveryDevice $value A AutodiscoveryDevice object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(AutodiscoveryDevice $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A AutodiscoveryDevice object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof AutodiscoveryDevice) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AutodiscoveryDevice object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return AutodiscoveryDevice Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AutodiscoveryDevicePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = AutodiscoveryDevicePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AutodiscoveryDevicePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryJob table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAutodiscoveryJob(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with their AutodiscoveryJob objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAutodiscoveryJob(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + AutodiscoveryJobPeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to $obj2 (NagiosHostTemplate) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to $obj2 (NagiosHost) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryJobPeer::NUM_COLUMNS - AutodiscoveryJobPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryJob rows + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryDevice($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addAutodiscoveryDevice($obj1); + } // if joined row not null + + // Add objects for joined NagiosHost rows + + $key4 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj4 (NagiosHost) + $obj4->addAutodiscoveryDevice($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryJob table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptAutodiscoveryJob(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDevicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDevicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with all related objects except AutodiscoveryJob. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptAutodiscoveryJob(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj3 (NagiosHost) + $obj3->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryJobPeer::NUM_COLUMNS - AutodiscoveryJobPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDevicePeer::PROPOSED_PARENT,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryJob rows + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj3 (NagiosHost) + $obj3->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDevice objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDevice objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryJobPeer::NUM_COLUMNS - AutodiscoveryJobPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDevicePeer::JOB_ID,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDevicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDevicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDevicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryJob rows + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (AutodiscoveryDevice) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addAutodiscoveryDevice($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 AutodiscoveryDevicePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AutodiscoveryDevice or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDevice object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AutodiscoveryDevice object + } + + if ($criteria->containsKey(AutodiscoveryDevicePeer::ID) && $criteria->keyContainsValue(AutodiscoveryDevicePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AutodiscoveryDevicePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AutodiscoveryDevice or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDevice object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(AutodiscoveryDevicePeer::ID); + $selectCriteria->add(AutodiscoveryDevicePeer::ID, $criteria->remove(AutodiscoveryDevicePeer::ID), $comparison); + + } else { // $values is AutodiscoveryDevice object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the autodiscovery_device 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(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += AutodiscoveryDevicePeer::doOnDeleteCascade(new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(AutodiscoveryDevicePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AutodiscoveryDevice or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AutodiscoveryDevice object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + AutodiscoveryDevicePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof AutodiscoveryDevice) { + // invalidate the cache for this single object + AutodiscoveryDevicePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(AutodiscoveryDevicePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + AutodiscoveryDevicePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += AutodiscoveryDevicePeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + AutodiscoveryDevicePeer::clearInstancePool(); + } else { // it's a PK or object + AutodiscoveryDevicePeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in AutodiscoveryDeviceServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDeviceServicePeer::clearInstancePool(); + + // invalidate objects in AutodiscoveryDeviceTemplateMatchPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDeviceTemplateMatchPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = AutodiscoveryDevicePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related AutodiscoveryDeviceService objects + $c = new Criteria(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + + $c->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $obj->getId()); + $affectedRows += AutodiscoveryDeviceServicePeer::doDelete($c, $con); + + // delete related AutodiscoveryDeviceTemplateMatch objects + $c = new Criteria(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + + $c->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $obj->getId()); + $affectedRows += AutodiscoveryDeviceTemplateMatchPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given AutodiscoveryDevice 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 AutodiscoveryDevice $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(AutodiscoveryDevice $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AutodiscoveryDevicePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AutodiscoveryDevicePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AutodiscoveryDevicePeer::DATABASE_NAME, AutodiscoveryDevicePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return AutodiscoveryDevice + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = AutodiscoveryDevicePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDevicePeer::ID, $pk); + + $v = AutodiscoveryDevicePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDevicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDevicePeer::ID, $pks, Criteria::IN); + $objs = AutodiscoveryDevicePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseAutodiscoveryDevicePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the AutodiscoveryDevicePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the AutodiscoveryDevicePeer class: +// +// Propel::getDatabaseMap(AutodiscoveryDevicePeer::DATABASE_NAME)->addTableBuilder(AutodiscoveryDevicePeer::TABLE_NAME, AutodiscoveryDevicePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseAutodiscoveryDevicePeer::DATABASE_NAME)->addTableBuilder(BaseAutodiscoveryDevicePeer::TABLE_NAME, BaseAutodiscoveryDevicePeer::getMapBuilder()); + diff --git a/classes/om/BaseAutodiscoveryDeviceService.php b/classes/om/BaseAutodiscoveryDeviceService.php new file mode 100755 index 0000000..3186058 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDeviceService.php @@ -0,0 +1,1047 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [device_id] column value. + * + * @return int + */ + public function getDeviceId() + { + return $this->device_id; + } + + /** + * Get the [protocol] column value. + * + * @return string + */ + public function getProtocol() + { + return $this->protocol; + } + + /** + * Get the [port] column value. + * + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [product] column value. + * + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Get the [version] column value. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Get the [extrainfo] column value. + * + * @return string + */ + public function getExtrainfo() + { + return $this->extrainfo; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [device_id] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setDeviceId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->device_id !== $v) { + $this->device_id = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::DEVICE_ID; + } + + if ($this->aAutodiscoveryDevice !== null && $this->aAutodiscoveryDevice->getId() !== $v) { + $this->aAutodiscoveryDevice = null; + } + + return $this; + } // setDeviceId() + + /** + * Set the value of [protocol] column. + * + * @param string $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setProtocol($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->protocol !== $v) { + $this->protocol = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::PROTOCOL; + } + + return $this; + } // setProtocol() + + /** + * Set the value of [port] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setPort($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->port !== $v) { + $this->port = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::PORT; + } + + return $this; + } // setPort() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [product] column. + * + * @param string $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setProduct($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->product !== $v) { + $this->product = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::PRODUCT; + } + + return $this; + } // setProduct() + + /** + * Set the value of [version] column. + * + * @param string $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setVersion($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->version !== $v) { + $this->version = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::VERSION; + } + + return $this; + } // setVersion() + + /** + * Set the value of [extrainfo] column. + * + * @param string $v new value + * @return AutodiscoveryDeviceService The current object (for fluent API support) + */ + public function setExtrainfo($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->extrainfo !== $v) { + $this->extrainfo = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::EXTRAINFO; + } + + return $this; + } // setExtrainfo() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->device_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->protocol = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->port = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->product = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->version = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->extrainfo = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 8; // 8 = AutodiscoveryDeviceServicePeer::NUM_COLUMNS - AutodiscoveryDeviceServicePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AutodiscoveryDeviceService object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aAutodiscoveryDevice !== null && $this->device_id !== $this->aAutodiscoveryDevice->getId()) { + $this->aAutodiscoveryDevice = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = AutodiscoveryDeviceServicePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aAutodiscoveryDevice = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + AutodiscoveryDeviceServicePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + AutodiscoveryDeviceServicePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aAutodiscoveryDevice !== null) { + if ($this->aAutodiscoveryDevice->isModified() || $this->aAutodiscoveryDevice->isNew()) { + $affectedRows += $this->aAutodiscoveryDevice->save($con); + } + $this->setAutodiscoveryDevice($this->aAutodiscoveryDevice); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = AutodiscoveryDeviceServicePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AutodiscoveryDeviceServicePeer::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 + + $this->setNew(false); + } else { + $affectedRows += AutodiscoveryDeviceServicePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aAutodiscoveryDevice !== null) { + if (!$this->aAutodiscoveryDevice->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aAutodiscoveryDevice->getValidationFailures()); + } + } + + + if (($retval = AutodiscoveryDeviceServicePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDeviceServicePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDeviceId(); + break; + case 2: + return $this->getProtocol(); + break; + case 3: + return $this->getPort(); + break; + case 4: + return $this->getName(); + break; + case 5: + return $this->getProduct(); + break; + case 6: + return $this->getVersion(); + break; + case 7: + return $this->getExtrainfo(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = AutodiscoveryDeviceServicePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDeviceId(), + $keys[2] => $this->getProtocol(), + $keys[3] => $this->getPort(), + $keys[4] => $this->getName(), + $keys[5] => $this->getProduct(), + $keys[6] => $this->getVersion(), + $keys[7] => $this->getExtrainfo(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDeviceServicePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDeviceId($value); + break; + case 2: + $this->setProtocol($value); + break; + case 3: + $this->setPort($value); + break; + case 4: + $this->setName($value); + break; + case 5: + $this->setProduct($value); + break; + case 6: + $this->setVersion($value); + break; + case 7: + $this->setExtrainfo($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = AutodiscoveryDeviceServicePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDeviceId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setProtocol($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPort($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setName($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setProduct($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setExtrainfo($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(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::ID)) $criteria->add(AutodiscoveryDeviceServicePeer::ID, $this->id); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::DEVICE_ID)) $criteria->add(AutodiscoveryDeviceServicePeer::DEVICE_ID, $this->device_id); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::PROTOCOL)) $criteria->add(AutodiscoveryDeviceServicePeer::PROTOCOL, $this->protocol); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::PORT)) $criteria->add(AutodiscoveryDeviceServicePeer::PORT, $this->port); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::NAME)) $criteria->add(AutodiscoveryDeviceServicePeer::NAME, $this->name); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::PRODUCT)) $criteria->add(AutodiscoveryDeviceServicePeer::PRODUCT, $this->product); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::VERSION)) $criteria->add(AutodiscoveryDeviceServicePeer::VERSION, $this->version); + if ($this->isColumnModified(AutodiscoveryDeviceServicePeer::EXTRAINFO)) $criteria->add(AutodiscoveryDeviceServicePeer::EXTRAINFO, $this->extrainfo); + + 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(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + + $criteria->add(AutodiscoveryDeviceServicePeer::ID, $this->id); + + 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 AutodiscoveryDeviceService (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) + { + + $copyObj->setDeviceId($this->device_id); + + $copyObj->setProtocol($this->protocol); + + $copyObj->setPort($this->port); + + $copyObj->setName($this->name); + + $copyObj->setProduct($this->product); + + $copyObj->setVersion($this->version); + + $copyObj->setExtrainfo($this->extrainfo); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 AutodiscoveryDeviceService 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); + $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 AutodiscoveryDeviceServicePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AutodiscoveryDeviceServicePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a AutodiscoveryDevice object. + * + * @param AutodiscoveryDevice $v + * @return AutodiscoveryDeviceService The current object (for fluent API support) + * @throws PropelException + */ + public function setAutodiscoveryDevice(AutodiscoveryDevice $v = null) + { + if ($v === null) { + $this->setDeviceId(NULL); + } else { + $this->setDeviceId($v->getId()); + } + + $this->aAutodiscoveryDevice = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the AutodiscoveryDevice object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDeviceService($this); + } + + return $this; + } + + + /** + * Get the associated AutodiscoveryDevice object + * + * @param PropelPDO Optional Connection object. + * @return AutodiscoveryDevice The associated AutodiscoveryDevice object. + * @throws PropelException + */ + public function getAutodiscoveryDevice(PropelPDO $con = null) + { + if ($this->aAutodiscoveryDevice === null && ($this->device_id !== null)) { + $c = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + $c->add(AutodiscoveryDevicePeer::ID, $this->device_id); + $this->aAutodiscoveryDevice = AutodiscoveryDevicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aAutodiscoveryDevice->addAutodiscoveryDeviceServices($this); + */ + } + return $this->aAutodiscoveryDevice; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aAutodiscoveryDevice = null; + } + +} // BaseAutodiscoveryDeviceService diff --git a/classes/om/BaseAutodiscoveryDeviceServicePeer.php b/classes/om/BaseAutodiscoveryDeviceServicePeer.php new file mode 100755 index 0000000..9363d78 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDeviceServicePeer.php @@ -0,0 +1,952 @@ + array ('Id', 'DeviceId', 'Protocol', 'Port', 'Name', 'Product', 'Version', 'Extrainfo', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'deviceId', 'protocol', 'port', 'name', 'product', 'version', 'extrainfo', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DEVICE_ID, self::PROTOCOL, self::PORT, self::NAME, self::PRODUCT, self::VERSION, self::EXTRAINFO, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'device_id', 'protocol', 'port', 'name', 'product', 'version', 'extrainfo', ), + 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, 'DeviceId' => 1, 'Protocol' => 2, 'Port' => 3, 'Name' => 4, 'Product' => 5, 'Version' => 6, 'Extrainfo' => 7, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'deviceId' => 1, 'protocol' => 2, 'port' => 3, 'name' => 4, 'product' => 5, 'version' => 6, 'extrainfo' => 7, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DEVICE_ID => 1, self::PROTOCOL => 2, self::PORT => 3, self::NAME => 4, self::PRODUCT => 5, self::VERSION => 6, self::EXTRAINFO => 7, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'device_id' => 1, 'protocol' => 2, 'port' => 3, 'name' => 4, 'product' => 5, 'version' => 6, 'extrainfo' => 7, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new AutodiscoveryDeviceServiceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AutodiscoveryDeviceServicePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AutodiscoveryDeviceServicePeer::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) + { + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::ID); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::DEVICE_ID); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::PROTOCOL); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::PORT); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::NAME); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::PRODUCT); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::VERSION); + + $criteria->addSelectColumn(AutodiscoveryDeviceServicePeer::EXTRAINFO); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return AutodiscoveryDeviceService + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AutodiscoveryDeviceServicePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return AutodiscoveryDeviceServicePeer::populateObjects(AutodiscoveryDeviceServicePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param AutodiscoveryDeviceService $value A AutodiscoveryDeviceService object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(AutodiscoveryDeviceService $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A AutodiscoveryDeviceService object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof AutodiscoveryDeviceService) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AutodiscoveryDeviceService object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return AutodiscoveryDeviceService Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AutodiscoveryDeviceServicePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = AutodiscoveryDeviceServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = AutodiscoveryDeviceServicePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AutodiscoveryDeviceServicePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryDevice table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAutodiscoveryDevice(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceServicePeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryDeviceService objects pre-filled with their AutodiscoveryDevice objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAutodiscoveryDevice(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceServicePeer::addSelectColumns($c); + $startcol = (AutodiscoveryDeviceServicePeer::NUM_COLUMNS - AutodiscoveryDeviceServicePeer::NUM_LAZY_LOAD_COLUMNS); + AutodiscoveryDevicePeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDeviceServicePeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDeviceServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = AutodiscoveryDevicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + AutodiscoveryDevicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDeviceService) to $obj2 (AutodiscoveryDevice) + $obj2->addAutodiscoveryDeviceService($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceServicePeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of AutodiscoveryDeviceService objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceServicePeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDeviceServicePeer::NUM_COLUMNS - AutodiscoveryDeviceServicePeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDeviceServicePeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDeviceServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryDevice rows + + $key2 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryDevicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryDevicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (AutodiscoveryDeviceService) to the collection in $obj2 (AutodiscoveryDevice) + $obj2->addAutodiscoveryDeviceService($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 AutodiscoveryDeviceServicePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AutodiscoveryDeviceService or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDeviceService object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AutodiscoveryDeviceService object + } + + if ($criteria->containsKey(AutodiscoveryDeviceServicePeer::ID) && $criteria->keyContainsValue(AutodiscoveryDeviceServicePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AutodiscoveryDeviceServicePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AutodiscoveryDeviceService or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDeviceService object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(AutodiscoveryDeviceServicePeer::ID); + $selectCriteria->add(AutodiscoveryDeviceServicePeer::ID, $criteria->remove(AutodiscoveryDeviceServicePeer::ID), $comparison); + + } else { // $values is AutodiscoveryDeviceService object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the autodiscovery_device_service 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(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(AutodiscoveryDeviceServicePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AutodiscoveryDeviceService or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AutodiscoveryDeviceService object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + AutodiscoveryDeviceServicePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof AutodiscoveryDeviceService) { + // invalidate the cache for this single object + AutodiscoveryDeviceServicePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceServicePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + AutodiscoveryDeviceServicePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given AutodiscoveryDeviceService 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 AutodiscoveryDeviceService $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(AutodiscoveryDeviceService $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AutodiscoveryDeviceServicePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AutodiscoveryDeviceServicePeer::DATABASE_NAME, AutodiscoveryDeviceServicePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return AutodiscoveryDeviceService + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = AutodiscoveryDeviceServicePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceServicePeer::ID, $pk); + + $v = AutodiscoveryDeviceServicePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(AutodiscoveryDeviceServicePeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceServicePeer::ID, $pks, Criteria::IN); + $objs = AutodiscoveryDeviceServicePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseAutodiscoveryDeviceServicePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the AutodiscoveryDeviceServicePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the AutodiscoveryDeviceServicePeer class: +// +// Propel::getDatabaseMap(AutodiscoveryDeviceServicePeer::DATABASE_NAME)->addTableBuilder(AutodiscoveryDeviceServicePeer::TABLE_NAME, AutodiscoveryDeviceServicePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseAutodiscoveryDeviceServicePeer::DATABASE_NAME)->addTableBuilder(BaseAutodiscoveryDeviceServicePeer::TABLE_NAME, BaseAutodiscoveryDeviceServicePeer::getMapBuilder()); + diff --git a/classes/om/BaseAutodiscoveryDeviceTemplateMatch.php b/classes/om/BaseAutodiscoveryDeviceTemplateMatch.php new file mode 100755 index 0000000..73a8780 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDeviceTemplateMatch.php @@ -0,0 +1,981 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [device_id] column value. + * + * @return int + */ + public function getDeviceId() + { + return $this->device_id; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [percent] column value. + * + * @return double + */ + public function getPercent() + { + return $this->percent; + } + + /** + * Get the [complexity] column value. + * + * @return int + */ + public function getComplexity() + { + return $this->complexity; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [device_id] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + */ + public function setDeviceId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->device_id !== $v) { + $this->device_id = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID; + } + + if ($this->aAutodiscoveryDevice !== null && $this->aAutodiscoveryDevice->getId() !== $v) { + $this->aAutodiscoveryDevice = null; + } + + return $this; + } // setDeviceId() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [percent] column. + * + * @param double $v new value + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + */ + public function setPercent($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->percent !== $v) { + $this->percent = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::PERCENT; + } + + return $this; + } // setPercent() + + /** + * Set the value of [complexity] column. + * + * @param int $v new value + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + */ + public function setComplexity($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->complexity !== $v) { + $this->complexity = $v; + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::COMPLEXITY; + } + + return $this; + } // setComplexity() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->device_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->percent = ($row[$startcol + 3] !== null) ? (double) $row[$startcol + 3] : null; + $this->complexity = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AutodiscoveryDeviceTemplateMatch object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aAutodiscoveryDevice !== null && $this->device_id !== $this->aAutodiscoveryDevice->getId()) { + $this->aAutodiscoveryDevice = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = AutodiscoveryDeviceTemplateMatchPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aAutodiscoveryDevice = null; + $this->aNagiosHostTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + AutodiscoveryDeviceTemplateMatchPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aAutodiscoveryDevice !== null) { + if ($this->aAutodiscoveryDevice->isModified() || $this->aAutodiscoveryDevice->isNew()) { + $affectedRows += $this->aAutodiscoveryDevice->save($con); + } + $this->setAutodiscoveryDevice($this->aAutodiscoveryDevice); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = AutodiscoveryDeviceTemplateMatchPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AutodiscoveryDeviceTemplateMatchPeer::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 + + $this->setNew(false); + } else { + $affectedRows += AutodiscoveryDeviceTemplateMatchPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aAutodiscoveryDevice !== null) { + if (!$this->aAutodiscoveryDevice->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aAutodiscoveryDevice->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + + if (($retval = AutodiscoveryDeviceTemplateMatchPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDeviceTemplateMatchPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDeviceId(); + break; + case 2: + return $this->getHostTemplate(); + break; + case 3: + return $this->getPercent(); + break; + case 4: + return $this->getComplexity(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = AutodiscoveryDeviceTemplateMatchPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDeviceId(), + $keys[2] => $this->getHostTemplate(), + $keys[3] => $this->getPercent(), + $keys[4] => $this->getComplexity(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryDeviceTemplateMatchPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDeviceId($value); + break; + case 2: + $this->setHostTemplate($value); + break; + case 3: + $this->setPercent($value); + break; + case 4: + $this->setComplexity($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = AutodiscoveryDeviceTemplateMatchPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDeviceId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPercent($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setComplexity($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(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + + if ($this->isColumnModified(AutodiscoveryDeviceTemplateMatchPeer::ID)) $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, $this->id); + if ($this->isColumnModified(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID)) $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID, $this->device_id); + if ($this->isColumnModified(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE)) $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(AutodiscoveryDeviceTemplateMatchPeer::PERCENT)) $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::PERCENT, $this->percent); + if ($this->isColumnModified(AutodiscoveryDeviceTemplateMatchPeer::COMPLEXITY)) $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::COMPLEXITY, $this->complexity); + + 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(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, $this->id); + + 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 AutodiscoveryDeviceTemplateMatch (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) + { + + $copyObj->setDeviceId($this->device_id); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setPercent($this->percent); + + $copyObj->setComplexity($this->complexity); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 AutodiscoveryDeviceTemplateMatch 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); + $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 AutodiscoveryDeviceTemplateMatchPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AutodiscoveryDeviceTemplateMatchPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a AutodiscoveryDevice object. + * + * @param AutodiscoveryDevice $v + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + * @throws PropelException + */ + public function setAutodiscoveryDevice(AutodiscoveryDevice $v = null) + { + if ($v === null) { + $this->setDeviceId(NULL); + } else { + $this->setDeviceId($v->getId()); + } + + $this->aAutodiscoveryDevice = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the AutodiscoveryDevice object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDeviceTemplateMatch($this); + } + + return $this; + } + + + /** + * Get the associated AutodiscoveryDevice object + * + * @param PropelPDO Optional Connection object. + * @return AutodiscoveryDevice The associated AutodiscoveryDevice object. + * @throws PropelException + */ + public function getAutodiscoveryDevice(PropelPDO $con = null) + { + if ($this->aAutodiscoveryDevice === null && ($this->device_id !== null)) { + $c = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + $c->add(AutodiscoveryDevicePeer::ID, $this->device_id); + $this->aAutodiscoveryDevice = AutodiscoveryDevicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aAutodiscoveryDevice->addAutodiscoveryDeviceTemplateMatchs($this); + */ + } + return $this->aAutodiscoveryDevice; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return AutodiscoveryDeviceTemplateMatch The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryDeviceTemplateMatch($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addAutodiscoveryDeviceTemplateMatchs($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aAutodiscoveryDevice = null; + $this->aNagiosHostTemplate = null; + } + +} // BaseAutodiscoveryDeviceTemplateMatch diff --git a/classes/om/BaseAutodiscoveryDeviceTemplateMatchPeer.php b/classes/om/BaseAutodiscoveryDeviceTemplateMatchPeer.php new file mode 100755 index 0000000..d391a61 --- /dev/null +++ b/classes/om/BaseAutodiscoveryDeviceTemplateMatchPeer.php @@ -0,0 +1,1326 @@ + array ('Id', 'DeviceId', 'HostTemplate', 'Percent', 'Complexity', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'deviceId', 'hostTemplate', 'percent', 'complexity', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DEVICE_ID, self::HOST_TEMPLATE, self::PERCENT, self::COMPLEXITY, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'device_id', 'host_template', 'percent', 'complexity', ), + 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, 'DeviceId' => 1, 'HostTemplate' => 2, 'Percent' => 3, 'Complexity' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'deviceId' => 1, 'hostTemplate' => 2, 'percent' => 3, 'complexity' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DEVICE_ID => 1, self::HOST_TEMPLATE => 2, self::PERCENT => 3, self::COMPLEXITY => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'device_id' => 1, 'host_template' => 2, 'percent' => 3, 'complexity' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new AutodiscoveryDeviceTemplateMatchMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AutodiscoveryDeviceTemplateMatchPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AutodiscoveryDeviceTemplateMatchPeer::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) + { + + $criteria->addSelectColumn(AutodiscoveryDeviceTemplateMatchPeer::ID); + + $criteria->addSelectColumn(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID); + + $criteria->addSelectColumn(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(AutodiscoveryDeviceTemplateMatchPeer::PERCENT); + + $criteria->addSelectColumn(AutodiscoveryDeviceTemplateMatchPeer::COMPLEXITY); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return AutodiscoveryDeviceTemplateMatch + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AutodiscoveryDeviceTemplateMatchPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return AutodiscoveryDeviceTemplateMatchPeer::populateObjects(AutodiscoveryDeviceTemplateMatchPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param AutodiscoveryDeviceTemplateMatch $value A AutodiscoveryDeviceTemplateMatch object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(AutodiscoveryDeviceTemplateMatch $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A AutodiscoveryDeviceTemplateMatch object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof AutodiscoveryDeviceTemplateMatch) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AutodiscoveryDeviceTemplateMatch object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return AutodiscoveryDeviceTemplateMatch Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryDevice table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAutodiscoveryDevice(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryDeviceTemplateMatch objects pre-filled with their AutodiscoveryDevice objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAutodiscoveryDevice(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($c); + $startcol = (AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS); + AutodiscoveryDevicePeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = AutodiscoveryDevicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + AutodiscoveryDevicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to $obj2 (AutodiscoveryDevice) + $obj2->addAutodiscoveryDeviceTemplateMatch($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDeviceTemplateMatch objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($c); + $startcol = (AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to $obj2 (NagiosHostTemplate) + $obj2->addAutodiscoveryDeviceTemplateMatch($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of AutodiscoveryDeviceTemplateMatch objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryDevice rows + + $key2 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryDevicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryDevicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to the collection in $obj2 (AutodiscoveryDevice) + $obj2->addAutodiscoveryDeviceTemplateMatch($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addAutodiscoveryDeviceTemplateMatch($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryDevice table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptAutodiscoveryDevice(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryDeviceTemplateMatch objects pre-filled with all related objects except AutodiscoveryDevice. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptAutodiscoveryDevice(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addAutodiscoveryDeviceTemplateMatch($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of AutodiscoveryDeviceTemplateMatch objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryDeviceTemplateMatchPeer::NUM_COLUMNS - AutodiscoveryDeviceTemplateMatchPeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryDevicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryDevicePeer::NUM_COLUMNS - AutodiscoveryDevicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryDeviceTemplateMatchPeer::DEVICE_ID,), array(AutodiscoveryDevicePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryDeviceTemplateMatchPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryDeviceTemplateMatchPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryDeviceTemplateMatchPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryDevice rows + + $key2 = AutodiscoveryDevicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryDevicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryDevicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryDevicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (AutodiscoveryDeviceTemplateMatch) to the collection in $obj2 (AutodiscoveryDevice) + $obj2->addAutodiscoveryDeviceTemplateMatch($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 AutodiscoveryDeviceTemplateMatchPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AutodiscoveryDeviceTemplateMatch or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDeviceTemplateMatch object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AutodiscoveryDeviceTemplateMatch object + } + + if ($criteria->containsKey(AutodiscoveryDeviceTemplateMatchPeer::ID) && $criteria->keyContainsValue(AutodiscoveryDeviceTemplateMatchPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AutodiscoveryDeviceTemplateMatchPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AutodiscoveryDeviceTemplateMatch or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryDeviceTemplateMatch object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(AutodiscoveryDeviceTemplateMatchPeer::ID); + $selectCriteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, $criteria->remove(AutodiscoveryDeviceTemplateMatchPeer::ID), $comparison); + + } else { // $values is AutodiscoveryDeviceTemplateMatch object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the autodiscovery_device_template_match 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(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AutodiscoveryDeviceTemplateMatch or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AutodiscoveryDeviceTemplateMatch object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + AutodiscoveryDeviceTemplateMatchPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof AutodiscoveryDeviceTemplateMatch) { + // invalidate the cache for this single object + AutodiscoveryDeviceTemplateMatchPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + AutodiscoveryDeviceTemplateMatchPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given AutodiscoveryDeviceTemplateMatch 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 AutodiscoveryDeviceTemplateMatch $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(AutodiscoveryDeviceTemplateMatch $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return AutodiscoveryDeviceTemplateMatch + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = AutodiscoveryDeviceTemplateMatchPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, $pk); + + $v = AutodiscoveryDeviceTemplateMatchPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::ID, $pks, Criteria::IN); + $objs = AutodiscoveryDeviceTemplateMatchPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseAutodiscoveryDeviceTemplateMatchPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the AutodiscoveryDeviceTemplateMatchPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the AutodiscoveryDeviceTemplateMatchPeer class: +// +// Propel::getDatabaseMap(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME)->addTableBuilder(AutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME, AutodiscoveryDeviceTemplateMatchPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseAutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME)->addTableBuilder(BaseAutodiscoveryDeviceTemplateMatchPeer::TABLE_NAME, BaseAutodiscoveryDeviceTemplateMatchPeer::getMapBuilder()); + diff --git a/classes/om/BaseAutodiscoveryJob.php b/classes/om/BaseAutodiscoveryJob.php new file mode 100755 index 0000000..6b7dd7d --- /dev/null +++ b/classes/om/BaseAutodiscoveryJob.php @@ -0,0 +1,1765 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [config] column value. + * + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Get the [optionally formatted] temporal [start_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStartTime($format = 'Y-m-d H:i:s') + { + if ($this->start_time === null) { + return null; + } + + + if ($this->start_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->start_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [optionally formatted] temporal [end_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getEndTime($format = 'Y-m-d H:i:s') + { + if ($this->end_time === null) { + return null; + } + + + if ($this->end_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->end_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [status] column value. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Get the [status_code] column value. + * + * @return int + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * Get the [optionally formatted] temporal [status_change_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStatusChangeTime($format = 'Y-m-d H:i:s') + { + if ($this->status_change_time === null) { + return null; + } + + + if ($this->status_change_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->status_change_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->status_change_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [stats] column value. + * + * @return string + */ + public function getStats() + { + return $this->stats; + } + + /** + * Get the [cmd] column value. + * + * @return string + */ + public function getCmd() + { + return $this->cmd; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [config] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setConfig($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->config !== $v) { + $this->config = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::CONFIG; + } + + return $this; + } // setConfig() + + /** + * Sets the value of [start_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setStartTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->start_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = AutodiscoveryJobPeer::START_TIME; + } + } // if either are not null + + return $this; + } // setStartTime() + + /** + * Sets the value of [end_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setEndTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->end_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->end_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = AutodiscoveryJobPeer::END_TIME; + } + } // if either are not null + + return $this; + } // setEndTime() + + /** + * Set the value of [status] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setStatus($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->status !== $v) { + $this->status = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::STATUS; + } + + return $this; + } // setStatus() + + /** + * Set the value of [status_code] column. + * + * @param int $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setStatusCode($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->status_code !== $v) { + $this->status_code = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::STATUS_CODE; + } + + return $this; + } // setStatusCode() + + /** + * Sets the value of [status_change_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setStatusChangeTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->status_change_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->status_change_time !== null && $tmpDt = new DateTime($this->status_change_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->status_change_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = AutodiscoveryJobPeer::STATUS_CHANGE_TIME; + } + } // if either are not null + + return $this; + } // setStatusChangeTime() + + /** + * Set the value of [stats] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setStats($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->stats !== $v) { + $this->stats = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::STATS; + } + + return $this; + } // setStats() + + /** + * Set the value of [cmd] column. + * + * @param string $v new value + * @return AutodiscoveryJob The current object (for fluent API support) + */ + public function setCmd($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cmd !== $v) { + $this->cmd = $v; + $this->modifiedColumns[] = AutodiscoveryJobPeer::CMD; + } + + return $this; + } // setCmd() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->config = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->start_time = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->end_time = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->status = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->status_code = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->status_change_time = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->stats = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->cmd = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 11; // 11 = AutodiscoveryJobPeer::NUM_COLUMNS - AutodiscoveryJobPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AutodiscoveryJob object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = AutodiscoveryJobPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collAutodiscoveryLogEntrys = null; + $this->lastAutodiscoveryLogEntryCriteria = null; + + $this->collAutodiscoveryDevices = null; + $this->lastAutodiscoveryDeviceCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + AutodiscoveryJobPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + AutodiscoveryJobPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = AutodiscoveryJobPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AutodiscoveryJobPeer::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 + + $this->setNew(false); + } else { + $affectedRows += AutodiscoveryJobPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collAutodiscoveryLogEntrys !== null) { + foreach ($this->collAutodiscoveryLogEntrys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = AutodiscoveryJobPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collAutodiscoveryLogEntrys !== null) { + foreach ($this->collAutodiscoveryLogEntrys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryJobPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getDescription(); + break; + case 3: + return $this->getConfig(); + break; + case 4: + return $this->getStartTime(); + break; + case 5: + return $this->getEndTime(); + break; + case 6: + return $this->getStatus(); + break; + case 7: + return $this->getStatusCode(); + break; + case 8: + return $this->getStatusChangeTime(); + break; + case 9: + return $this->getStats(); + break; + case 10: + return $this->getCmd(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = AutodiscoveryJobPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getDescription(), + $keys[3] => $this->getConfig(), + $keys[4] => $this->getStartTime(), + $keys[5] => $this->getEndTime(), + $keys[6] => $this->getStatus(), + $keys[7] => $this->getStatusCode(), + $keys[8] => $this->getStatusChangeTime(), + $keys[9] => $this->getStats(), + $keys[10] => $this->getCmd(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryJobPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setDescription($value); + break; + case 3: + $this->setConfig($value); + break; + case 4: + $this->setStartTime($value); + break; + case 5: + $this->setEndTime($value); + break; + case 6: + $this->setStatus($value); + break; + case 7: + $this->setStatusCode($value); + break; + case 8: + $this->setStatusChangeTime($value); + break; + case 9: + $this->setStats($value); + break; + case 10: + $this->setCmd($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = AutodiscoveryJobPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setConfig($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setStartTime($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setEndTime($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setStatus($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setStatusCode($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setStatusChangeTime($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setStats($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCmd($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(AutodiscoveryJobPeer::DATABASE_NAME); + + if ($this->isColumnModified(AutodiscoveryJobPeer::ID)) $criteria->add(AutodiscoveryJobPeer::ID, $this->id); + if ($this->isColumnModified(AutodiscoveryJobPeer::NAME)) $criteria->add(AutodiscoveryJobPeer::NAME, $this->name); + if ($this->isColumnModified(AutodiscoveryJobPeer::DESCRIPTION)) $criteria->add(AutodiscoveryJobPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(AutodiscoveryJobPeer::CONFIG)) $criteria->add(AutodiscoveryJobPeer::CONFIG, $this->config); + if ($this->isColumnModified(AutodiscoveryJobPeer::START_TIME)) $criteria->add(AutodiscoveryJobPeer::START_TIME, $this->start_time); + if ($this->isColumnModified(AutodiscoveryJobPeer::END_TIME)) $criteria->add(AutodiscoveryJobPeer::END_TIME, $this->end_time); + if ($this->isColumnModified(AutodiscoveryJobPeer::STATUS)) $criteria->add(AutodiscoveryJobPeer::STATUS, $this->status); + if ($this->isColumnModified(AutodiscoveryJobPeer::STATUS_CODE)) $criteria->add(AutodiscoveryJobPeer::STATUS_CODE, $this->status_code); + if ($this->isColumnModified(AutodiscoveryJobPeer::STATUS_CHANGE_TIME)) $criteria->add(AutodiscoveryJobPeer::STATUS_CHANGE_TIME, $this->status_change_time); + if ($this->isColumnModified(AutodiscoveryJobPeer::STATS)) $criteria->add(AutodiscoveryJobPeer::STATS, $this->stats); + if ($this->isColumnModified(AutodiscoveryJobPeer::CMD)) $criteria->add(AutodiscoveryJobPeer::CMD, $this->cmd); + + 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(AutodiscoveryJobPeer::DATABASE_NAME); + + $criteria->add(AutodiscoveryJobPeer::ID, $this->id); + + 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 AutodiscoveryJob (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) + { + + $copyObj->setName($this->name); + + $copyObj->setDescription($this->description); + + $copyObj->setConfig($this->config); + + $copyObj->setStartTime($this->start_time); + + $copyObj->setEndTime($this->end_time); + + $copyObj->setStatus($this->status); + + $copyObj->setStatusCode($this->status_code); + + $copyObj->setStatusChangeTime($this->status_change_time); + + $copyObj->setStats($this->stats); + + $copyObj->setCmd($this->cmd); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getAutodiscoveryLogEntrys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryLogEntry($relObj->copy($deepCopy)); + } + } + + foreach ($this->getAutodiscoveryDevices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDevice($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 AutodiscoveryJob 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); + $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 AutodiscoveryJobPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AutodiscoveryJobPeer(); + } + return self::$peer; + } + + /** + * Clears out the collAutodiscoveryLogEntrys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryLogEntrys() + */ + public function clearAutodiscoveryLogEntrys() + { + $this->collAutodiscoveryLogEntrys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryLogEntrys collection (array). + * + * By default this just sets the collAutodiscoveryLogEntrys collection to an empty array (like clearcollAutodiscoveryLogEntrys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryLogEntrys() + { + $this->collAutodiscoveryLogEntrys = array(); + } + + /** + * Gets an array of AutodiscoveryLogEntry objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this AutodiscoveryJob has previously been saved, it will retrieve + * related AutodiscoveryLogEntrys from storage. If this AutodiscoveryJob is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryLogEntry[] + * @throws PropelException + */ + public function getAutodiscoveryLogEntrys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryLogEntrys === null) { + if ($this->isNew()) { + $this->collAutodiscoveryLogEntrys = array(); + } else { + + $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id); + + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + $this->collAutodiscoveryLogEntrys = AutodiscoveryLogEntryPeer::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. + + + $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id); + + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryLogEntryCriteria) || !$this->lastAutodiscoveryLogEntryCriteria->equals($criteria)) { + $this->collAutodiscoveryLogEntrys = AutodiscoveryLogEntryPeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryLogEntryCriteria = $criteria; + return $this->collAutodiscoveryLogEntrys; + } + + /** + * Returns the number of related AutodiscoveryLogEntry objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryLogEntry objects. + * @throws PropelException + */ + public function countAutodiscoveryLogEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryLogEntrys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id); + + $count = AutodiscoveryLogEntryPeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id); + + if (!isset($this->lastAutodiscoveryLogEntryCriteria) || !$this->lastAutodiscoveryLogEntryCriteria->equals($criteria)) { + $count = AutodiscoveryLogEntryPeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryLogEntrys); + } + } else { + $count = count($this->collAutodiscoveryLogEntrys); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryLogEntry object to this object + * through the AutodiscoveryLogEntry foreign key attribute. + * + * @param AutodiscoveryLogEntry $l AutodiscoveryLogEntry + * @return void + * @throws PropelException + */ + public function addAutodiscoveryLogEntry(AutodiscoveryLogEntry $l) + { + if ($this->collAutodiscoveryLogEntrys === null) { + $this->initAutodiscoveryLogEntrys(); + } + if (!in_array($l, $this->collAutodiscoveryLogEntrys, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryLogEntrys, $l); + $l->setAutodiscoveryJob($this); + } + } + + /** + * Clears out the collAutodiscoveryDevices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDevices() + */ + public function clearAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDevices collection (array). + * + * By default this just sets the collAutodiscoveryDevices collection to an empty array (like clearcollAutodiscoveryDevices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = array(); + } + + /** + * Gets an array of AutodiscoveryDevice objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this AutodiscoveryJob has previously been saved, it will retrieve + * related AutodiscoveryDevices from storage. If this AutodiscoveryJob is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDevice[] + * @throws PropelException + */ + public function getAutodiscoveryDevices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::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. + + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + return $this->collAutodiscoveryDevices; + } + + /** + * Returns the number of related AutodiscoveryDevice objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDevice objects. + * @throws PropelException + */ + public function countAutodiscoveryDevices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + $count = AutodiscoveryDevicePeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $count = AutodiscoveryDevicePeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDevices); + } + } else { + $count = count($this->collAutodiscoveryDevices); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDevice object to this object + * through the AutodiscoveryDevice foreign key attribute. + * + * @param AutodiscoveryDevice $l AutodiscoveryDevice + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDevice(AutodiscoveryDevice $l) + { + if ($this->collAutodiscoveryDevices === null) { + $this->initAutodiscoveryDevices(); + } + if (!in_array($l, $this->collAutodiscoveryDevices, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDevices, $l); + $l->setAutodiscoveryJob($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this AutodiscoveryJob is new, it will return + * an empty collection; or if this AutodiscoveryJob has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 AutodiscoveryJob. + */ + public function getAutodiscoveryDevicesJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this AutodiscoveryJob is new, it will return + * an empty collection; or if this AutodiscoveryJob has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 AutodiscoveryJob. + */ + public function getAutodiscoveryDevicesJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::JOB_ID, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collAutodiscoveryLogEntrys) { + foreach ((array) $this->collAutodiscoveryLogEntrys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collAutodiscoveryDevices) { + foreach ((array) $this->collAutodiscoveryDevices as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collAutodiscoveryLogEntrys = null; + $this->collAutodiscoveryDevices = null; + } + +} // BaseAutodiscoveryJob diff --git a/classes/om/BaseAutodiscoveryJobPeer.php b/classes/om/BaseAutodiscoveryJobPeer.php new file mode 100755 index 0000000..3c58781 --- /dev/null +++ b/classes/om/BaseAutodiscoveryJobPeer.php @@ -0,0 +1,787 @@ + array ('Id', 'Name', 'Description', 'Config', 'StartTime', 'EndTime', 'Status', 'StatusCode', 'StatusChangeTime', 'Stats', 'Cmd', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'description', 'config', 'startTime', 'endTime', 'status', 'statusCode', 'statusChangeTime', 'stats', 'cmd', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::CONFIG, self::START_TIME, self::END_TIME, self::STATUS, self::STATUS_CODE, self::STATUS_CHANGE_TIME, self::STATS, self::CMD, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'config', 'start_time', 'end_time', 'status', 'status_code', 'status_change_time', 'stats', 'cmd', ), + 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, 'Name' => 1, 'Description' => 2, 'Config' => 3, 'StartTime' => 4, 'EndTime' => 5, 'Status' => 6, 'StatusCode' => 7, 'StatusChangeTime' => 8, 'Stats' => 9, 'Cmd' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'startTime' => 4, 'endTime' => 5, 'status' => 6, 'statusCode' => 7, 'statusChangeTime' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::CONFIG => 3, self::START_TIME => 4, self::END_TIME => 5, self::STATUS => 6, self::STATUS_CODE => 7, self::STATUS_CHANGE_TIME => 8, self::STATS => 9, self::CMD => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'start_time' => 4, 'end_time' => 5, 'status' => 6, 'status_code' => 7, 'status_change_time' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new AutodiscoveryJobMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AutodiscoveryJobPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AutodiscoveryJobPeer::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) + { + + $criteria->addSelectColumn(AutodiscoveryJobPeer::ID); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::NAME); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::DESCRIPTION); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::CONFIG); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::START_TIME); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::END_TIME); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::STATUS); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::STATUS_CODE); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::STATUS_CHANGE_TIME); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::STATS); + + $criteria->addSelectColumn(AutodiscoveryJobPeer::CMD); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryJobPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryJobPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return AutodiscoveryJob + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AutodiscoveryJobPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return AutodiscoveryJobPeer::populateObjects(AutodiscoveryJobPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + AutodiscoveryJobPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param AutodiscoveryJob $value A AutodiscoveryJob object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(AutodiscoveryJob $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A AutodiscoveryJob object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof AutodiscoveryJob) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AutodiscoveryJob object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return AutodiscoveryJob Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AutodiscoveryJobPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = AutodiscoveryJobPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AutodiscoveryJobPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 AutodiscoveryJobPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AutodiscoveryJob or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryJob object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AutodiscoveryJob object + } + + if ($criteria->containsKey(AutodiscoveryJobPeer::ID) && $criteria->keyContainsValue(AutodiscoveryJobPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AutodiscoveryJobPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AutodiscoveryJob or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryJob object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(AutodiscoveryJobPeer::ID); + $selectCriteria->add(AutodiscoveryJobPeer::ID, $criteria->remove(AutodiscoveryJobPeer::ID), $comparison); + + } else { // $values is AutodiscoveryJob object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the autodiscovery_job 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(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += AutodiscoveryJobPeer::doOnDeleteCascade(new Criteria(AutodiscoveryJobPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(AutodiscoveryJobPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AutodiscoveryJob or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AutodiscoveryJob object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + AutodiscoveryJobPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof AutodiscoveryJob) { + // invalidate the cache for this single object + AutodiscoveryJobPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(AutodiscoveryJobPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + AutodiscoveryJobPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += AutodiscoveryJobPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + AutodiscoveryJobPeer::clearInstancePool(); + } else { // it's a PK or object + AutodiscoveryJobPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in AutodiscoveryLogEntryPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryLogEntryPeer::clearInstancePool(); + + // invalidate objects in AutodiscoveryDevicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDevicePeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = AutodiscoveryJobPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related AutodiscoveryLogEntry objects + $c = new Criteria(AutodiscoveryLogEntryPeer::DATABASE_NAME); + + $c->add(AutodiscoveryLogEntryPeer::JOB, $obj->getId()); + $affectedRows += AutodiscoveryLogEntryPeer::doDelete($c, $con); + + // delete related AutodiscoveryDevice objects + $c = new Criteria(AutodiscoveryDevicePeer::DATABASE_NAME); + + $c->add(AutodiscoveryDevicePeer::JOB_ID, $obj->getId()); + $affectedRows += AutodiscoveryDevicePeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given AutodiscoveryJob 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 AutodiscoveryJob $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(AutodiscoveryJob $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AutodiscoveryJobPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AutodiscoveryJobPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AutodiscoveryJobPeer::DATABASE_NAME, AutodiscoveryJobPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return AutodiscoveryJob + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = AutodiscoveryJobPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryJobPeer::ID, $pk); + + $v = AutodiscoveryJobPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryJobPeer::ID, $pks, Criteria::IN); + $objs = AutodiscoveryJobPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseAutodiscoveryJobPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the AutodiscoveryJobPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the AutodiscoveryJobPeer class: +// +// Propel::getDatabaseMap(AutodiscoveryJobPeer::DATABASE_NAME)->addTableBuilder(AutodiscoveryJobPeer::TABLE_NAME, AutodiscoveryJobPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseAutodiscoveryJobPeer::DATABASE_NAME)->addTableBuilder(BaseAutodiscoveryJobPeer::TABLE_NAME, BaseAutodiscoveryJobPeer::getMapBuilder()); + diff --git a/classes/om/BaseAutodiscoveryLogEntry.php b/classes/om/BaseAutodiscoveryLogEntry.php new file mode 100755 index 0000000..1dce5dc --- /dev/null +++ b/classes/om/BaseAutodiscoveryLogEntry.php @@ -0,0 +1,960 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [job] column value. + * + * @return int + */ + public function getJob() + { + return $this->job; + } + + /** + * Get the [optionally formatted] temporal [time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getTime($format = 'Y-m-d H:i:s') + { + if ($this->time === null) { + return null; + } + + + if ($this->time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [text] column value. + * + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Get the [type] column value. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return AutodiscoveryLogEntry The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [job] column. + * + * @param int $v new value + * @return AutodiscoveryLogEntry The current object (for fluent API support) + */ + public function setJob($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->job !== $v) { + $this->job = $v; + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::JOB; + } + + if ($this->aAutodiscoveryJob !== null && $this->aAutodiscoveryJob->getId() !== $v) { + $this->aAutodiscoveryJob = null; + } + + return $this; + } // setJob() + + /** + * Sets the value of [time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return AutodiscoveryLogEntry The current object (for fluent API support) + */ + public function setTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->time !== null && $tmpDt = new DateTime($this->time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::TIME; + } + } // if either are not null + + return $this; + } // setTime() + + /** + * Set the value of [text] column. + * + * @param string $v new value + * @return AutodiscoveryLogEntry The current object (for fluent API support) + */ + public function setText($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text !== $v) { + $this->text = $v; + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::TEXT; + } + + return $this; + } // setText() + + /** + * Set the value of [type] column. + * + * @param int $v new value + * @return AutodiscoveryLogEntry The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->job = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->text = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->type = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = AutodiscoveryLogEntryPeer::NUM_COLUMNS - AutodiscoveryLogEntryPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AutodiscoveryLogEntry object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aAutodiscoveryJob !== null && $this->job !== $this->aAutodiscoveryJob->getId()) { + $this->aAutodiscoveryJob = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = AutodiscoveryLogEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aAutodiscoveryJob = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + AutodiscoveryLogEntryPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + AutodiscoveryLogEntryPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aAutodiscoveryJob !== null) { + if ($this->aAutodiscoveryJob->isModified() || $this->aAutodiscoveryJob->isNew()) { + $affectedRows += $this->aAutodiscoveryJob->save($con); + } + $this->setAutodiscoveryJob($this->aAutodiscoveryJob); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = AutodiscoveryLogEntryPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AutodiscoveryLogEntryPeer::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 + + $this->setNew(false); + } else { + $affectedRows += AutodiscoveryLogEntryPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aAutodiscoveryJob !== null) { + if (!$this->aAutodiscoveryJob->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aAutodiscoveryJob->getValidationFailures()); + } + } + + + if (($retval = AutodiscoveryLogEntryPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryLogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getJob(); + break; + case 2: + return $this->getTime(); + break; + case 3: + return $this->getText(); + break; + case 4: + return $this->getType(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = AutodiscoveryLogEntryPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getJob(), + $keys[2] => $this->getTime(), + $keys[3] => $this->getText(), + $keys[4] => $this->getType(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AutodiscoveryLogEntryPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setJob($value); + break; + case 2: + $this->setTime($value); + break; + case 3: + $this->setText($value); + break; + case 4: + $this->setType($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = AutodiscoveryLogEntryPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setJob($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTime($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setText($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setType($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(AutodiscoveryLogEntryPeer::DATABASE_NAME); + + if ($this->isColumnModified(AutodiscoveryLogEntryPeer::ID)) $criteria->add(AutodiscoveryLogEntryPeer::ID, $this->id); + if ($this->isColumnModified(AutodiscoveryLogEntryPeer::JOB)) $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->job); + if ($this->isColumnModified(AutodiscoveryLogEntryPeer::TIME)) $criteria->add(AutodiscoveryLogEntryPeer::TIME, $this->time); + if ($this->isColumnModified(AutodiscoveryLogEntryPeer::TEXT)) $criteria->add(AutodiscoveryLogEntryPeer::TEXT, $this->text); + if ($this->isColumnModified(AutodiscoveryLogEntryPeer::TYPE)) $criteria->add(AutodiscoveryLogEntryPeer::TYPE, $this->type); + + 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(AutodiscoveryLogEntryPeer::DATABASE_NAME); + + $criteria->add(AutodiscoveryLogEntryPeer::ID, $this->id); + + 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 AutodiscoveryLogEntry (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) + { + + $copyObj->setJob($this->job); + + $copyObj->setTime($this->time); + + $copyObj->setText($this->text); + + $copyObj->setType($this->type); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 AutodiscoveryLogEntry 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); + $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 AutodiscoveryLogEntryPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AutodiscoveryLogEntryPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a AutodiscoveryJob object. + * + * @param AutodiscoveryJob $v + * @return AutodiscoveryLogEntry The current object (for fluent API support) + * @throws PropelException + */ + public function setAutodiscoveryJob(AutodiscoveryJob $v = null) + { + if ($v === null) { + $this->setJob(NULL); + } else { + $this->setJob($v->getId()); + } + + $this->aAutodiscoveryJob = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the AutodiscoveryJob object, it will not be re-added. + if ($v !== null) { + $v->addAutodiscoveryLogEntry($this); + } + + return $this; + } + + + /** + * Get the associated AutodiscoveryJob object + * + * @param PropelPDO Optional Connection object. + * @return AutodiscoveryJob The associated AutodiscoveryJob object. + * @throws PropelException + */ + public function getAutodiscoveryJob(PropelPDO $con = null) + { + if ($this->aAutodiscoveryJob === null && ($this->job !== null)) { + $c = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME); + $c->add(AutodiscoveryJobPeer::ID, $this->job); + $this->aAutodiscoveryJob = AutodiscoveryJobPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aAutodiscoveryJob->addAutodiscoveryLogEntrys($this); + */ + } + return $this->aAutodiscoveryJob; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aAutodiscoveryJob = null; + } + +} // BaseAutodiscoveryLogEntry diff --git a/classes/om/BaseAutodiscoveryLogEntryPeer.php b/classes/om/BaseAutodiscoveryLogEntryPeer.php new file mode 100755 index 0000000..4bb0565 --- /dev/null +++ b/classes/om/BaseAutodiscoveryLogEntryPeer.php @@ -0,0 +1,937 @@ + array ('Id', 'Job', 'Time', 'Text', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'job', 'time', 'text', 'type', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::JOB, self::TIME, self::TEXT, self::TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'job', 'time', 'text', 'type', ), + 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, 'Job' => 1, 'Time' => 2, 'Text' => 3, 'Type' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::JOB => 1, self::TIME => 2, self::TEXT => 3, self::TYPE => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new AutodiscoveryLogEntryMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AutodiscoveryLogEntryPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AutodiscoveryLogEntryPeer::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) + { + + $criteria->addSelectColumn(AutodiscoveryLogEntryPeer::ID); + + $criteria->addSelectColumn(AutodiscoveryLogEntryPeer::JOB); + + $criteria->addSelectColumn(AutodiscoveryLogEntryPeer::TIME); + + $criteria->addSelectColumn(AutodiscoveryLogEntryPeer::TEXT); + + $criteria->addSelectColumn(AutodiscoveryLogEntryPeer::TYPE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return AutodiscoveryLogEntry + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AutodiscoveryLogEntryPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return AutodiscoveryLogEntryPeer::populateObjects(AutodiscoveryLogEntryPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param AutodiscoveryLogEntry $value A AutodiscoveryLogEntry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(AutodiscoveryLogEntry $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A AutodiscoveryLogEntry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof AutodiscoveryLogEntry) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AutodiscoveryLogEntry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return AutodiscoveryLogEntry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AutodiscoveryLogEntryPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = AutodiscoveryLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = AutodiscoveryLogEntryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AutodiscoveryLogEntryPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related AutodiscoveryJob table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAutodiscoveryJob(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryLogEntryPeer::JOB,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of AutodiscoveryLogEntry objects pre-filled with their AutodiscoveryJob objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAutodiscoveryJob(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryLogEntryPeer::addSelectColumns($c); + $startcol = (AutodiscoveryLogEntryPeer::NUM_COLUMNS - AutodiscoveryLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + AutodiscoveryJobPeer::addSelectColumns($c); + + $c->addJoin(array(AutodiscoveryLogEntryPeer::JOB,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = AutodiscoveryLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (AutodiscoveryLogEntry) to $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryLogEntry($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(AutodiscoveryLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + AutodiscoveryLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(AutodiscoveryLogEntryPeer::JOB,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of AutodiscoveryLogEntry objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of AutodiscoveryLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + AutodiscoveryLogEntryPeer::addSelectColumns($c); + $startcol2 = (AutodiscoveryLogEntryPeer::NUM_COLUMNS - AutodiscoveryLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + + AutodiscoveryJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AutodiscoveryJobPeer::NUM_COLUMNS - AutodiscoveryJobPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(AutodiscoveryLogEntryPeer::JOB,), array(AutodiscoveryJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = AutodiscoveryLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = AutodiscoveryLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = AutodiscoveryLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + AutodiscoveryLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AutodiscoveryJob rows + + $key2 = AutodiscoveryJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AutodiscoveryJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AutodiscoveryJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AutodiscoveryJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (AutodiscoveryLogEntry) to the collection in $obj2 (AutodiscoveryJob) + $obj2->addAutodiscoveryLogEntry($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 AutodiscoveryLogEntryPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AutodiscoveryLogEntry or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryLogEntry object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AutodiscoveryLogEntry object + } + + if ($criteria->containsKey(AutodiscoveryLogEntryPeer::ID) && $criteria->keyContainsValue(AutodiscoveryLogEntryPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AutodiscoveryLogEntryPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AutodiscoveryLogEntry or Criteria object. + * + * @param mixed $values Criteria or AutodiscoveryLogEntry object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(AutodiscoveryLogEntryPeer::ID); + $selectCriteria->add(AutodiscoveryLogEntryPeer::ID, $criteria->remove(AutodiscoveryLogEntryPeer::ID), $comparison); + + } else { // $values is AutodiscoveryLogEntry object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the autodiscovery_log_entry 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(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(AutodiscoveryLogEntryPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AutodiscoveryLogEntry or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AutodiscoveryLogEntry object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + AutodiscoveryLogEntryPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof AutodiscoveryLogEntry) { + // invalidate the cache for this single object + AutodiscoveryLogEntryPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(AutodiscoveryLogEntryPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + AutodiscoveryLogEntryPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given AutodiscoveryLogEntry 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 AutodiscoveryLogEntry $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(AutodiscoveryLogEntry $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AutodiscoveryLogEntryPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AutodiscoveryLogEntryPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AutodiscoveryLogEntryPeer::DATABASE_NAME, AutodiscoveryLogEntryPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return AutodiscoveryLogEntry + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = AutodiscoveryLogEntryPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(AutodiscoveryLogEntryPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryLogEntryPeer::ID, $pk); + + $v = AutodiscoveryLogEntryPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AutodiscoveryLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(AutodiscoveryLogEntryPeer::DATABASE_NAME); + $criteria->add(AutodiscoveryLogEntryPeer::ID, $pks, Criteria::IN); + $objs = AutodiscoveryLogEntryPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseAutodiscoveryLogEntryPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the AutodiscoveryLogEntryPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the AutodiscoveryLogEntryPeer class: +// +// Propel::getDatabaseMap(AutodiscoveryLogEntryPeer::DATABASE_NAME)->addTableBuilder(AutodiscoveryLogEntryPeer::TABLE_NAME, AutodiscoveryLogEntryPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseAutodiscoveryLogEntryPeer::DATABASE_NAME)->addTableBuilder(BaseAutodiscoveryLogEntryPeer::TABLE_NAME, BaseAutodiscoveryLogEntryPeer::getMapBuilder()); + diff --git a/classes/om/BaseExportJob.php b/classes/om/BaseExportJob.php new file mode 100755 index 0000000..72a1dc8 --- /dev/null +++ b/classes/om/BaseExportJob.php @@ -0,0 +1,1476 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [config] column value. + * + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Get the [optionally formatted] temporal [start_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStartTime($format = 'Y-m-d H:i:s') + { + if ($this->start_time === null) { + return null; + } + + + if ($this->start_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->start_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [optionally formatted] temporal [end_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getEndTime($format = 'Y-m-d H:i:s') + { + if ($this->end_time === null) { + return null; + } + + + if ($this->end_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->end_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [status] column value. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Get the [status_code] column value. + * + * @return int + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * Get the [optionally formatted] temporal [status_change_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStatusChangeTime($format = 'Y-m-d H:i:s') + { + if ($this->status_change_time === null) { + return null; + } + + + if ($this->status_change_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->status_change_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->status_change_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [stats] column value. + * + * @return string + */ + public function getStats() + { + return $this->stats; + } + + /** + * Get the [cmd] column value. + * + * @return string + */ + public function getCmd() + { + return $this->cmd; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ExportJobPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = ExportJobPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = ExportJobPeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [config] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setConfig($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->config !== $v) { + $this->config = $v; + $this->modifiedColumns[] = ExportJobPeer::CONFIG; + } + + return $this; + } // setConfig() + + /** + * Sets the value of [start_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ExportJob The current object (for fluent API support) + */ + public function setStartTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->start_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ExportJobPeer::START_TIME; + } + } // if either are not null + + return $this; + } // setStartTime() + + /** + * Sets the value of [end_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ExportJob The current object (for fluent API support) + */ + public function setEndTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->end_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->end_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ExportJobPeer::END_TIME; + } + } // if either are not null + + return $this; + } // setEndTime() + + /** + * Set the value of [status] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setStatus($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->status !== $v) { + $this->status = $v; + $this->modifiedColumns[] = ExportJobPeer::STATUS; + } + + return $this; + } // setStatus() + + /** + * Set the value of [status_code] column. + * + * @param int $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setStatusCode($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->status_code !== $v) { + $this->status_code = $v; + $this->modifiedColumns[] = ExportJobPeer::STATUS_CODE; + } + + return $this; + } // setStatusCode() + + /** + * Sets the value of [status_change_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ExportJob The current object (for fluent API support) + */ + public function setStatusChangeTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->status_change_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->status_change_time !== null && $tmpDt = new DateTime($this->status_change_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->status_change_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ExportJobPeer::STATUS_CHANGE_TIME; + } + } // if either are not null + + return $this; + } // setStatusChangeTime() + + /** + * Set the value of [stats] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setStats($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->stats !== $v) { + $this->stats = $v; + $this->modifiedColumns[] = ExportJobPeer::STATS; + } + + return $this; + } // setStats() + + /** + * Set the value of [cmd] column. + * + * @param string $v new value + * @return ExportJob The current object (for fluent API support) + */ + public function setCmd($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cmd !== $v) { + $this->cmd = $v; + $this->modifiedColumns[] = ExportJobPeer::CMD; + } + + return $this; + } // setCmd() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->config = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->start_time = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->end_time = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->status = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->status_code = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->status_change_time = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->stats = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->cmd = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 11; // 11 = ExportJobPeer::NUM_COLUMNS - ExportJobPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ExportJob object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ExportJobPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collExportLogEntrys = null; + $this->lastExportLogEntryCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + ExportJobPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + ExportJobPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = ExportJobPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ExportJobPeer::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 + + $this->setNew(false); + } else { + $affectedRows += ExportJobPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collExportLogEntrys !== null) { + foreach ($this->collExportLogEntrys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = ExportJobPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collExportLogEntrys !== null) { + foreach ($this->collExportLogEntrys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ExportJobPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getDescription(); + break; + case 3: + return $this->getConfig(); + break; + case 4: + return $this->getStartTime(); + break; + case 5: + return $this->getEndTime(); + break; + case 6: + return $this->getStatus(); + break; + case 7: + return $this->getStatusCode(); + break; + case 8: + return $this->getStatusChangeTime(); + break; + case 9: + return $this->getStats(); + break; + case 10: + return $this->getCmd(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = ExportJobPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getDescription(), + $keys[3] => $this->getConfig(), + $keys[4] => $this->getStartTime(), + $keys[5] => $this->getEndTime(), + $keys[6] => $this->getStatus(), + $keys[7] => $this->getStatusCode(), + $keys[8] => $this->getStatusChangeTime(), + $keys[9] => $this->getStats(), + $keys[10] => $this->getCmd(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ExportJobPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setDescription($value); + break; + case 3: + $this->setConfig($value); + break; + case 4: + $this->setStartTime($value); + break; + case 5: + $this->setEndTime($value); + break; + case 6: + $this->setStatus($value); + break; + case 7: + $this->setStatusCode($value); + break; + case 8: + $this->setStatusChangeTime($value); + break; + case 9: + $this->setStats($value); + break; + case 10: + $this->setCmd($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = ExportJobPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setConfig($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setStartTime($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setEndTime($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setStatus($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setStatusCode($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setStatusChangeTime($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setStats($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCmd($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(ExportJobPeer::DATABASE_NAME); + + if ($this->isColumnModified(ExportJobPeer::ID)) $criteria->add(ExportJobPeer::ID, $this->id); + if ($this->isColumnModified(ExportJobPeer::NAME)) $criteria->add(ExportJobPeer::NAME, $this->name); + if ($this->isColumnModified(ExportJobPeer::DESCRIPTION)) $criteria->add(ExportJobPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(ExportJobPeer::CONFIG)) $criteria->add(ExportJobPeer::CONFIG, $this->config); + if ($this->isColumnModified(ExportJobPeer::START_TIME)) $criteria->add(ExportJobPeer::START_TIME, $this->start_time); + if ($this->isColumnModified(ExportJobPeer::END_TIME)) $criteria->add(ExportJobPeer::END_TIME, $this->end_time); + if ($this->isColumnModified(ExportJobPeer::STATUS)) $criteria->add(ExportJobPeer::STATUS, $this->status); + if ($this->isColumnModified(ExportJobPeer::STATUS_CODE)) $criteria->add(ExportJobPeer::STATUS_CODE, $this->status_code); + if ($this->isColumnModified(ExportJobPeer::STATUS_CHANGE_TIME)) $criteria->add(ExportJobPeer::STATUS_CHANGE_TIME, $this->status_change_time); + if ($this->isColumnModified(ExportJobPeer::STATS)) $criteria->add(ExportJobPeer::STATS, $this->stats); + if ($this->isColumnModified(ExportJobPeer::CMD)) $criteria->add(ExportJobPeer::CMD, $this->cmd); + + 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(ExportJobPeer::DATABASE_NAME); + + $criteria->add(ExportJobPeer::ID, $this->id); + + 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 ExportJob (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) + { + + $copyObj->setName($this->name); + + $copyObj->setDescription($this->description); + + $copyObj->setConfig($this->config); + + $copyObj->setStartTime($this->start_time); + + $copyObj->setEndTime($this->end_time); + + $copyObj->setStatus($this->status); + + $copyObj->setStatusCode($this->status_code); + + $copyObj->setStatusChangeTime($this->status_change_time); + + $copyObj->setStats($this->stats); + + $copyObj->setCmd($this->cmd); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getExportLogEntrys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addExportLogEntry($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 ExportJob 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); + $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 ExportJobPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ExportJobPeer(); + } + return self::$peer; + } + + /** + * Clears out the collExportLogEntrys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addExportLogEntrys() + */ + public function clearExportLogEntrys() + { + $this->collExportLogEntrys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collExportLogEntrys collection (array). + * + * By default this just sets the collExportLogEntrys collection to an empty array (like clearcollExportLogEntrys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initExportLogEntrys() + { + $this->collExportLogEntrys = array(); + } + + /** + * Gets an array of ExportLogEntry objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this ExportJob has previously been saved, it will retrieve + * related ExportLogEntrys from storage. If this ExportJob is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array ExportLogEntry[] + * @throws PropelException + */ + public function getExportLogEntrys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ExportJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collExportLogEntrys === null) { + if ($this->isNew()) { + $this->collExportLogEntrys = array(); + } else { + + $criteria->add(ExportLogEntryPeer::JOB, $this->id); + + ExportLogEntryPeer::addSelectColumns($criteria); + $this->collExportLogEntrys = ExportLogEntryPeer::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. + + + $criteria->add(ExportLogEntryPeer::JOB, $this->id); + + ExportLogEntryPeer::addSelectColumns($criteria); + if (!isset($this->lastExportLogEntryCriteria) || !$this->lastExportLogEntryCriteria->equals($criteria)) { + $this->collExportLogEntrys = ExportLogEntryPeer::doSelect($criteria, $con); + } + } + } + $this->lastExportLogEntryCriteria = $criteria; + return $this->collExportLogEntrys; + } + + /** + * Returns the number of related ExportLogEntry objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related ExportLogEntry objects. + * @throws PropelException + */ + public function countExportLogEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ExportJobPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collExportLogEntrys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(ExportLogEntryPeer::JOB, $this->id); + + $count = ExportLogEntryPeer::doCount($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 count of the collection. + + + $criteria->add(ExportLogEntryPeer::JOB, $this->id); + + if (!isset($this->lastExportLogEntryCriteria) || !$this->lastExportLogEntryCriteria->equals($criteria)) { + $count = ExportLogEntryPeer::doCount($criteria, $con); + } else { + $count = count($this->collExportLogEntrys); + } + } else { + $count = count($this->collExportLogEntrys); + } + } + return $count; + } + + /** + * Method called to associate a ExportLogEntry object to this object + * through the ExportLogEntry foreign key attribute. + * + * @param ExportLogEntry $l ExportLogEntry + * @return void + * @throws PropelException + */ + public function addExportLogEntry(ExportLogEntry $l) + { + if ($this->collExportLogEntrys === null) { + $this->initExportLogEntrys(); + } + if (!in_array($l, $this->collExportLogEntrys, true)) { // only add it if the **same** object is not already associated + array_push($this->collExportLogEntrys, $l); + $l->setExportJob($this); + } + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collExportLogEntrys) { + foreach ((array) $this->collExportLogEntrys as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collExportLogEntrys = null; + } + +} // BaseExportJob diff --git a/classes/om/BaseExportJobPeer.php b/classes/om/BaseExportJobPeer.php new file mode 100755 index 0000000..b8f6321 --- /dev/null +++ b/classes/om/BaseExportJobPeer.php @@ -0,0 +1,778 @@ + array ('Id', 'Name', 'Description', 'Config', 'StartTime', 'EndTime', 'Status', 'StatusCode', 'StatusChangeTime', 'Stats', 'Cmd', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'description', 'config', 'startTime', 'endTime', 'status', 'statusCode', 'statusChangeTime', 'stats', 'cmd', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::CONFIG, self::START_TIME, self::END_TIME, self::STATUS, self::STATUS_CODE, self::STATUS_CHANGE_TIME, self::STATS, self::CMD, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'config', 'start_time', 'end_time', 'status', 'status_code', 'status_change_time', 'stats', 'cmd', ), + 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, 'Name' => 1, 'Description' => 2, 'Config' => 3, 'StartTime' => 4, 'EndTime' => 5, 'Status' => 6, 'StatusCode' => 7, 'StatusChangeTime' => 8, 'Stats' => 9, 'Cmd' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'startTime' => 4, 'endTime' => 5, 'status' => 6, 'statusCode' => 7, 'statusChangeTime' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::CONFIG => 3, self::START_TIME => 4, self::END_TIME => 5, self::STATUS => 6, self::STATUS_CODE => 7, self::STATUS_CHANGE_TIME => 8, self::STATS => 9, self::CMD => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'start_time' => 4, 'end_time' => 5, 'status' => 6, 'status_code' => 7, 'status_change_time' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new ExportJobMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ExportJobPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ExportJobPeer::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) + { + + $criteria->addSelectColumn(ExportJobPeer::ID); + + $criteria->addSelectColumn(ExportJobPeer::NAME); + + $criteria->addSelectColumn(ExportJobPeer::DESCRIPTION); + + $criteria->addSelectColumn(ExportJobPeer::CONFIG); + + $criteria->addSelectColumn(ExportJobPeer::START_TIME); + + $criteria->addSelectColumn(ExportJobPeer::END_TIME); + + $criteria->addSelectColumn(ExportJobPeer::STATUS); + + $criteria->addSelectColumn(ExportJobPeer::STATUS_CODE); + + $criteria->addSelectColumn(ExportJobPeer::STATUS_CHANGE_TIME); + + $criteria->addSelectColumn(ExportJobPeer::STATS); + + $criteria->addSelectColumn(ExportJobPeer::CMD); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ExportJobPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ExportJobPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return ExportJob + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ExportJobPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return ExportJobPeer::populateObjects(ExportJobPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ExportJobPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param ExportJob $value A ExportJob object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(ExportJob $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A ExportJob object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof ExportJob) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ExportJob object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return ExportJob Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ExportJobPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ExportJobPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ExportJobPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ExportJobPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 ExportJobPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ExportJob or Criteria object. + * + * @param mixed $values Criteria or ExportJob object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ExportJob object + } + + if ($criteria->containsKey(ExportJobPeer::ID) && $criteria->keyContainsValue(ExportJobPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ExportJobPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ExportJob or Criteria object. + * + * @param mixed $values Criteria or ExportJob object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ExportJobPeer::ID); + $selectCriteria->add(ExportJobPeer::ID, $criteria->remove(ExportJobPeer::ID), $comparison); + + } else { // $values is ExportJob object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the export_job 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(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += ExportJobPeer::doOnDeleteCascade(new Criteria(ExportJobPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(ExportJobPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ExportJob or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ExportJob object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ExportJobPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof ExportJob) { + // invalidate the cache for this single object + ExportJobPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ExportJobPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + ExportJobPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += ExportJobPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + ExportJobPeer::clearInstancePool(); + } else { // it's a PK or object + ExportJobPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in ExportLogEntryPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + ExportLogEntryPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = ExportJobPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related ExportLogEntry objects + $c = new Criteria(ExportLogEntryPeer::DATABASE_NAME); + + $c->add(ExportLogEntryPeer::JOB, $obj->getId()); + $affectedRows += ExportLogEntryPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given ExportJob 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 ExportJob $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(ExportJob $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ExportJobPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ExportJobPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ExportJobPeer::DATABASE_NAME, ExportJobPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return ExportJob + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ExportJobPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ExportJobPeer::DATABASE_NAME); + $criteria->add(ExportJobPeer::ID, $pk); + + $v = ExportJobPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ExportJobPeer::DATABASE_NAME); + $criteria->add(ExportJobPeer::ID, $pks, Criteria::IN); + $objs = ExportJobPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseExportJobPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the ExportJobPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the ExportJobPeer class: +// +// Propel::getDatabaseMap(ExportJobPeer::DATABASE_NAME)->addTableBuilder(ExportJobPeer::TABLE_NAME, ExportJobPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseExportJobPeer::DATABASE_NAME)->addTableBuilder(BaseExportJobPeer::TABLE_NAME, BaseExportJobPeer::getMapBuilder()); + diff --git a/classes/om/BaseExportLogEntry.php b/classes/om/BaseExportLogEntry.php new file mode 100755 index 0000000..a88d549 --- /dev/null +++ b/classes/om/BaseExportLogEntry.php @@ -0,0 +1,960 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [job] column value. + * + * @return int + */ + public function getJob() + { + return $this->job; + } + + /** + * Get the [optionally formatted] temporal [time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getTime($format = 'Y-m-d H:i:s') + { + if ($this->time === null) { + return null; + } + + + if ($this->time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [text] column value. + * + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Get the [type] column value. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return ExportLogEntry The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ExportLogEntryPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [job] column. + * + * @param int $v new value + * @return ExportLogEntry The current object (for fluent API support) + */ + public function setJob($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->job !== $v) { + $this->job = $v; + $this->modifiedColumns[] = ExportLogEntryPeer::JOB; + } + + if ($this->aExportJob !== null && $this->aExportJob->getId() !== $v) { + $this->aExportJob = null; + } + + return $this; + } // setJob() + + /** + * Sets the value of [time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ExportLogEntry The current object (for fluent API support) + */ + public function setTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->time !== null && $tmpDt = new DateTime($this->time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ExportLogEntryPeer::TIME; + } + } // if either are not null + + return $this; + } // setTime() + + /** + * Set the value of [text] column. + * + * @param string $v new value + * @return ExportLogEntry The current object (for fluent API support) + */ + public function setText($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text !== $v) { + $this->text = $v; + $this->modifiedColumns[] = ExportLogEntryPeer::TEXT; + } + + return $this; + } // setText() + + /** + * Set the value of [type] column. + * + * @param int $v new value + * @return ExportLogEntry The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = ExportLogEntryPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->job = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->text = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->type = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = ExportLogEntryPeer::NUM_COLUMNS - ExportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ExportLogEntry object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aExportJob !== null && $this->job !== $this->aExportJob->getId()) { + $this->aExportJob = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ExportLogEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aExportJob = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + ExportLogEntryPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + ExportLogEntryPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aExportJob !== null) { + if ($this->aExportJob->isModified() || $this->aExportJob->isNew()) { + $affectedRows += $this->aExportJob->save($con); + } + $this->setExportJob($this->aExportJob); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = ExportLogEntryPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ExportLogEntryPeer::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 + + $this->setNew(false); + } else { + $affectedRows += ExportLogEntryPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aExportJob !== null) { + if (!$this->aExportJob->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aExportJob->getValidationFailures()); + } + } + + + if (($retval = ExportLogEntryPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ExportLogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getJob(); + break; + case 2: + return $this->getTime(); + break; + case 3: + return $this->getText(); + break; + case 4: + return $this->getType(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = ExportLogEntryPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getJob(), + $keys[2] => $this->getTime(), + $keys[3] => $this->getText(), + $keys[4] => $this->getType(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ExportLogEntryPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setJob($value); + break; + case 2: + $this->setTime($value); + break; + case 3: + $this->setText($value); + break; + case 4: + $this->setType($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = ExportLogEntryPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setJob($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTime($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setText($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setType($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(ExportLogEntryPeer::DATABASE_NAME); + + if ($this->isColumnModified(ExportLogEntryPeer::ID)) $criteria->add(ExportLogEntryPeer::ID, $this->id); + if ($this->isColumnModified(ExportLogEntryPeer::JOB)) $criteria->add(ExportLogEntryPeer::JOB, $this->job); + if ($this->isColumnModified(ExportLogEntryPeer::TIME)) $criteria->add(ExportLogEntryPeer::TIME, $this->time); + if ($this->isColumnModified(ExportLogEntryPeer::TEXT)) $criteria->add(ExportLogEntryPeer::TEXT, $this->text); + if ($this->isColumnModified(ExportLogEntryPeer::TYPE)) $criteria->add(ExportLogEntryPeer::TYPE, $this->type); + + 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(ExportLogEntryPeer::DATABASE_NAME); + + $criteria->add(ExportLogEntryPeer::ID, $this->id); + + 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 ExportLogEntry (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) + { + + $copyObj->setJob($this->job); + + $copyObj->setTime($this->time); + + $copyObj->setText($this->text); + + $copyObj->setType($this->type); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 ExportLogEntry 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); + $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 ExportLogEntryPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ExportLogEntryPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a ExportJob object. + * + * @param ExportJob $v + * @return ExportLogEntry The current object (for fluent API support) + * @throws PropelException + */ + public function setExportJob(ExportJob $v = null) + { + if ($v === null) { + $this->setJob(NULL); + } else { + $this->setJob($v->getId()); + } + + $this->aExportJob = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ExportJob object, it will not be re-added. + if ($v !== null) { + $v->addExportLogEntry($this); + } + + return $this; + } + + + /** + * Get the associated ExportJob object + * + * @param PropelPDO Optional Connection object. + * @return ExportJob The associated ExportJob object. + * @throws PropelException + */ + public function getExportJob(PropelPDO $con = null) + { + if ($this->aExportJob === null && ($this->job !== null)) { + $c = new Criteria(ExportJobPeer::DATABASE_NAME); + $c->add(ExportJobPeer::ID, $this->job); + $this->aExportJob = ExportJobPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aExportJob->addExportLogEntrys($this); + */ + } + return $this->aExportJob; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aExportJob = null; + } + +} // BaseExportLogEntry diff --git a/classes/om/BaseExportLogEntryPeer.php b/classes/om/BaseExportLogEntryPeer.php new file mode 100755 index 0000000..fb6ff01 --- /dev/null +++ b/classes/om/BaseExportLogEntryPeer.php @@ -0,0 +1,937 @@ + array ('Id', 'Job', 'Time', 'Text', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'job', 'time', 'text', 'type', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::JOB, self::TIME, self::TEXT, self::TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'job', 'time', 'text', 'type', ), + 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, 'Job' => 1, 'Time' => 2, 'Text' => 3, 'Type' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::JOB => 1, self::TIME => 2, self::TEXT => 3, self::TYPE => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new ExportLogEntryMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ExportLogEntryPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ExportLogEntryPeer::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) + { + + $criteria->addSelectColumn(ExportLogEntryPeer::ID); + + $criteria->addSelectColumn(ExportLogEntryPeer::JOB); + + $criteria->addSelectColumn(ExportLogEntryPeer::TIME); + + $criteria->addSelectColumn(ExportLogEntryPeer::TEXT); + + $criteria->addSelectColumn(ExportLogEntryPeer::TYPE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ExportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ExportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return ExportLogEntry + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ExportLogEntryPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return ExportLogEntryPeer::populateObjects(ExportLogEntryPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ExportLogEntryPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param ExportLogEntry $value A ExportLogEntry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(ExportLogEntry $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A ExportLogEntry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof ExportLogEntry) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ExportLogEntry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return ExportLogEntry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ExportLogEntryPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ExportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ExportLogEntryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ExportLogEntryPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related ExportJob table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinExportJob(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ExportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ExportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ExportLogEntryPeer::JOB,), array(ExportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of ExportLogEntry objects pre-filled with their ExportJob objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ExportLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinExportJob(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ExportLogEntryPeer::addSelectColumns($c); + $startcol = (ExportLogEntryPeer::NUM_COLUMNS - ExportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + ExportJobPeer::addSelectColumns($c); + + $c->addJoin(array(ExportLogEntryPeer::JOB,), array(ExportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ExportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ExportLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = ExportLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ExportLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = ExportJobPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = ExportJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ExportJobPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + ExportJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (ExportLogEntry) to $obj2 (ExportJob) + $obj2->addExportLogEntry($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ExportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ExportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ExportLogEntryPeer::JOB,), array(ExportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of ExportLogEntry objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ExportLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ExportLogEntryPeer::addSelectColumns($c); + $startcol2 = (ExportLogEntryPeer::NUM_COLUMNS - ExportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + + ExportJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (ExportJobPeer::NUM_COLUMNS - ExportJobPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(ExportLogEntryPeer::JOB,), array(ExportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ExportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ExportLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = ExportLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ExportLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined ExportJob rows + + $key2 = ExportJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = ExportJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ExportJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + ExportJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (ExportLogEntry) to the collection in $obj2 (ExportJob) + $obj2->addExportLogEntry($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 ExportLogEntryPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ExportLogEntry or Criteria object. + * + * @param mixed $values Criteria or ExportLogEntry object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ExportLogEntry object + } + + if ($criteria->containsKey(ExportLogEntryPeer::ID) && $criteria->keyContainsValue(ExportLogEntryPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ExportLogEntryPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ExportLogEntry or Criteria object. + * + * @param mixed $values Criteria or ExportLogEntry object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ExportLogEntryPeer::ID); + $selectCriteria->add(ExportLogEntryPeer::ID, $criteria->remove(ExportLogEntryPeer::ID), $comparison); + + } else { // $values is ExportLogEntry object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the export_log_entry 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(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(ExportLogEntryPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ExportLogEntry or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ExportLogEntry object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ExportLogEntryPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof ExportLogEntry) { + // invalidate the cache for this single object + ExportLogEntryPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ExportLogEntryPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + ExportLogEntryPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given ExportLogEntry 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 ExportLogEntry $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(ExportLogEntry $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ExportLogEntryPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ExportLogEntryPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ExportLogEntryPeer::DATABASE_NAME, ExportLogEntryPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return ExportLogEntry + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ExportLogEntryPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ExportLogEntryPeer::DATABASE_NAME); + $criteria->add(ExportLogEntryPeer::ID, $pk); + + $v = ExportLogEntryPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ExportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ExportLogEntryPeer::DATABASE_NAME); + $criteria->add(ExportLogEntryPeer::ID, $pks, Criteria::IN); + $objs = ExportLogEntryPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseExportLogEntryPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the ExportLogEntryPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the ExportLogEntryPeer class: +// +// Propel::getDatabaseMap(ExportLogEntryPeer::DATABASE_NAME)->addTableBuilder(ExportLogEntryPeer::TABLE_NAME, ExportLogEntryPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseExportLogEntryPeer::DATABASE_NAME)->addTableBuilder(BaseExportLogEntryPeer::TABLE_NAME, BaseExportLogEntryPeer::getMapBuilder()); + diff --git a/classes/om/BaseImportError.php b/classes/om/BaseImportError.php new file mode 100755 index 0000000..90ba907 --- /dev/null +++ b/classes/om/BaseImportError.php @@ -0,0 +1,628 @@ +id; + } + + /** + * Get the [job] column value. + * + * @return int + */ + public function getJob() + { + + return $this->job; + } + + /** + * Get the [text] column value. + * + * @return string + */ + public function getText() + { + + return $this->text; + } + + /** + * Get the [type] column value. + * + * @return int + */ + public function getType() + { + + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return void + */ + public function setId($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ImportErrorPeer::ID; + } + + } // setId() + + /** + * Set the value of [job] column. + * + * @param int $v new value + * @return void + */ + public function setJob($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->job !== $v) { + $this->job = $v; + $this->modifiedColumns[] = ImportErrorPeer::JOB; + } + + if ($this->aImportJob !== null && $this->aImportJob->getId() !== $v) { + $this->aImportJob = null; + } + + } // setJob() + + /** + * Set the value of [text] column. + * + * @param string $v new value + * @return void + */ + public function setText($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->text) { + $changed = $v->isModified(); + } else { + $changed = ($this->text !== $v); + } + if ($changed) { + if ( !($v instanceof Lob) ) { + $obj = new Blob(); + $obj->setContents($v); + } else { + $obj = $v; + } + $this->text = $obj; + $this->modifiedColumns[] = ImportErrorPeer::TEXT; + } + + } // setText() + + /** + * Set the value of [type] column. + * + * @param int $v new value + * @return void + */ + public function setType($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = ImportErrorPeer::TYPE; + } + + } // setType() + + /** + * 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 { + + $this->id = $rs->getInt($startcol + 0); + + $this->job = $rs->getInt($startcol + 1); + + $this->text = $rs->getBlob($startcol + 2); + + $this->type = $rs->getInt($startcol + 3); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = ImportErrorPeer::NUM_COLUMNS - ImportErrorPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ImportError 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()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportErrorPeer::DATABASE_NAME); + } + + try { + $con->begin(); + ImportErrorPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * 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()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportErrorPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * 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) { + $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->aImportJob !== null) { + if ($this->aImportJob->isModified()) { + $affectedRows += $this->aImportJob->save($con); + } + $this->setImportJob($this->aImportJob); + } + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ImportErrorPeer::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 + + $this->setNew(false); + } else { + $affectedRows += ImportErrorPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aImportJob !== null) { + if (!$this->aImportJob->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aImportJob->getValidationFailures()); + } + } + + + if (($retval = ImportErrorPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * 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(ImportErrorPeer::DATABASE_NAME); + + if ($this->isColumnModified(ImportErrorPeer::ID)) $criteria->add(ImportErrorPeer::ID, $this->id); + if ($this->isColumnModified(ImportErrorPeer::JOB)) $criteria->add(ImportErrorPeer::JOB, $this->job); + if ($this->isColumnModified(ImportErrorPeer::TEXT)) $criteria->add(ImportErrorPeer::TEXT, $this->text); + if ($this->isColumnModified(ImportErrorPeer::TYPE)) $criteria->add(ImportErrorPeer::TYPE, $this->type); + + 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(ImportErrorPeer::DATABASE_NAME); + + $criteria->add(ImportErrorPeer::ID, $this->id); + + 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 ImportError (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) + { + + $copyObj->setJob($this->job); + + $copyObj->setText($this->text); + + $copyObj->setType($this->type); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a pkey column, so set to default value + + } + + /** + * 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 ImportError 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); + $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 ImportErrorPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ImportErrorPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a ImportJob object. + * + * @param ImportJob $v + * @return void + * @throws PropelException + */ + public function setImportJob($v) + { + + + if ($v === null) { + $this->setJob(NULL); + } else { + $this->setJob($v->getId()); + } + + + $this->aImportJob = $v; + } + + + /** + * Get the associated ImportJob object + * + * @param Connection Optional Connection object. + * @return ImportJob The associated ImportJob object. + * @throws PropelException + */ + public function getImportJob($con = null) + { + // include the related Peer class + include_once 'om/BaseImportJobPeer.php'; + + if ($this->aImportJob === null && ($this->job !== null)) { + + $this->aImportJob = ImportJobPeer::retrieveByPK($this->job, $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 = ImportJobPeer::retrieveByPK($this->job, $con); + $obj->addImportJobs($this); + */ + } + return $this->aImportJob; + } + +} // BaseImportError diff --git a/classes/om/BaseImportErrorPeer.php b/classes/om/BaseImportErrorPeer.php new file mode 100755 index 0000000..23ea6a8 --- /dev/null +++ b/classes/om/BaseImportErrorPeer.php @@ -0,0 +1,785 @@ + array ('Id', 'Job', 'Text', 'Type', ), + BasePeer::TYPE_COLNAME => array (ImportErrorPeer::ID, ImportErrorPeer::JOB, ImportErrorPeer::TEXT, ImportErrorPeer::TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'job', 'text', 'type', ), + 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, 'Job' => 1, 'Text' => 2, 'Type' => 3, ), + BasePeer::TYPE_COLNAME => array (ImportErrorPeer::ID => 0, ImportErrorPeer::JOB => 1, ImportErrorPeer::TEXT => 2, ImportErrorPeer::TYPE => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'job' => 1, 'text' => 2, 'type' => 3, ), + 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 'map/ImportErrorMapBuilder.php'; + return BasePeer::getMapBuilder('.map.ImportErrorMapBuilder'); + } + /** + * 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) { + $map = ImportErrorPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + 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); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + 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) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ImportErrorPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ImportErrorPeer::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) + { + + $criteria->addSelectColumn(ImportErrorPeer::ID); + + $criteria->addSelectColumn(ImportErrorPeer::JOB); + + $criteria->addSelectColumn(ImportErrorPeer::TEXT); + + $criteria->addSelectColumn(ImportErrorPeer::TYPE); + + } + + const COUNT = 'COUNT(import_error.ID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT import_error.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; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ImportErrorPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ImportErrorPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach($criteria->getGroupByColumns() as $column) + { + $criteria->addSelectColumn($column); + } + + $rs = ImportErrorPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return ImportError + * @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; + $critcopy->setLimit(1); + $objects = ImportErrorPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + 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 ImportErrorPeer::populateObjects(ImportErrorPeer::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) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + ImportErrorPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + 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 = ImportErrorPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related ImportJob 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 doCountJoinImportJob(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ImportErrorPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ImportErrorPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach($criteria->getGroupByColumns() as $column) + { + $criteria->addSelectColumn($column); + } + + $criteria->addJoin(ImportErrorPeer::JOB, ImportJobPeer::ID); + + $rs = ImportErrorPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + + + /** + * Selects a collection of ImportError objects pre-filled with their ImportJob objects. + * + * @return array Array of ImportError objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinImportJob(Criteria $c, $con = null) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ImportErrorPeer::addSelectColumns($c); + $startcol = (ImportErrorPeer::NUM_COLUMNS - ImportErrorPeer::NUM_LAZY_LOAD_COLUMNS) + 1; + ImportJobPeer::addSelectColumns($c); + + $c->addJoin(ImportErrorPeer::JOB, ImportJobPeer::ID); + $rs = BasePeer::doSelect($c, $con); + $results = array(); + + while($rs->next()) { + + $omClass = ImportErrorPeer::getOMClass(); + + $cls = Propel::import($omClass); + $obj1 = new $cls(); + $obj1->hydrate($rs); + + $omClass = ImportJobPeer::getOMClass(); + + $cls = Propel::import($omClass); + $obj2 = new $cls(); + $obj2->hydrate($rs, $startcol); + + $newObject = true; + foreach($results as $temp_obj1) { + $temp_obj2 = $temp_obj1->getImportJob(); //CHECKME + if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $newObject = false; + // e.g. $author->addBookRelatedByBookId() + $temp_obj2->addImportError($obj1); //CHECKME + break; + } + } + if ($newObject) { + $obj2->initImportErrors(); + $obj2->addImportError($obj1); //CHECKME + } + $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(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ImportErrorPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ImportErrorPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach($criteria->getGroupByColumns() as $column) + { + $criteria->addSelectColumn($column); + } + + $criteria->addJoin(ImportErrorPeer::JOB, ImportJobPeer::ID); + + $rs = ImportErrorPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + + + /** + * Selects a collection of ImportError objects pre-filled with all related objects. + * + * @return array Array of ImportError 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()) { + $c->setDbName(self::DATABASE_NAME); + } + + ImportErrorPeer::addSelectColumns($c); + $startcol2 = (ImportErrorPeer::NUM_COLUMNS - ImportErrorPeer::NUM_LAZY_LOAD_COLUMNS) + 1; + + ImportJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + ImportJobPeer::NUM_COLUMNS; + + $c->addJoin(ImportErrorPeer::JOB, ImportJobPeer::ID); + + $rs = BasePeer::doSelect($c, $con); + $results = array(); + + while($rs->next()) { + + $omClass = ImportErrorPeer::getOMClass(); + + + $cls = Propel::import($omClass); + $obj1 = new $cls(); + $obj1->hydrate($rs); + + + // Add objects for joined ImportJob rows + + $omClass = ImportJobPeer::getOMClass(); + + + $cls = Propel::import($omClass); + $obj2 = new $cls(); + $obj2->hydrate($rs, $startcol2); + + $newObject = true; + for ($j=0, $resCount=count($results); $j < $resCount; $j++) { + $temp_obj1 = $results[$j]; + $temp_obj2 = $temp_obj1->getImportJob(); // CHECKME + if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { + $newObject = false; + $temp_obj2->addImportError($obj1); // CHECKME + break; + } + } + + if ($newObject) { + $obj2->initImportErrors(); + $obj2->addImportError($obj1); + } + + $results[] = $obj1; + } + 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 ImportErrorPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ImportError or Criteria object. + * + * @param mixed $values Criteria or ImportError 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) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ImportError object + } + + $criteria->remove(ImportErrorPeer::ID); // remove pkey col since this table uses auto-increment + + + // 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(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ImportError or Criteria object. + * + * @param mixed $values Criteria or ImportError 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) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ImportErrorPeer::ID); + $selectCriteria->add(ImportErrorPeer::ID, $criteria->remove(ImportErrorPeer::ID), $comparison); + + } else { // $values is ImportError object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the import_error 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 += BasePeer::doDeleteAll(ImportErrorPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ImportError or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ImportError 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) { + $con = Propel::getConnection(ImportErrorPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof ImportError) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ImportErrorPeer::ID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(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 += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given ImportError 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 ImportError $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(ImportError $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ImportErrorPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ImportErrorPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ImportErrorPeer::DATABASE_NAME, ImportErrorPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return ImportError + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(ImportErrorPeer::DATABASE_NAME); + + $criteria->add(ImportErrorPeer::ID, $pk); + + + $v = ImportErrorPeer::doSelect($criteria, $con); + + 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) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(ImportErrorPeer::ID, $pks, Criteria::IN); + $objs = ImportErrorPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseImportErrorPeer + +// 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 { + BaseImportErrorPeer::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 'map/ImportErrorMapBuilder.php'; + Propel::registerMapBuilder('.map.ImportErrorMapBuilder'); +} diff --git a/classes/om/BaseImportJob.php b/classes/om/BaseImportJob.php new file mode 100755 index 0000000..cda116f --- /dev/null +++ b/classes/om/BaseImportJob.php @@ -0,0 +1,1476 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [config] column value. + * + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Get the [optionally formatted] temporal [start_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStartTime($format = 'Y-m-d H:i:s') + { + if ($this->start_time === null) { + return null; + } + + + if ($this->start_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->start_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [optionally formatted] temporal [end_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getEndTime($format = 'Y-m-d H:i:s') + { + if ($this->end_time === null) { + return null; + } + + + if ($this->end_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->end_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [status] column value. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Get the [status_code] column value. + * + * @return int + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * Get the [optionally formatted] temporal [status_change_time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getStatusChangeTime($format = 'Y-m-d H:i:s') + { + if ($this->status_change_time === null) { + return null; + } + + + if ($this->status_change_time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->status_change_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->status_change_time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [stats] column value. + * + * @return string + */ + public function getStats() + { + return $this->stats; + } + + /** + * Get the [cmd] column value. + * + * @return string + */ + public function getCmd() + { + return $this->cmd; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ImportJobPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = ImportJobPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = ImportJobPeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [config] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setConfig($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->config !== $v) { + $this->config = $v; + $this->modifiedColumns[] = ImportJobPeer::CONFIG; + } + + return $this; + } // setConfig() + + /** + * Sets the value of [start_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ImportJob The current object (for fluent API support) + */ + public function setStartTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->start_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ImportJobPeer::START_TIME; + } + } // if either are not null + + return $this; + } // setStartTime() + + /** + * Sets the value of [end_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ImportJob The current object (for fluent API support) + */ + public function setEndTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->end_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->end_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ImportJobPeer::END_TIME; + } + } // if either are not null + + return $this; + } // setEndTime() + + /** + * Set the value of [status] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setStatus($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->status !== $v) { + $this->status = $v; + $this->modifiedColumns[] = ImportJobPeer::STATUS; + } + + return $this; + } // setStatus() + + /** + * Set the value of [status_code] column. + * + * @param int $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setStatusCode($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->status_code !== $v) { + $this->status_code = $v; + $this->modifiedColumns[] = ImportJobPeer::STATUS_CODE; + } + + return $this; + } // setStatusCode() + + /** + * Sets the value of [status_change_time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ImportJob The current object (for fluent API support) + */ + public function setStatusChangeTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->status_change_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->status_change_time !== null && $tmpDt = new DateTime($this->status_change_time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->status_change_time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ImportJobPeer::STATUS_CHANGE_TIME; + } + } // if either are not null + + return $this; + } // setStatusChangeTime() + + /** + * Set the value of [stats] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setStats($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->stats !== $v) { + $this->stats = $v; + $this->modifiedColumns[] = ImportJobPeer::STATS; + } + + return $this; + } // setStats() + + /** + * Set the value of [cmd] column. + * + * @param string $v new value + * @return ImportJob The current object (for fluent API support) + */ + public function setCmd($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cmd !== $v) { + $this->cmd = $v; + $this->modifiedColumns[] = ImportJobPeer::CMD; + } + + return $this; + } // setCmd() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->config = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->start_time = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->end_time = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->status = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->status_code = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->status_change_time = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->stats = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->cmd = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 11; // 11 = ImportJobPeer::NUM_COLUMNS - ImportJobPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ImportJob object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ImportJobPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collImportLogEntrys = null; + $this->lastImportLogEntryCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + ImportJobPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + ImportJobPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = ImportJobPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ImportJobPeer::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 + + $this->setNew(false); + } else { + $affectedRows += ImportJobPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collImportLogEntrys !== null) { + foreach ($this->collImportLogEntrys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = ImportJobPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collImportLogEntrys !== null) { + foreach ($this->collImportLogEntrys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportJobPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getDescription(); + break; + case 3: + return $this->getConfig(); + break; + case 4: + return $this->getStartTime(); + break; + case 5: + return $this->getEndTime(); + break; + case 6: + return $this->getStatus(); + break; + case 7: + return $this->getStatusCode(); + break; + case 8: + return $this->getStatusChangeTime(); + break; + case 9: + return $this->getStats(); + break; + case 10: + return $this->getCmd(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = ImportJobPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getDescription(), + $keys[3] => $this->getConfig(), + $keys[4] => $this->getStartTime(), + $keys[5] => $this->getEndTime(), + $keys[6] => $this->getStatus(), + $keys[7] => $this->getStatusCode(), + $keys[8] => $this->getStatusChangeTime(), + $keys[9] => $this->getStats(), + $keys[10] => $this->getCmd(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportJobPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setDescription($value); + break; + case 3: + $this->setConfig($value); + break; + case 4: + $this->setStartTime($value); + break; + case 5: + $this->setEndTime($value); + break; + case 6: + $this->setStatus($value); + break; + case 7: + $this->setStatusCode($value); + break; + case 8: + $this->setStatusChangeTime($value); + break; + case 9: + $this->setStats($value); + break; + case 10: + $this->setCmd($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = ImportJobPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setConfig($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setStartTime($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setEndTime($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setStatus($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setStatusCode($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setStatusChangeTime($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setStats($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCmd($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(ImportJobPeer::DATABASE_NAME); + + if ($this->isColumnModified(ImportJobPeer::ID)) $criteria->add(ImportJobPeer::ID, $this->id); + if ($this->isColumnModified(ImportJobPeer::NAME)) $criteria->add(ImportJobPeer::NAME, $this->name); + if ($this->isColumnModified(ImportJobPeer::DESCRIPTION)) $criteria->add(ImportJobPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(ImportJobPeer::CONFIG)) $criteria->add(ImportJobPeer::CONFIG, $this->config); + if ($this->isColumnModified(ImportJobPeer::START_TIME)) $criteria->add(ImportJobPeer::START_TIME, $this->start_time); + if ($this->isColumnModified(ImportJobPeer::END_TIME)) $criteria->add(ImportJobPeer::END_TIME, $this->end_time); + if ($this->isColumnModified(ImportJobPeer::STATUS)) $criteria->add(ImportJobPeer::STATUS, $this->status); + if ($this->isColumnModified(ImportJobPeer::STATUS_CODE)) $criteria->add(ImportJobPeer::STATUS_CODE, $this->status_code); + if ($this->isColumnModified(ImportJobPeer::STATUS_CHANGE_TIME)) $criteria->add(ImportJobPeer::STATUS_CHANGE_TIME, $this->status_change_time); + if ($this->isColumnModified(ImportJobPeer::STATS)) $criteria->add(ImportJobPeer::STATS, $this->stats); + if ($this->isColumnModified(ImportJobPeer::CMD)) $criteria->add(ImportJobPeer::CMD, $this->cmd); + + 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(ImportJobPeer::DATABASE_NAME); + + $criteria->add(ImportJobPeer::ID, $this->id); + + 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 ImportJob (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) + { + + $copyObj->setName($this->name); + + $copyObj->setDescription($this->description); + + $copyObj->setConfig($this->config); + + $copyObj->setStartTime($this->start_time); + + $copyObj->setEndTime($this->end_time); + + $copyObj->setStatus($this->status); + + $copyObj->setStatusCode($this->status_code); + + $copyObj->setStatusChangeTime($this->status_change_time); + + $copyObj->setStats($this->stats); + + $copyObj->setCmd($this->cmd); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getImportLogEntrys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addImportLogEntry($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 ImportJob 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); + $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 ImportJobPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ImportJobPeer(); + } + return self::$peer; + } + + /** + * Clears out the collImportLogEntrys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addImportLogEntrys() + */ + public function clearImportLogEntrys() + { + $this->collImportLogEntrys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collImportLogEntrys collection (array). + * + * By default this just sets the collImportLogEntrys collection to an empty array (like clearcollImportLogEntrys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initImportLogEntrys() + { + $this->collImportLogEntrys = array(); + } + + /** + * Gets an array of ImportLogEntry objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this ImportJob has previously been saved, it will retrieve + * related ImportLogEntrys from storage. If this ImportJob is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array ImportLogEntry[] + * @throws PropelException + */ + public function getImportLogEntrys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ImportJobPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collImportLogEntrys === null) { + if ($this->isNew()) { + $this->collImportLogEntrys = array(); + } else { + + $criteria->add(ImportLogEntryPeer::JOB, $this->id); + + ImportLogEntryPeer::addSelectColumns($criteria); + $this->collImportLogEntrys = ImportLogEntryPeer::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. + + + $criteria->add(ImportLogEntryPeer::JOB, $this->id); + + ImportLogEntryPeer::addSelectColumns($criteria); + if (!isset($this->lastImportLogEntryCriteria) || !$this->lastImportLogEntryCriteria->equals($criteria)) { + $this->collImportLogEntrys = ImportLogEntryPeer::doSelect($criteria, $con); + } + } + } + $this->lastImportLogEntryCriteria = $criteria; + return $this->collImportLogEntrys; + } + + /** + * Returns the number of related ImportLogEntry objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related ImportLogEntry objects. + * @throws PropelException + */ + public function countImportLogEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ImportJobPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collImportLogEntrys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(ImportLogEntryPeer::JOB, $this->id); + + $count = ImportLogEntryPeer::doCount($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 count of the collection. + + + $criteria->add(ImportLogEntryPeer::JOB, $this->id); + + if (!isset($this->lastImportLogEntryCriteria) || !$this->lastImportLogEntryCriteria->equals($criteria)) { + $count = ImportLogEntryPeer::doCount($criteria, $con); + } else { + $count = count($this->collImportLogEntrys); + } + } else { + $count = count($this->collImportLogEntrys); + } + } + return $count; + } + + /** + * Method called to associate a ImportLogEntry object to this object + * through the ImportLogEntry foreign key attribute. + * + * @param ImportLogEntry $l ImportLogEntry + * @return void + * @throws PropelException + */ + public function addImportLogEntry(ImportLogEntry $l) + { + if ($this->collImportLogEntrys === null) { + $this->initImportLogEntrys(); + } + if (!in_array($l, $this->collImportLogEntrys, true)) { // only add it if the **same** object is not already associated + array_push($this->collImportLogEntrys, $l); + $l->setImportJob($this); + } + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collImportLogEntrys) { + foreach ((array) $this->collImportLogEntrys as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collImportLogEntrys = null; + } + +} // BaseImportJob diff --git a/classes/om/BaseImportJobPeer.php b/classes/om/BaseImportJobPeer.php new file mode 100755 index 0000000..b8c9417 --- /dev/null +++ b/classes/om/BaseImportJobPeer.php @@ -0,0 +1,778 @@ + array ('Id', 'Name', 'Description', 'Config', 'StartTime', 'EndTime', 'Status', 'StatusCode', 'StatusChangeTime', 'Stats', 'Cmd', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'description', 'config', 'startTime', 'endTime', 'status', 'statusCode', 'statusChangeTime', 'stats', 'cmd', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::CONFIG, self::START_TIME, self::END_TIME, self::STATUS, self::STATUS_CODE, self::STATUS_CHANGE_TIME, self::STATS, self::CMD, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'config', 'start_time', 'end_time', 'status', 'status_code', 'status_change_time', 'stats', 'cmd', ), + 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, 'Name' => 1, 'Description' => 2, 'Config' => 3, 'StartTime' => 4, 'EndTime' => 5, 'Status' => 6, 'StatusCode' => 7, 'StatusChangeTime' => 8, 'Stats' => 9, 'Cmd' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'startTime' => 4, 'endTime' => 5, 'status' => 6, 'statusCode' => 7, 'statusChangeTime' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::CONFIG => 3, self::START_TIME => 4, self::END_TIME => 5, self::STATUS => 6, self::STATUS_CODE => 7, self::STATUS_CHANGE_TIME => 8, self::STATS => 9, self::CMD => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'config' => 3, 'start_time' => 4, 'end_time' => 5, 'status' => 6, 'status_code' => 7, 'status_change_time' => 8, 'stats' => 9, 'cmd' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new ImportJobMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ImportJobPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ImportJobPeer::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) + { + + $criteria->addSelectColumn(ImportJobPeer::ID); + + $criteria->addSelectColumn(ImportJobPeer::NAME); + + $criteria->addSelectColumn(ImportJobPeer::DESCRIPTION); + + $criteria->addSelectColumn(ImportJobPeer::CONFIG); + + $criteria->addSelectColumn(ImportJobPeer::START_TIME); + + $criteria->addSelectColumn(ImportJobPeer::END_TIME); + + $criteria->addSelectColumn(ImportJobPeer::STATUS); + + $criteria->addSelectColumn(ImportJobPeer::STATUS_CODE); + + $criteria->addSelectColumn(ImportJobPeer::STATUS_CHANGE_TIME); + + $criteria->addSelectColumn(ImportJobPeer::STATS); + + $criteria->addSelectColumn(ImportJobPeer::CMD); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportJobPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportJobPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return ImportJob + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ImportJobPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return ImportJobPeer::populateObjects(ImportJobPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ImportJobPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param ImportJob $value A ImportJob object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(ImportJob $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A ImportJob object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof ImportJob) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ImportJob object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return ImportJob Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ImportJobPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ImportJobPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ImportJobPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ImportJobPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 ImportJobPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ImportJob or Criteria object. + * + * @param mixed $values Criteria or ImportJob object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ImportJob object + } + + if ($criteria->containsKey(ImportJobPeer::ID) && $criteria->keyContainsValue(ImportJobPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportJobPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ImportJob or Criteria object. + * + * @param mixed $values Criteria or ImportJob object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ImportJobPeer::ID); + $selectCriteria->add(ImportJobPeer::ID, $criteria->remove(ImportJobPeer::ID), $comparison); + + } else { // $values is ImportJob object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the import_job 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(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += ImportJobPeer::doOnDeleteCascade(new Criteria(ImportJobPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(ImportJobPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ImportJob or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ImportJob object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ImportJobPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof ImportJob) { + // invalidate the cache for this single object + ImportJobPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ImportJobPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + ImportJobPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += ImportJobPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + ImportJobPeer::clearInstancePool(); + } else { // it's a PK or object + ImportJobPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in ImportLogEntryPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + ImportLogEntryPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = ImportJobPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related ImportLogEntry objects + $c = new Criteria(ImportLogEntryPeer::DATABASE_NAME); + + $c->add(ImportLogEntryPeer::JOB, $obj->getId()); + $affectedRows += ImportLogEntryPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given ImportJob 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 ImportJob $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(ImportJob $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ImportJobPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ImportJobPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ImportJobPeer::DATABASE_NAME, ImportJobPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return ImportJob + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ImportJobPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ImportJobPeer::DATABASE_NAME); + $criteria->add(ImportJobPeer::ID, $pk); + + $v = ImportJobPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportJobPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ImportJobPeer::DATABASE_NAME); + $criteria->add(ImportJobPeer::ID, $pks, Criteria::IN); + $objs = ImportJobPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseImportJobPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the ImportJobPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the ImportJobPeer class: +// +// Propel::getDatabaseMap(ImportJobPeer::DATABASE_NAME)->addTableBuilder(ImportJobPeer::TABLE_NAME, ImportJobPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseImportJobPeer::DATABASE_NAME)->addTableBuilder(BaseImportJobPeer::TABLE_NAME, BaseImportJobPeer::getMapBuilder()); + diff --git a/classes/om/BaseImportLogEntry.php b/classes/om/BaseImportLogEntry.php new file mode 100755 index 0000000..da74f4e --- /dev/null +++ b/classes/om/BaseImportLogEntry.php @@ -0,0 +1,960 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [job] column value. + * + * @return int + */ + public function getJob() + { + return $this->job; + } + + /** + * Get the [optionally formatted] temporal [time] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getTime($format = 'Y-m-d H:i:s') + { + if ($this->time === null) { + return null; + } + + + if ($this->time === '0000-00-00 00:00:00') { + // while technically this is not a default value of NULL, + // this seems to be closest in meaning. + return null; + } else { + try { + $dt = new DateTime($this->time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time, true), $x); + } + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [text] column value. + * + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Get the [type] column value. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return ImportLogEntry The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ImportLogEntryPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [job] column. + * + * @param int $v new value + * @return ImportLogEntry The current object (for fluent API support) + */ + public function setJob($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->job !== $v) { + $this->job = $v; + $this->modifiedColumns[] = ImportLogEntryPeer::JOB; + } + + if ($this->aImportJob !== null && $this->aImportJob->getId() !== $v) { + $this->aImportJob = null; + } + + return $this; + } // setJob() + + /** + * Sets the value of [time] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return ImportLogEntry The current object (for fluent API support) + */ + public function setTime($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->time !== null && $tmpDt = new DateTime($this->time)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->time = ($dt ? $dt->format('Y-m-d H:i:s') : null); + $this->modifiedColumns[] = ImportLogEntryPeer::TIME; + } + } // if either are not null + + return $this; + } // setTime() + + /** + * Set the value of [text] column. + * + * @param string $v new value + * @return ImportLogEntry The current object (for fluent API support) + */ + public function setText($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text !== $v) { + $this->text = $v; + $this->modifiedColumns[] = ImportLogEntryPeer::TEXT; + } + + return $this; + } // setText() + + /** + * Set the value of [type] column. + * + * @param int $v new value + * @return ImportLogEntry The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = ImportLogEntryPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->job = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->text = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->type = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = ImportLogEntryPeer::NUM_COLUMNS - ImportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating ImportLogEntry object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aImportJob !== null && $this->job !== $this->aImportJob->getId()) { + $this->aImportJob = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ImportLogEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aImportJob = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + ImportLogEntryPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + ImportLogEntryPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aImportJob !== null) { + if ($this->aImportJob->isModified() || $this->aImportJob->isNew()) { + $affectedRows += $this->aImportJob->save($con); + } + $this->setImportJob($this->aImportJob); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = ImportLogEntryPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ImportLogEntryPeer::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 + + $this->setNew(false); + } else { + $affectedRows += ImportLogEntryPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aImportJob !== null) { + if (!$this->aImportJob->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aImportJob->getValidationFailures()); + } + } + + + if (($retval = ImportLogEntryPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportLogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getJob(); + break; + case 2: + return $this->getTime(); + break; + case 3: + return $this->getText(); + break; + case 4: + return $this->getType(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = ImportLogEntryPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getJob(), + $keys[2] => $this->getTime(), + $keys[3] => $this->getText(), + $keys[4] => $this->getType(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportLogEntryPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setJob($value); + break; + case 2: + $this->setTime($value); + break; + case 3: + $this->setText($value); + break; + case 4: + $this->setType($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = ImportLogEntryPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setJob($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTime($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setText($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setType($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(ImportLogEntryPeer::DATABASE_NAME); + + if ($this->isColumnModified(ImportLogEntryPeer::ID)) $criteria->add(ImportLogEntryPeer::ID, $this->id); + if ($this->isColumnModified(ImportLogEntryPeer::JOB)) $criteria->add(ImportLogEntryPeer::JOB, $this->job); + if ($this->isColumnModified(ImportLogEntryPeer::TIME)) $criteria->add(ImportLogEntryPeer::TIME, $this->time); + if ($this->isColumnModified(ImportLogEntryPeer::TEXT)) $criteria->add(ImportLogEntryPeer::TEXT, $this->text); + if ($this->isColumnModified(ImportLogEntryPeer::TYPE)) $criteria->add(ImportLogEntryPeer::TYPE, $this->type); + + 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(ImportLogEntryPeer::DATABASE_NAME); + + $criteria->add(ImportLogEntryPeer::ID, $this->id); + + 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 ImportLogEntry (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) + { + + $copyObj->setJob($this->job); + + $copyObj->setTime($this->time); + + $copyObj->setText($this->text); + + $copyObj->setType($this->type); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 ImportLogEntry 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); + $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 ImportLogEntryPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ImportLogEntryPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a ImportJob object. + * + * @param ImportJob $v + * @return ImportLogEntry The current object (for fluent API support) + * @throws PropelException + */ + public function setImportJob(ImportJob $v = null) + { + if ($v === null) { + $this->setJob(NULL); + } else { + $this->setJob($v->getId()); + } + + $this->aImportJob = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ImportJob object, it will not be re-added. + if ($v !== null) { + $v->addImportLogEntry($this); + } + + return $this; + } + + + /** + * Get the associated ImportJob object + * + * @param PropelPDO Optional Connection object. + * @return ImportJob The associated ImportJob object. + * @throws PropelException + */ + public function getImportJob(PropelPDO $con = null) + { + if ($this->aImportJob === null && ($this->job !== null)) { + $c = new Criteria(ImportJobPeer::DATABASE_NAME); + $c->add(ImportJobPeer::ID, $this->job); + $this->aImportJob = ImportJobPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aImportJob->addImportLogEntrys($this); + */ + } + return $this->aImportJob; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aImportJob = null; + } + +} // BaseImportLogEntry diff --git a/classes/om/BaseImportLogEntryPeer.php b/classes/om/BaseImportLogEntryPeer.php new file mode 100755 index 0000000..0c8fe80 --- /dev/null +++ b/classes/om/BaseImportLogEntryPeer.php @@ -0,0 +1,937 @@ + array ('Id', 'Job', 'Time', 'Text', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'job', 'time', 'text', 'type', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::JOB, self::TIME, self::TEXT, self::TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'job', 'time', 'text', 'type', ), + 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, 'Job' => 1, 'Time' => 2, 'Text' => 3, 'Type' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::JOB => 1, self::TIME => 2, self::TEXT => 3, self::TYPE => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'job' => 1, 'time' => 2, 'text' => 3, 'type' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new ImportLogEntryMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ImportLogEntryPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ImportLogEntryPeer::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) + { + + $criteria->addSelectColumn(ImportLogEntryPeer::ID); + + $criteria->addSelectColumn(ImportLogEntryPeer::JOB); + + $criteria->addSelectColumn(ImportLogEntryPeer::TIME); + + $criteria->addSelectColumn(ImportLogEntryPeer::TEXT); + + $criteria->addSelectColumn(ImportLogEntryPeer::TYPE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return ImportLogEntry + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ImportLogEntryPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return ImportLogEntryPeer::populateObjects(ImportLogEntryPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ImportLogEntryPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param ImportLogEntry $value A ImportLogEntry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(ImportLogEntry $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A ImportLogEntry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof ImportLogEntry) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ImportLogEntry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return ImportLogEntry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ImportLogEntryPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ImportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ImportLogEntryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ImportLogEntryPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related ImportJob table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinImportJob(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ImportLogEntryPeer::JOB,), array(ImportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of ImportLogEntry objects pre-filled with their ImportJob objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ImportLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinImportJob(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ImportLogEntryPeer::addSelectColumns($c); + $startcol = (ImportLogEntryPeer::NUM_COLUMNS - ImportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + ImportJobPeer::addSelectColumns($c); + + $c->addJoin(array(ImportLogEntryPeer::JOB,), array(ImportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ImportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ImportLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = ImportLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ImportLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = ImportJobPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = ImportJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ImportJobPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + ImportJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (ImportLogEntry) to $obj2 (ImportJob) + $obj2->addImportLogEntry($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportLogEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportLogEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ImportLogEntryPeer::JOB,), array(ImportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of ImportLogEntry objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ImportLogEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ImportLogEntryPeer::addSelectColumns($c); + $startcol2 = (ImportLogEntryPeer::NUM_COLUMNS - ImportLogEntryPeer::NUM_LAZY_LOAD_COLUMNS); + + ImportJobPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (ImportJobPeer::NUM_COLUMNS - ImportJobPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(ImportLogEntryPeer::JOB,), array(ImportJobPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ImportLogEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ImportLogEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = ImportLogEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ImportLogEntryPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined ImportJob rows + + $key2 = ImportJobPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = ImportJobPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ImportJobPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + ImportJobPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (ImportLogEntry) to the collection in $obj2 (ImportJob) + $obj2->addImportLogEntry($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 ImportLogEntryPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a ImportLogEntry or Criteria object. + * + * @param mixed $values Criteria or ImportLogEntry object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ImportLogEntry object + } + + if ($criteria->containsKey(ImportLogEntryPeer::ID) && $criteria->keyContainsValue(ImportLogEntryPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportLogEntryPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a ImportLogEntry or Criteria object. + * + * @param mixed $values Criteria or ImportLogEntry object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ImportLogEntryPeer::ID); + $selectCriteria->add(ImportLogEntryPeer::ID, $criteria->remove(ImportLogEntryPeer::ID), $comparison); + + } else { // $values is ImportLogEntry object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the import_log_entry 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(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(ImportLogEntryPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a ImportLogEntry or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ImportLogEntry object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ImportLogEntryPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof ImportLogEntry) { + // invalidate the cache for this single object + ImportLogEntryPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ImportLogEntryPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + ImportLogEntryPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given ImportLogEntry 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 ImportLogEntry $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(ImportLogEntry $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ImportLogEntryPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ImportLogEntryPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ImportLogEntryPeer::DATABASE_NAME, ImportLogEntryPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return ImportLogEntry + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ImportLogEntryPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ImportLogEntryPeer::DATABASE_NAME); + $criteria->add(ImportLogEntryPeer::ID, $pk); + + $v = ImportLogEntryPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportLogEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ImportLogEntryPeer::DATABASE_NAME); + $criteria->add(ImportLogEntryPeer::ID, $pks, Criteria::IN); + $objs = ImportLogEntryPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseImportLogEntryPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the ImportLogEntryPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the ImportLogEntryPeer class: +// +// Propel::getDatabaseMap(ImportLogEntryPeer::DATABASE_NAME)->addTableBuilder(ImportLogEntryPeer::TABLE_NAME, ImportLogEntryPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseImportLogEntryPeer::DATABASE_NAME)->addTableBuilder(BaseImportLogEntryPeer::TABLE_NAME, BaseImportLogEntryPeer::getMapBuilder()); + diff --git a/classes/om/BaseLabel.php b/classes/om/BaseLabel.php new file mode 100755 index 0000000..11e864b --- /dev/null +++ b/classes/om/BaseLabel.php @@ -0,0 +1,766 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [section] column value. + * + * @return string + */ + public function getSection() + { + return $this->section; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [label] column value. + * + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return Label The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = LabelPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [section] column. + * + * @param string $v new value + * @return Label The current object (for fluent API support) + */ + public function setSection($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->section !== $v) { + $this->section = $v; + $this->modifiedColumns[] = LabelPeer::SECTION; + } + + return $this; + } // setSection() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return Label The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = LabelPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [label] column. + * + * @param string $v new value + * @return Label The current object (for fluent API support) + */ + public function setLabel($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->label !== $v) { + $this->label = $v; + $this->modifiedColumns[] = LabelPeer::LABEL; + } + + return $this; + } // setLabel() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->section = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->label = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = LabelPeer::NUM_COLUMNS - LabelPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating Label object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = LabelPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + LabelPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + LabelPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = LabelPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = LabelPeer::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 + + $this->setNew(false); + } else { + $affectedRows += LabelPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = LabelPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = LabelPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getSection(); + break; + case 2: + return $this->getName(); + break; + case 3: + return $this->getLabel(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = LabelPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getSection(), + $keys[2] => $this->getName(), + $keys[3] => $this->getLabel(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = LabelPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setSection($value); + break; + case 2: + $this->setName($value); + break; + case 3: + $this->setLabel($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = LabelPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSection($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setLabel($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(LabelPeer::DATABASE_NAME); + + if ($this->isColumnModified(LabelPeer::ID)) $criteria->add(LabelPeer::ID, $this->id); + if ($this->isColumnModified(LabelPeer::SECTION)) $criteria->add(LabelPeer::SECTION, $this->section); + if ($this->isColumnModified(LabelPeer::NAME)) $criteria->add(LabelPeer::NAME, $this->name); + if ($this->isColumnModified(LabelPeer::LABEL)) $criteria->add(LabelPeer::LABEL, $this->label); + + 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(LabelPeer::DATABASE_NAME); + + $criteria->add(LabelPeer::ID, $this->id); + + 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 Label (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) + { + + $copyObj->setSection($this->section); + + $copyObj->setName($this->name); + + $copyObj->setLabel($this->label); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 Label 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); + $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 LabelPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new LabelPeer(); + } + return self::$peer; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + +} // BaseLabel diff --git a/classes/om/BaseLabelPeer.php b/classes/om/BaseLabelPeer.php new file mode 100755 index 0000000..1e35e6c --- /dev/null +++ b/classes/om/BaseLabelPeer.php @@ -0,0 +1,697 @@ + array ('Id', 'Section', 'Name', 'Label', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'section', 'name', 'label', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SECTION, self::NAME, self::LABEL, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'section', 'name', 'label', ), + 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, 'Section' => 1, 'Name' => 2, 'Label' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'section' => 1, 'name' => 2, 'label' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SECTION => 1, self::NAME => 2, self::LABEL => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'section' => 1, 'name' => 2, 'label' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new LabelMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. LabelPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(LabelPeer::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) + { + + $criteria->addSelectColumn(LabelPeer::ID); + + $criteria->addSelectColumn(LabelPeer::SECTION); + + $criteria->addSelectColumn(LabelPeer::NAME); + + $criteria->addSelectColumn(LabelPeer::LABEL); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(LabelPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + LabelPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return Label + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = LabelPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return LabelPeer::populateObjects(LabelPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + LabelPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param Label $value A Label object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(Label $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A Label object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof Label) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Label object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return Label Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = LabelPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = LabelPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = LabelPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + LabelPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 LabelPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a Label or Criteria object. + * + * @param mixed $values Criteria or Label object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from Label object + } + + if ($criteria->containsKey(LabelPeer::ID) && $criteria->keyContainsValue(LabelPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.LabelPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a Label or Criteria object. + * + * @param mixed $values Criteria or Label object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(LabelPeer::ID); + $selectCriteria->add(LabelPeer::ID, $criteria->remove(LabelPeer::ID), $comparison); + + } else { // $values is Label object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the label 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(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(LabelPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a Label or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Label object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + LabelPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof Label) { + // invalidate the cache for this single object + LabelPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(LabelPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + LabelPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given Label 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 Label $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(Label $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(LabelPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(LabelPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(LabelPeer::DATABASE_NAME, LabelPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return Label + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = LabelPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(LabelPeer::DATABASE_NAME); + $criteria->add(LabelPeer::ID, $pk); + + $v = LabelPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LabelPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(LabelPeer::DATABASE_NAME); + $criteria->add(LabelPeer::ID, $pks, Criteria::IN); + $objs = LabelPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseLabelPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the LabelPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the LabelPeer class: +// +// Propel::getDatabaseMap(LabelPeer::DATABASE_NAME)->addTableBuilder(LabelPeer::TABLE_NAME, LabelPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseLabelPeer::DATABASE_NAME)->addTableBuilder(BaseLabelPeer::TABLE_NAME, BaseLabelPeer::getMapBuilder()); + diff --git a/classes/om/BaseLilacConfiguration.php b/classes/om/BaseLilacConfiguration.php new file mode 100755 index 0000000..abba773 --- /dev/null +++ b/classes/om/BaseLilacConfiguration.php @@ -0,0 +1,670 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [version] column value. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return LilacConfiguration The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = LilacConfigurationPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [version] column. + * + * @param string $v new value + * @return LilacConfiguration The current object (for fluent API support) + */ + public function setVersion($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->version !== $v) { + $this->version = $v; + $this->modifiedColumns[] = LilacConfigurationPeer::VERSION; + } + + return $this; + } // setVersion() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->version = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 2; // 2 = LilacConfigurationPeer::NUM_COLUMNS - LilacConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating LilacConfiguration object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = LilacConfigurationPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + LilacConfigurationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + LilacConfigurationPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = LilacConfigurationPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = LilacConfigurationPeer::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 + + $this->setNew(false); + } else { + $affectedRows += LilacConfigurationPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = LilacConfigurationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = LilacConfigurationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getVersion(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = LilacConfigurationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getVersion(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = LilacConfigurationPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setVersion($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = LilacConfigurationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setVersion($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(LilacConfigurationPeer::DATABASE_NAME); + + if ($this->isColumnModified(LilacConfigurationPeer::ID)) $criteria->add(LilacConfigurationPeer::ID, $this->id); + if ($this->isColumnModified(LilacConfigurationPeer::VERSION)) $criteria->add(LilacConfigurationPeer::VERSION, $this->version); + + 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(LilacConfigurationPeer::DATABASE_NAME); + + $criteria->add(LilacConfigurationPeer::ID, $this->id); + + 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 LilacConfiguration (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) + { + + $copyObj->setVersion($this->version); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 LilacConfiguration 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); + $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 LilacConfigurationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new LilacConfigurationPeer(); + } + return self::$peer; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + +} // BaseLilacConfiguration diff --git a/classes/om/BaseLilacConfigurationPeer.php b/classes/om/BaseLilacConfigurationPeer.php new file mode 100755 index 0000000..77ecf3d --- /dev/null +++ b/classes/om/BaseLilacConfigurationPeer.php @@ -0,0 +1,687 @@ + array ('Id', 'Version', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'version', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::VERSION, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'version', ), + 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, 'Version' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'version' => 1, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::VERSION => 1, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'version' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new LilacConfigurationMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. LilacConfigurationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(LilacConfigurationPeer::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) + { + + $criteria->addSelectColumn(LilacConfigurationPeer::ID); + + $criteria->addSelectColumn(LilacConfigurationPeer::VERSION); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(LilacConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + LilacConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return LilacConfiguration + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = LilacConfigurationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return LilacConfigurationPeer::populateObjects(LilacConfigurationPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + LilacConfigurationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param LilacConfiguration $value A LilacConfiguration object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(LilacConfiguration $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A LilacConfiguration object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof LilacConfiguration) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or LilacConfiguration object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return LilacConfiguration Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = LilacConfigurationPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = LilacConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = LilacConfigurationPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + LilacConfigurationPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 LilacConfigurationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a LilacConfiguration or Criteria object. + * + * @param mixed $values Criteria or LilacConfiguration object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from LilacConfiguration object + } + + if ($criteria->containsKey(LilacConfigurationPeer::ID) && $criteria->keyContainsValue(LilacConfigurationPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.LilacConfigurationPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a LilacConfiguration or Criteria object. + * + * @param mixed $values Criteria or LilacConfiguration object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(LilacConfigurationPeer::ID); + $selectCriteria->add(LilacConfigurationPeer::ID, $criteria->remove(LilacConfigurationPeer::ID), $comparison); + + } else { // $values is LilacConfiguration object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the lilac_configuration 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(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(LilacConfigurationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a LilacConfiguration or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or LilacConfiguration object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + LilacConfigurationPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof LilacConfiguration) { + // invalidate the cache for this single object + LilacConfigurationPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(LilacConfigurationPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + LilacConfigurationPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given LilacConfiguration 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 LilacConfiguration $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(LilacConfiguration $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(LilacConfigurationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(LilacConfigurationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(LilacConfigurationPeer::DATABASE_NAME, LilacConfigurationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return LilacConfiguration + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = LilacConfigurationPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(LilacConfigurationPeer::DATABASE_NAME); + $criteria->add(LilacConfigurationPeer::ID, $pk); + + $v = LilacConfigurationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(LilacConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(LilacConfigurationPeer::DATABASE_NAME); + $criteria->add(LilacConfigurationPeer::ID, $pks, Criteria::IN); + $objs = LilacConfigurationPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseLilacConfigurationPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the LilacConfigurationPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the LilacConfigurationPeer class: +// +// Propel::getDatabaseMap(LilacConfigurationPeer::DATABASE_NAME)->addTableBuilder(LilacConfigurationPeer::TABLE_NAME, LilacConfigurationPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseLilacConfigurationPeer::DATABASE_NAME)->addTableBuilder(BaseLilacConfigurationPeer::TABLE_NAME, BaseLilacConfigurationPeer::getMapBuilder()); + diff --git a/classes/om/BaseModule.php b/classes/om/BaseModule.php new file mode 100755 index 0000000..bdbde65 --- /dev/null +++ b/classes/om/BaseModule.php @@ -0,0 +1,1274 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [add_on] column value. + * + * @return int + */ + public function getAddOn() + { + return $this->add_on; + } + + /** + * Get the [classname] column value. + * + * @return string + */ + public function getClassname() + { + return $this->classname; + } + + /** + * Get the [hook] column value. + * + * @return int + */ + public function getHook() + { + return $this->hook; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return Module The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ModulePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return Module The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = ModulePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return Module The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = ModulePeer::TITLE; + } + + return $this; + } // setTitle() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return Module The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = ModulePeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [add_on] column. + * + * @param int $v new value + * @return Module The current object (for fluent API support) + */ + public function setAddOn($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->add_on !== $v) { + $this->add_on = $v; + $this->modifiedColumns[] = ModulePeer::ADD_ON; + } + + if ($this->aAddOnRelatedByAddOn !== null && $this->aAddOnRelatedByAddOn->getId() !== $v) { + $this->aAddOnRelatedByAddOn = null; + } + + return $this; + } // setAddOn() + + /** + * Set the value of [classname] column. + * + * @param string $v new value + * @return Module The current object (for fluent API support) + */ + public function setClassname($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->classname !== $v) { + $this->classname = $v; + $this->modifiedColumns[] = ModulePeer::CLASSNAME; + } + + return $this; + } // setClassname() + + /** + * Set the value of [hook] column. + * + * @param int $v new value + * @return Module The current object (for fluent API support) + */ + public function setHook($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->hook !== $v) { + $this->hook = $v; + $this->modifiedColumns[] = ModulePeer::HOOK; + } + + if ($this->aModuleHook !== null && $this->aModuleHook->getId() !== $v) { + $this->aModuleHook = null; + } + + return $this; + } // setHook() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->add_on = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->classname = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->hook = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 7; // 7 = ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating Module object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aAddOnRelatedByAddOn !== null && $this->add_on !== $this->aAddOnRelatedByAddOn->getId()) { + $this->aAddOnRelatedByAddOn = null; + } + if ($this->aModuleHook !== null && $this->hook !== $this->aModuleHook->getId()) { + $this->aModuleHook = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ModulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aAddOnRelatedByAddOn = null; + $this->aModuleHook = null; + $this->collModuleHooks = null; + $this->lastModuleHookCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + try { + $con->beginTransaction(); + ModulePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + try { + $con->beginTransaction(); + $affectedRows = $this->doSave($con); + $con->commit(); + ModulePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aAddOnRelatedByAddOn !== null) { + if ($this->aAddOnRelatedByAddOn->isModified() || $this->aAddOnRelatedByAddOn->isNew()) { + $affectedRows += $this->aAddOnRelatedByAddOn->save($con); + } + $this->setAddOnRelatedByAddOn($this->aAddOnRelatedByAddOn); + } + + if ($this->aModuleHook !== null) { + if ($this->aModuleHook->isModified() || $this->aModuleHook->isNew()) { + $affectedRows += $this->aModuleHook->save($con); + } + $this->setModuleHook($this->aModuleHook); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = ModulePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ModulePeer::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 + + $this->setNew(false); + } else { + $affectedRows += ModulePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collModuleHooks !== null) { + foreach ($this->collModuleHooks as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aAddOnRelatedByAddOn !== null) { + if (!$this->aAddOnRelatedByAddOn->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aAddOnRelatedByAddOn->getValidationFailures()); + } + } + + if ($this->aModuleHook !== null) { + if (!$this->aModuleHook->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aModuleHook->getValidationFailures()); + } + } + + + if (($retval = ModulePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collModuleHooks !== null) { + foreach ($this->collModuleHooks as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ModulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getTitle(); + break; + case 3: + return $this->getDescription(); + break; + case 4: + return $this->getAddOn(); + break; + case 5: + return $this->getClassname(); + break; + case 6: + return $this->getHook(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = ModulePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getDescription(), + $keys[4] => $this->getAddOn(), + $keys[5] => $this->getClassname(), + $keys[6] => $this->getHook(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ModulePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setTitle($value); + break; + case 3: + $this->setDescription($value); + break; + case 4: + $this->setAddOn($value); + break; + case 5: + $this->setClassname($value); + break; + case 6: + $this->setHook($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = ModulePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setAddOn($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setClassname($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setHook($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(ModulePeer::DATABASE_NAME); + + if ($this->isColumnModified(ModulePeer::ID)) $criteria->add(ModulePeer::ID, $this->id); + if ($this->isColumnModified(ModulePeer::NAME)) $criteria->add(ModulePeer::NAME, $this->name); + if ($this->isColumnModified(ModulePeer::TITLE)) $criteria->add(ModulePeer::TITLE, $this->title); + if ($this->isColumnModified(ModulePeer::DESCRIPTION)) $criteria->add(ModulePeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(ModulePeer::ADD_ON)) $criteria->add(ModulePeer::ADD_ON, $this->add_on); + if ($this->isColumnModified(ModulePeer::CLASSNAME)) $criteria->add(ModulePeer::CLASSNAME, $this->classname); + if ($this->isColumnModified(ModulePeer::HOOK)) $criteria->add(ModulePeer::HOOK, $this->hook); + + 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(ModulePeer::DATABASE_NAME); + + $criteria->add(ModulePeer::ID, $this->id); + + 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 Module (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) + { + + $copyObj->setName($this->name); + + $copyObj->setTitle($this->title); + + $copyObj->setDescription($this->description); + + $copyObj->setAddOn($this->add_on); + + $copyObj->setClassname($this->classname); + + $copyObj->setHook($this->hook); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getModuleHooks() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addModuleHook($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 Module 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); + $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 ModulePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ModulePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a AddOn object. + * + * @param AddOn $v + * @return Module The current object (for fluent API support) + * @throws PropelException + */ + public function setAddOnRelatedByAddOn(AddOn $v = null) + { + if ($v === null) { + $this->setAddOn(NULL); + } else { + $this->setAddOn($v->getId()); + } + + $this->aAddOnRelatedByAddOn = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the AddOn object, it will not be re-added. + if ($v !== null) { + $v->addModule($this); + } + + return $this; + } + + + /** + * Get the associated AddOn object + * + * @param PropelPDO Optional Connection object. + * @return AddOn The associated AddOn object. + * @throws PropelException + */ + public function getAddOnRelatedByAddOn(PropelPDO $con = null) + { + if ($this->aAddOnRelatedByAddOn === null && ($this->add_on !== null)) { + $this->aAddOnRelatedByAddOn = AddOnPeer::retrieveByPK($this->add_on, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aAddOnRelatedByAddOn->addModules($this); + */ + } + return $this->aAddOnRelatedByAddOn; + } + + /** + * Declares an association between this object and a ModuleHook object. + * + * @param ModuleHook $v + * @return Module The current object (for fluent API support) + * @throws PropelException + */ + public function setModuleHook(ModuleHook $v = null) + { + if ($v === null) { + $this->setHook(NULL); + } else { + $this->setHook($v->getId()); + } + + $this->aModuleHook = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ModuleHook object, it will not be re-added. + if ($v !== null) { + $v->addModule($this); + } + + return $this; + } + + + /** + * Get the associated ModuleHook object + * + * @param PropelPDO Optional Connection object. + * @return ModuleHook The associated ModuleHook object. + * @throws PropelException + */ + public function getModuleHook(PropelPDO $con = null) + { + if ($this->aModuleHook === null && ($this->hook !== null)) { + $this->aModuleHook = ModuleHookPeer::retrieveByPK($this->hook, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aModuleHook->addModules($this); + */ + } + return $this->aModuleHook; + } + + /** + * Clears out the collModuleHooks collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addModuleHooks() + */ + public function clearModuleHooks() + { + $this->collModuleHooks = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collModuleHooks collection (array). + * + * By default this just sets the collModuleHooks collection to an empty array (like clearcollModuleHooks()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initModuleHooks() + { + $this->collModuleHooks = array(); + } + + /** + * Gets an array of ModuleHook objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this Module has previously been saved, it will retrieve + * related ModuleHooks from storage. If this Module is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array ModuleHook[] + * @throws PropelException + */ + public function getModuleHooks($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ModulePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collModuleHooks === null) { + if ($this->isNew()) { + $this->collModuleHooks = array(); + } else { + + $criteria->add(ModuleHookPeer::MODULE, $this->id); + + ModuleHookPeer::addSelectColumns($criteria); + $this->collModuleHooks = ModuleHookPeer::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. + + + $criteria->add(ModuleHookPeer::MODULE, $this->id); + + ModuleHookPeer::addSelectColumns($criteria); + if (!isset($this->lastModuleHookCriteria) || !$this->lastModuleHookCriteria->equals($criteria)) { + $this->collModuleHooks = ModuleHookPeer::doSelect($criteria, $con); + } + } + } + $this->lastModuleHookCriteria = $criteria; + return $this->collModuleHooks; + } + + /** + * Returns the number of related ModuleHook objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related ModuleHook objects. + * @throws PropelException + */ + public function countModuleHooks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(ModulePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collModuleHooks === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(ModuleHookPeer::MODULE, $this->id); + + $count = ModuleHookPeer::doCount($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 count of the collection. + + + $criteria->add(ModuleHookPeer::MODULE, $this->id); + + if (!isset($this->lastModuleHookCriteria) || !$this->lastModuleHookCriteria->equals($criteria)) { + $count = ModuleHookPeer::doCount($criteria, $con); + } else { + $count = count($this->collModuleHooks); + } + } else { + $count = count($this->collModuleHooks); + } + } + $this->lastModuleHookCriteria = $criteria; + return $count; + } + + /** + * Method called to associate a ModuleHook object to this object + * through the ModuleHook foreign key attribute. + * + * @param ModuleHook $l ModuleHook + * @return void + * @throws PropelException + */ + public function addModuleHook(ModuleHook $l) + { + if ($this->collModuleHooks === null) { + $this->initModuleHooks(); + } + if (!in_array($l, $this->collModuleHooks, true)) { // only add it if the **same** object is not already associated + array_push($this->collModuleHooks, $l); + $l->setModuleRelatedByModule($this); + } + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collModuleHooks) { + foreach ((array) $this->collModuleHooks as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collModuleHooks = null; + } + +} // BaseModule diff --git a/classes/om/BaseModulePeer.php b/classes/om/BaseModulePeer.php new file mode 100755 index 0000000..81e4fd6 --- /dev/null +++ b/classes/om/BaseModulePeer.php @@ -0,0 +1,1372 @@ + array ('Id', 'Name', 'Title', 'Description', 'AddOn', 'Classname', 'Hook', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'title', 'description', 'addOn', 'classname', 'hook', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::TITLE, self::DESCRIPTION, self::ADD_ON, self::CLASSNAME, self::HOOK, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'title', 'description', 'add_on', 'classname', 'hook', ), + 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, 'Name' => 1, 'Title' => 2, 'Description' => 3, 'AddOn' => 4, 'Classname' => 5, 'Hook' => 6, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'title' => 2, 'description' => 3, 'addOn' => 4, 'classname' => 5, 'hook' => 6, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::TITLE => 2, self::DESCRIPTION => 3, self::ADD_ON => 4, self::CLASSNAME => 5, self::HOOK => 6, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'title' => 2, 'description' => 3, 'add_on' => 4, 'classname' => 5, 'hook' => 6, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new ModuleMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ModulePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ModulePeer::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) + { + + $criteria->addSelectColumn(ModulePeer::ID); + + $criteria->addSelectColumn(ModulePeer::NAME); + + $criteria->addSelectColumn(ModulePeer::TITLE); + + $criteria->addSelectColumn(ModulePeer::DESCRIPTION); + + $criteria->addSelectColumn(ModulePeer::ADD_ON); + + $criteria->addSelectColumn(ModulePeer::CLASSNAME); + + $criteria->addSelectColumn(ModulePeer::HOOK); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ModulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return Module + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ModulePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return ModulePeer::populateObjects(ModulePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ModulePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param Module $value A Module object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(Module $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A Module object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof Module) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Module object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return Module Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ModulePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ModulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ModulePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related AddOnRelatedByAddOn table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAddOnRelatedByAddOn(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ModulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related ModuleHook table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinModuleHook(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ModulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of Module objects pre-filled with their AddOn objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of Module objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAddOnRelatedByAddOn(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ModulePeer::addSelectColumns($c); + $startcol = (ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS); + AddOnPeer::addSelectColumns($c); + + $c->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ModulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = ModulePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ModulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = AddOnPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = AddOnPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AddOnPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + AddOnPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (Module) to $obj2 (AddOn) + $obj2->addModule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of Module objects pre-filled with their ModuleHook objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of Module objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinModuleHook(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ModulePeer::addSelectColumns($c); + $startcol = (ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS); + ModuleHookPeer::addSelectColumns($c); + + $c->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ModulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = ModulePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ModulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = ModuleHookPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = ModuleHookPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ModuleHookPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + ModuleHookPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (Module) to $obj2 (ModuleHook) + $obj2->addModule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ModulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + $criteria->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of Module objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of Module objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + ModulePeer::addSelectColumns($c); + $startcol2 = (ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS); + + AddOnPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AddOnPeer::NUM_COLUMNS - AddOnPeer::NUM_LAZY_LOAD_COLUMNS); + + ModuleHookPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (ModuleHookPeer::NUM_COLUMNS - ModuleHookPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + $c->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ModulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = ModulePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ModulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AddOn rows + + $key2 = AddOnPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AddOnPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AddOnPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AddOnPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (Module) to the collection in $obj2 (AddOn) + $obj2->addModule($obj1); + } // if joined row not null + + // Add objects for joined ModuleHook rows + + $key3 = ModuleHookPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = ModuleHookPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = ModuleHookPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + ModuleHookPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (Module) to the collection in $obj3 (ModuleHook) + $obj3->addModule($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related AddOnRelatedByAddOn table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptAddOnRelatedByAddOn(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related ModuleHook table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptModuleHook(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of Module objects pre-filled with all related objects except AddOnRelatedByAddOn. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of Module objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptAddOnRelatedByAddOn(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + ModulePeer::addSelectColumns($c); + $startcol2 = (ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS); + + ModuleHookPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (ModuleHookPeer::NUM_COLUMNS - ModuleHookPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(ModulePeer::HOOK,), array(ModuleHookPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ModulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = ModulePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ModulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined ModuleHook rows + + $key2 = ModuleHookPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = ModuleHookPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = ModuleHookPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + ModuleHookPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (Module) to the collection in $obj2 (ModuleHook) + $obj2->addModule($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of Module objects pre-filled with all related objects except ModuleHook. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of Module objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptModuleHook(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + ModulePeer::addSelectColumns($c); + $startcol2 = (ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS); + + AddOnPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (AddOnPeer::NUM_COLUMNS - AddOnPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(ModulePeer::ADD_ON,), array(AddOnPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ModulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = ModulePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + ModulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined AddOn rows + + $key2 = AddOnPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = AddOnPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = AddOnPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + AddOnPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (Module) to the collection in $obj2 (AddOn) + $obj2->addModule($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 ModulePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a Module or Criteria object. + * + * @param mixed $values Criteria or Module object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from Module object + } + + if ($criteria->containsKey(ModulePeer::ID) && $criteria->keyContainsValue(ModulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ModulePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a Module or Criteria object. + * + * @param mixed $values Criteria or Module object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ModulePeer::ID); + $selectCriteria->add(ModulePeer::ID, $criteria->remove(ModulePeer::ID), $comparison); + + } else { // $values is Module object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the module 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(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += ModulePeer::doOnDeleteCascade(new Criteria(ModulePeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(ModulePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a Module or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Module object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ModulePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof Module) { + // invalidate the cache for this single object + ModulePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ModulePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + ModulePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += ModulePeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + ModulePeer::clearInstancePool(); + } else { // it's a PK or object + ModulePeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in ModuleHookPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + ModuleHookPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = ModulePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related ModuleHook objects + $c = new Criteria(ModuleHookPeer::DATABASE_NAME); + + $c->add(ModuleHookPeer::MODULE, $obj->getId()); + $affectedRows += ModuleHookPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given Module 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 Module $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(Module $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ModulePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ModulePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ModulePeer::DATABASE_NAME, ModulePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return Module + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ModulePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ModulePeer::DATABASE_NAME); + $criteria->add(ModulePeer::ID, $pk); + + $v = ModulePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ModulePeer::DATABASE_NAME); + $criteria->add(ModulePeer::ID, $pks, Criteria::IN); + $objs = ModulePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseModulePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the ModulePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the ModulePeer class: +// +// Propel::getDatabaseMap(ModulePeer::DATABASE_NAME)->addTableBuilder(ModulePeer::TABLE_NAME, ModulePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseModulePeer::DATABASE_NAME)->addTableBuilder(BaseModulePeer::TABLE_NAME, BaseModulePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosBrokerModule.php b/classes/om/BaseNagiosBrokerModule.php new file mode 100755 index 0000000..fff43e1 --- /dev/null +++ b/classes/om/BaseNagiosBrokerModule.php @@ -0,0 +1,670 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [line] column value. + * + * @return string + */ + public function getLine() + { + return $this->line; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosBrokerModule The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosBrokerModulePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [line] column. + * + * @param string $v new value + * @return NagiosBrokerModule The current object (for fluent API support) + */ + public function setLine($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->line !== $v) { + $this->line = $v; + $this->modifiedColumns[] = NagiosBrokerModulePeer::LINE; + } + + return $this; + } // setLine() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->line = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 2; // 2 = NagiosBrokerModulePeer::NUM_COLUMNS - NagiosBrokerModulePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosBrokerModule object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosBrokerModulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosBrokerModulePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosBrokerModulePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosBrokerModulePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosBrokerModulePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosBrokerModulePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosBrokerModulePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosBrokerModulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getLine(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosBrokerModulePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getLine(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosBrokerModulePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setLine($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosBrokerModulePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setLine($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(NagiosBrokerModulePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosBrokerModulePeer::ID)) $criteria->add(NagiosBrokerModulePeer::ID, $this->id); + if ($this->isColumnModified(NagiosBrokerModulePeer::LINE)) $criteria->add(NagiosBrokerModulePeer::LINE, $this->line); + + 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(NagiosBrokerModulePeer::DATABASE_NAME); + + $criteria->add(NagiosBrokerModulePeer::ID, $this->id); + + 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 NagiosBrokerModule (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) + { + + $copyObj->setLine($this->line); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosBrokerModule 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); + $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 NagiosBrokerModulePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosBrokerModulePeer(); + } + return self::$peer; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + +} // BaseNagiosBrokerModule diff --git a/classes/om/BaseNagiosBrokerModulePeer.php b/classes/om/BaseNagiosBrokerModulePeer.php new file mode 100755 index 0000000..71aad62 --- /dev/null +++ b/classes/om/BaseNagiosBrokerModulePeer.php @@ -0,0 +1,687 @@ + array ('Id', 'Line', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'line', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::LINE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'line', ), + 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, 'Line' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'line' => 1, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LINE => 1, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'line' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosBrokerModuleMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosBrokerModulePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosBrokerModulePeer::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) + { + + $criteria->addSelectColumn(NagiosBrokerModulePeer::ID); + + $criteria->addSelectColumn(NagiosBrokerModulePeer::LINE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosBrokerModulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosBrokerModulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosBrokerModule + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosBrokerModulePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosBrokerModulePeer::populateObjects(NagiosBrokerModulePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosBrokerModulePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosBrokerModule $value A NagiosBrokerModule object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosBrokerModule $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosBrokerModule object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosBrokerModule) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosBrokerModule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosBrokerModule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosBrokerModulePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosBrokerModulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosBrokerModulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosBrokerModulePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosBrokerModulePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosBrokerModule or Criteria object. + * + * @param mixed $values Criteria or NagiosBrokerModule object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosBrokerModule object + } + + if ($criteria->containsKey(NagiosBrokerModulePeer::ID) && $criteria->keyContainsValue(NagiosBrokerModulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosBrokerModulePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosBrokerModule or Criteria object. + * + * @param mixed $values Criteria or NagiosBrokerModule object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosBrokerModulePeer::ID); + $selectCriteria->add(NagiosBrokerModulePeer::ID, $criteria->remove(NagiosBrokerModulePeer::ID), $comparison); + + } else { // $values is NagiosBrokerModule object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_broker_module 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(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosBrokerModulePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosBrokerModule or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosBrokerModule object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosBrokerModulePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosBrokerModule) { + // invalidate the cache for this single object + NagiosBrokerModulePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosBrokerModulePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosBrokerModulePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosBrokerModule 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 NagiosBrokerModule $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(NagiosBrokerModule $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosBrokerModulePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosBrokerModulePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosBrokerModulePeer::DATABASE_NAME, NagiosBrokerModulePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosBrokerModule + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosBrokerModulePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosBrokerModulePeer::DATABASE_NAME); + $criteria->add(NagiosBrokerModulePeer::ID, $pk); + + $v = NagiosBrokerModulePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosBrokerModulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosBrokerModulePeer::DATABASE_NAME); + $criteria->add(NagiosBrokerModulePeer::ID, $pks, Criteria::IN); + $objs = NagiosBrokerModulePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosBrokerModulePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosBrokerModulePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosBrokerModulePeer class: +// +// Propel::getDatabaseMap(NagiosBrokerModulePeer::DATABASE_NAME)->addTableBuilder(NagiosBrokerModulePeer::TABLE_NAME, NagiosBrokerModulePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosBrokerModulePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosBrokerModulePeer::TABLE_NAME, BaseNagiosBrokerModulePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosCgiConfiguration.php b/classes/om/BaseNagiosCgiConfiguration.php new file mode 100755 index 0000000..bb1e6a1 --- /dev/null +++ b/classes/om/BaseNagiosCgiConfiguration.php @@ -0,0 +1,1966 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [physical_html_path] column value. + * + * @return string + */ + public function getPhysicalHtmlPath() + { + return $this->physical_html_path; + } + + /** + * Get the [url_html_path] column value. + * + * @return string + */ + public function getUrlHtmlPath() + { + return $this->url_html_path; + } + + /** + * Get the [use_authentication] column value. + * + * @return boolean + */ + public function getUseAuthentication() + { + return $this->use_authentication; + } + + /** + * Get the [default_user_name] column value. + * + * @return string + */ + public function getDefaultUserName() + { + return $this->default_user_name; + } + + /** + * Get the [authorized_for_system_information] column value. + * + * @return string + */ + public function getAuthorizedForSystemInformation() + { + return $this->authorized_for_system_information; + } + + /** + * Get the [authorized_for_system_commands] column value. + * + * @return string + */ + public function getAuthorizedForSystemCommands() + { + return $this->authorized_for_system_commands; + } + + /** + * Get the [authorized_for_configuration_information] column value. + * + * @return string + */ + public function getAuthorizedForConfigurationInformation() + { + return $this->authorized_for_configuration_information; + } + + /** + * Get the [authorized_for_all_hosts] column value. + * + * @return string + */ + public function getAuthorizedForAllHosts() + { + return $this->authorized_for_all_hosts; + } + + /** + * Get the [authorized_for_all_host_commands] column value. + * + * @return string + */ + public function getAuthorizedForAllHostCommands() + { + return $this->authorized_for_all_host_commands; + } + + /** + * Get the [authorized_for_all_services] column value. + * + * @return string + */ + public function getAuthorizedForAllServices() + { + return $this->authorized_for_all_services; + } + + /** + * Get the [authorized_for_all_service_commands] column value. + * + * @return string + */ + public function getAuthorizedForAllServiceCommands() + { + return $this->authorized_for_all_service_commands; + } + + /** + * Get the [lock_author_names] column value. + * + * @return boolean + */ + public function getLockAuthorNames() + { + return $this->lock_author_names; + } + + /** + * Get the [statusmap_background_image] column value. + * + * @return string + */ + public function getStatusmapBackgroundImage() + { + return $this->statusmap_background_image; + } + + /** + * Get the [default_statusmap_layout] column value. + * + * @return int + */ + public function getDefaultStatusmapLayout() + { + return $this->default_statusmap_layout; + } + + /** + * Get the [statuswrl_include] column value. + * + * @return string + */ + public function getStatuswrlInclude() + { + return $this->statuswrl_include; + } + + /** + * Get the [default_statuswrl_layout] column value. + * + * @return int + */ + public function getDefaultStatuswrlLayout() + { + return $this->default_statuswrl_layout; + } + + /** + * Get the [refresh_rate] column value. + * + * @return int + */ + public function getRefreshRate() + { + return $this->refresh_rate; + } + + /** + * Get the [host_unreachable_sound] column value. + * + * @return string + */ + public function getHostUnreachableSound() + { + return $this->host_unreachable_sound; + } + + /** + * Get the [host_down_sound] column value. + * + * @return string + */ + public function getHostDownSound() + { + return $this->host_down_sound; + } + + /** + * Get the [service_critical_sound] column value. + * + * @return string + */ + public function getServiceCriticalSound() + { + return $this->service_critical_sound; + } + + /** + * Get the [service_warning_sound] column value. + * + * @return string + */ + public function getServiceWarningSound() + { + return $this->service_warning_sound; + } + + /** + * Get the [service_unknown_sound] column value. + * + * @return string + */ + public function getServiceUnknownSound() + { + return $this->service_unknown_sound; + } + + /** + * Get the [ping_syntax] column value. + * + * @return string + */ + public function getPingSyntax() + { + return $this->ping_syntax; + } + + /** + * Get the [escape_html_tags] column value. + * + * @return boolean + */ + public function getEscapeHtmlTags() + { + return $this->escape_html_tags; + } + + /** + * Get the [notes_url_target] column value. + * + * @return string + */ + public function getNotesUrlTarget() + { + return $this->notes_url_target; + } + + /** + * Get the [action_url_target] column value. + * + * @return string + */ + public function getActionUrlTarget() + { + return $this->action_url_target; + } + + /** + * Get the [enable_splunk_integration] column value. + * + * @return boolean + */ + public function getEnableSplunkIntegration() + { + return $this->enable_splunk_integration; + } + + /** + * Get the [splunk_url] column value. + * + * @return string + */ + public function getSplunkUrl() + { + return $this->splunk_url; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [physical_html_path] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setPhysicalHtmlPath($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->physical_html_path !== $v) { + $this->physical_html_path = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::PHYSICAL_HTML_PATH; + } + + return $this; + } // setPhysicalHtmlPath() + + /** + * Set the value of [url_html_path] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setUrlHtmlPath($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url_html_path !== $v) { + $this->url_html_path = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::URL_HTML_PATH; + } + + return $this; + } // setUrlHtmlPath() + + /** + * Set the value of [use_authentication] column. + * + * @param boolean $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setUseAuthentication($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_authentication !== $v) { + $this->use_authentication = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::USE_AUTHENTICATION; + } + + return $this; + } // setUseAuthentication() + + /** + * Set the value of [default_user_name] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setDefaultUserName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->default_user_name !== $v) { + $this->default_user_name = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::DEFAULT_USER_NAME; + } + + return $this; + } // setDefaultUserName() + + /** + * Set the value of [authorized_for_system_information] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForSystemInformation($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_system_information !== $v) { + $this->authorized_for_system_information = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_INFORMATION; + } + + return $this; + } // setAuthorizedForSystemInformation() + + /** + * Set the value of [authorized_for_system_commands] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForSystemCommands($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_system_commands !== $v) { + $this->authorized_for_system_commands = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_COMMANDS; + } + + return $this; + } // setAuthorizedForSystemCommands() + + /** + * Set the value of [authorized_for_configuration_information] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForConfigurationInformation($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_configuration_information !== $v) { + $this->authorized_for_configuration_information = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_CONFIGURATION_INFORMATION; + } + + return $this; + } // setAuthorizedForConfigurationInformation() + + /** + * Set the value of [authorized_for_all_hosts] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForAllHosts($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_all_hosts !== $v) { + $this->authorized_for_all_hosts = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOSTS; + } + + return $this; + } // setAuthorizedForAllHosts() + + /** + * Set the value of [authorized_for_all_host_commands] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForAllHostCommands($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_all_host_commands !== $v) { + $this->authorized_for_all_host_commands = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOST_COMMANDS; + } + + return $this; + } // setAuthorizedForAllHostCommands() + + /** + * Set the value of [authorized_for_all_services] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForAllServices($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_all_services !== $v) { + $this->authorized_for_all_services = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICES; + } + + return $this; + } // setAuthorizedForAllServices() + + /** + * Set the value of [authorized_for_all_service_commands] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setAuthorizedForAllServiceCommands($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->authorized_for_all_service_commands !== $v) { + $this->authorized_for_all_service_commands = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS; + } + + return $this; + } // setAuthorizedForAllServiceCommands() + + /** + * Set the value of [lock_author_names] column. + * + * @param boolean $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setLockAuthorNames($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->lock_author_names !== $v) { + $this->lock_author_names = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::LOCK_AUTHOR_NAMES; + } + + return $this; + } // setLockAuthorNames() + + /** + * Set the value of [statusmap_background_image] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setStatusmapBackgroundImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->statusmap_background_image !== $v) { + $this->statusmap_background_image = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::STATUSMAP_BACKGROUND_IMAGE; + } + + return $this; + } // setStatusmapBackgroundImage() + + /** + * Set the value of [default_statusmap_layout] column. + * + * @param int $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setDefaultStatusmapLayout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->default_statusmap_layout !== $v) { + $this->default_statusmap_layout = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::DEFAULT_STATUSMAP_LAYOUT; + } + + return $this; + } // setDefaultStatusmapLayout() + + /** + * Set the value of [statuswrl_include] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setStatuswrlInclude($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->statuswrl_include !== $v) { + $this->statuswrl_include = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::STATUSWRL_INCLUDE; + } + + return $this; + } // setStatuswrlInclude() + + /** + * Set the value of [default_statuswrl_layout] column. + * + * @param int $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setDefaultStatuswrlLayout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->default_statuswrl_layout !== $v) { + $this->default_statuswrl_layout = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::DEFAULT_STATUSWRL_LAYOUT; + } + + return $this; + } // setDefaultStatuswrlLayout() + + /** + * Set the value of [refresh_rate] column. + * + * @param int $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setRefreshRate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->refresh_rate !== $v) { + $this->refresh_rate = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::REFRESH_RATE; + } + + return $this; + } // setRefreshRate() + + /** + * Set the value of [host_unreachable_sound] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setHostUnreachableSound($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_unreachable_sound !== $v) { + $this->host_unreachable_sound = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::HOST_UNREACHABLE_SOUND; + } + + return $this; + } // setHostUnreachableSound() + + /** + * Set the value of [host_down_sound] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setHostDownSound($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_down_sound !== $v) { + $this->host_down_sound = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::HOST_DOWN_SOUND; + } + + return $this; + } // setHostDownSound() + + /** + * Set the value of [service_critical_sound] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setServiceCriticalSound($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_critical_sound !== $v) { + $this->service_critical_sound = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::SERVICE_CRITICAL_SOUND; + } + + return $this; + } // setServiceCriticalSound() + + /** + * Set the value of [service_warning_sound] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setServiceWarningSound($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_warning_sound !== $v) { + $this->service_warning_sound = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::SERVICE_WARNING_SOUND; + } + + return $this; + } // setServiceWarningSound() + + /** + * Set the value of [service_unknown_sound] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setServiceUnknownSound($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_unknown_sound !== $v) { + $this->service_unknown_sound = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::SERVICE_UNKNOWN_SOUND; + } + + return $this; + } // setServiceUnknownSound() + + /** + * Set the value of [ping_syntax] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setPingSyntax($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->ping_syntax !== $v) { + $this->ping_syntax = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::PING_SYNTAX; + } + + return $this; + } // setPingSyntax() + + /** + * Set the value of [escape_html_tags] column. + * + * @param boolean $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setEscapeHtmlTags($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escape_html_tags !== $v) { + $this->escape_html_tags = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::ESCAPE_HTML_TAGS; + } + + return $this; + } // setEscapeHtmlTags() + + /** + * Set the value of [notes_url_target] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setNotesUrlTarget($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url_target !== $v) { + $this->notes_url_target = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::NOTES_URL_TARGET; + } + + return $this; + } // setNotesUrlTarget() + + /** + * Set the value of [action_url_target] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setActionUrlTarget($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url_target !== $v) { + $this->action_url_target = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::ACTION_URL_TARGET; + } + + return $this; + } // setActionUrlTarget() + + /** + * Set the value of [enable_splunk_integration] column. + * + * @param boolean $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setEnableSplunkIntegration($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_splunk_integration !== $v) { + $this->enable_splunk_integration = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::ENABLE_SPLUNK_INTEGRATION; + } + + return $this; + } // setEnableSplunkIntegration() + + /** + * Set the value of [splunk_url] column. + * + * @param string $v new value + * @return NagiosCgiConfiguration The current object (for fluent API support) + */ + public function setSplunkUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->splunk_url !== $v) { + $this->splunk_url = $v; + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::SPLUNK_URL; + } + + return $this; + } // setSplunkUrl() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->physical_html_path = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->url_html_path = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->use_authentication = ($row[$startcol + 3] !== null) ? (boolean) $row[$startcol + 3] : null; + $this->default_user_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->authorized_for_system_information = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->authorized_for_system_commands = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->authorized_for_configuration_information = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->authorized_for_all_hosts = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->authorized_for_all_host_commands = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->authorized_for_all_services = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->authorized_for_all_service_commands = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->lock_author_names = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->statusmap_background_image = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->default_statusmap_layout = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; + $this->statuswrl_include = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; + $this->default_statuswrl_layout = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null; + $this->refresh_rate = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null; + $this->host_unreachable_sound = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null; + $this->host_down_sound = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; + $this->service_critical_sound = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; + $this->service_warning_sound = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null; + $this->service_unknown_sound = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; + $this->ping_syntax = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null; + $this->escape_html_tags = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; + $this->notes_url_target = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null; + $this->action_url_target = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null; + $this->enable_splunk_integration = ($row[$startcol + 27] !== null) ? (boolean) $row[$startcol + 27] : null; + $this->splunk_url = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 29; // 29 = NagiosCgiConfigurationPeer::NUM_COLUMNS - NagiosCgiConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosCgiConfiguration object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosCgiConfigurationPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosCgiConfigurationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosCgiConfigurationPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosCgiConfigurationPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosCgiConfigurationPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosCgiConfigurationPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosCgiConfigurationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosCgiConfigurationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getPhysicalHtmlPath(); + break; + case 2: + return $this->getUrlHtmlPath(); + break; + case 3: + return $this->getUseAuthentication(); + break; + case 4: + return $this->getDefaultUserName(); + break; + case 5: + return $this->getAuthorizedForSystemInformation(); + break; + case 6: + return $this->getAuthorizedForSystemCommands(); + break; + case 7: + return $this->getAuthorizedForConfigurationInformation(); + break; + case 8: + return $this->getAuthorizedForAllHosts(); + break; + case 9: + return $this->getAuthorizedForAllHostCommands(); + break; + case 10: + return $this->getAuthorizedForAllServices(); + break; + case 11: + return $this->getAuthorizedForAllServiceCommands(); + break; + case 12: + return $this->getLockAuthorNames(); + break; + case 13: + return $this->getStatusmapBackgroundImage(); + break; + case 14: + return $this->getDefaultStatusmapLayout(); + break; + case 15: + return $this->getStatuswrlInclude(); + break; + case 16: + return $this->getDefaultStatuswrlLayout(); + break; + case 17: + return $this->getRefreshRate(); + break; + case 18: + return $this->getHostUnreachableSound(); + break; + case 19: + return $this->getHostDownSound(); + break; + case 20: + return $this->getServiceCriticalSound(); + break; + case 21: + return $this->getServiceWarningSound(); + break; + case 22: + return $this->getServiceUnknownSound(); + break; + case 23: + return $this->getPingSyntax(); + break; + case 24: + return $this->getEscapeHtmlTags(); + break; + case 25: + return $this->getNotesUrlTarget(); + break; + case 26: + return $this->getActionUrlTarget(); + break; + case 27: + return $this->getEnableSplunkIntegration(); + break; + case 28: + return $this->getSplunkUrl(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosCgiConfigurationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getPhysicalHtmlPath(), + $keys[2] => $this->getUrlHtmlPath(), + $keys[3] => $this->getUseAuthentication(), + $keys[4] => $this->getDefaultUserName(), + $keys[5] => $this->getAuthorizedForSystemInformation(), + $keys[6] => $this->getAuthorizedForSystemCommands(), + $keys[7] => $this->getAuthorizedForConfigurationInformation(), + $keys[8] => $this->getAuthorizedForAllHosts(), + $keys[9] => $this->getAuthorizedForAllHostCommands(), + $keys[10] => $this->getAuthorizedForAllServices(), + $keys[11] => $this->getAuthorizedForAllServiceCommands(), + $keys[12] => $this->getLockAuthorNames(), + $keys[13] => $this->getStatusmapBackgroundImage(), + $keys[14] => $this->getDefaultStatusmapLayout(), + $keys[15] => $this->getStatuswrlInclude(), + $keys[16] => $this->getDefaultStatuswrlLayout(), + $keys[17] => $this->getRefreshRate(), + $keys[18] => $this->getHostUnreachableSound(), + $keys[19] => $this->getHostDownSound(), + $keys[20] => $this->getServiceCriticalSound(), + $keys[21] => $this->getServiceWarningSound(), + $keys[22] => $this->getServiceUnknownSound(), + $keys[23] => $this->getPingSyntax(), + $keys[24] => $this->getEscapeHtmlTags(), + $keys[25] => $this->getNotesUrlTarget(), + $keys[26] => $this->getActionUrlTarget(), + $keys[27] => $this->getEnableSplunkIntegration(), + $keys[28] => $this->getSplunkUrl(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosCgiConfigurationPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setPhysicalHtmlPath($value); + break; + case 2: + $this->setUrlHtmlPath($value); + break; + case 3: + $this->setUseAuthentication($value); + break; + case 4: + $this->setDefaultUserName($value); + break; + case 5: + $this->setAuthorizedForSystemInformation($value); + break; + case 6: + $this->setAuthorizedForSystemCommands($value); + break; + case 7: + $this->setAuthorizedForConfigurationInformation($value); + break; + case 8: + $this->setAuthorizedForAllHosts($value); + break; + case 9: + $this->setAuthorizedForAllHostCommands($value); + break; + case 10: + $this->setAuthorizedForAllServices($value); + break; + case 11: + $this->setAuthorizedForAllServiceCommands($value); + break; + case 12: + $this->setLockAuthorNames($value); + break; + case 13: + $this->setStatusmapBackgroundImage($value); + break; + case 14: + $this->setDefaultStatusmapLayout($value); + break; + case 15: + $this->setStatuswrlInclude($value); + break; + case 16: + $this->setDefaultStatuswrlLayout($value); + break; + case 17: + $this->setRefreshRate($value); + break; + case 18: + $this->setHostUnreachableSound($value); + break; + case 19: + $this->setHostDownSound($value); + break; + case 20: + $this->setServiceCriticalSound($value); + break; + case 21: + $this->setServiceWarningSound($value); + break; + case 22: + $this->setServiceUnknownSound($value); + break; + case 23: + $this->setPingSyntax($value); + break; + case 24: + $this->setEscapeHtmlTags($value); + break; + case 25: + $this->setNotesUrlTarget($value); + break; + case 26: + $this->setActionUrlTarget($value); + break; + case 27: + $this->setEnableSplunkIntegration($value); + break; + case 28: + $this->setSplunkUrl($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosCgiConfigurationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setPhysicalHtmlPath($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setUrlHtmlPath($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setUseAuthentication($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDefaultUserName($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setAuthorizedForSystemInformation($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setAuthorizedForSystemCommands($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setAuthorizedForConfigurationInformation($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setAuthorizedForAllHosts($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setAuthorizedForAllHostCommands($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setAuthorizedForAllServices($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setAuthorizedForAllServiceCommands($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setLockAuthorNames($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setStatusmapBackgroundImage($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDefaultStatusmapLayout($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setStatuswrlInclude($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setDefaultStatuswrlLayout($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setRefreshRate($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setHostUnreachableSound($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setHostDownSound($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setServiceCriticalSound($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setServiceWarningSound($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setServiceUnknownSound($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setPingSyntax($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setEscapeHtmlTags($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setNotesUrlTarget($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setActionUrlTarget($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setEnableSplunkIntegration($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setSplunkUrl($arr[$keys[28]]); + } + + /** + * 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(NagiosCgiConfigurationPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosCgiConfigurationPeer::ID)) $criteria->add(NagiosCgiConfigurationPeer::ID, $this->id); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::PHYSICAL_HTML_PATH)) $criteria->add(NagiosCgiConfigurationPeer::PHYSICAL_HTML_PATH, $this->physical_html_path); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::URL_HTML_PATH)) $criteria->add(NagiosCgiConfigurationPeer::URL_HTML_PATH, $this->url_html_path); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::USE_AUTHENTICATION)) $criteria->add(NagiosCgiConfigurationPeer::USE_AUTHENTICATION, $this->use_authentication); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::DEFAULT_USER_NAME)) $criteria->add(NagiosCgiConfigurationPeer::DEFAULT_USER_NAME, $this->default_user_name); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_INFORMATION)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_INFORMATION, $this->authorized_for_system_information); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_COMMANDS)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_COMMANDS, $this->authorized_for_system_commands); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_CONFIGURATION_INFORMATION)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_CONFIGURATION_INFORMATION, $this->authorized_for_configuration_information); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOSTS)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOSTS, $this->authorized_for_all_hosts); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOST_COMMANDS)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOST_COMMANDS, $this->authorized_for_all_host_commands); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICES)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICES, $this->authorized_for_all_services); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS)) $criteria->add(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS, $this->authorized_for_all_service_commands); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::LOCK_AUTHOR_NAMES)) $criteria->add(NagiosCgiConfigurationPeer::LOCK_AUTHOR_NAMES, $this->lock_author_names); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::STATUSMAP_BACKGROUND_IMAGE)) $criteria->add(NagiosCgiConfigurationPeer::STATUSMAP_BACKGROUND_IMAGE, $this->statusmap_background_image); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::DEFAULT_STATUSMAP_LAYOUT)) $criteria->add(NagiosCgiConfigurationPeer::DEFAULT_STATUSMAP_LAYOUT, $this->default_statusmap_layout); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::STATUSWRL_INCLUDE)) $criteria->add(NagiosCgiConfigurationPeer::STATUSWRL_INCLUDE, $this->statuswrl_include); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::DEFAULT_STATUSWRL_LAYOUT)) $criteria->add(NagiosCgiConfigurationPeer::DEFAULT_STATUSWRL_LAYOUT, $this->default_statuswrl_layout); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::REFRESH_RATE)) $criteria->add(NagiosCgiConfigurationPeer::REFRESH_RATE, $this->refresh_rate); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::HOST_UNREACHABLE_SOUND)) $criteria->add(NagiosCgiConfigurationPeer::HOST_UNREACHABLE_SOUND, $this->host_unreachable_sound); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::HOST_DOWN_SOUND)) $criteria->add(NagiosCgiConfigurationPeer::HOST_DOWN_SOUND, $this->host_down_sound); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::SERVICE_CRITICAL_SOUND)) $criteria->add(NagiosCgiConfigurationPeer::SERVICE_CRITICAL_SOUND, $this->service_critical_sound); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::SERVICE_WARNING_SOUND)) $criteria->add(NagiosCgiConfigurationPeer::SERVICE_WARNING_SOUND, $this->service_warning_sound); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::SERVICE_UNKNOWN_SOUND)) $criteria->add(NagiosCgiConfigurationPeer::SERVICE_UNKNOWN_SOUND, $this->service_unknown_sound); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::PING_SYNTAX)) $criteria->add(NagiosCgiConfigurationPeer::PING_SYNTAX, $this->ping_syntax); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::ESCAPE_HTML_TAGS)) $criteria->add(NagiosCgiConfigurationPeer::ESCAPE_HTML_TAGS, $this->escape_html_tags); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::NOTES_URL_TARGET)) $criteria->add(NagiosCgiConfigurationPeer::NOTES_URL_TARGET, $this->notes_url_target); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::ACTION_URL_TARGET)) $criteria->add(NagiosCgiConfigurationPeer::ACTION_URL_TARGET, $this->action_url_target); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::ENABLE_SPLUNK_INTEGRATION)) $criteria->add(NagiosCgiConfigurationPeer::ENABLE_SPLUNK_INTEGRATION, $this->enable_splunk_integration); + if ($this->isColumnModified(NagiosCgiConfigurationPeer::SPLUNK_URL)) $criteria->add(NagiosCgiConfigurationPeer::SPLUNK_URL, $this->splunk_url); + + 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(NagiosCgiConfigurationPeer::DATABASE_NAME); + + $criteria->add(NagiosCgiConfigurationPeer::ID, $this->id); + + 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 NagiosCgiConfiguration (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) + { + + $copyObj->setPhysicalHtmlPath($this->physical_html_path); + + $copyObj->setUrlHtmlPath($this->url_html_path); + + $copyObj->setUseAuthentication($this->use_authentication); + + $copyObj->setDefaultUserName($this->default_user_name); + + $copyObj->setAuthorizedForSystemInformation($this->authorized_for_system_information); + + $copyObj->setAuthorizedForSystemCommands($this->authorized_for_system_commands); + + $copyObj->setAuthorizedForConfigurationInformation($this->authorized_for_configuration_information); + + $copyObj->setAuthorizedForAllHosts($this->authorized_for_all_hosts); + + $copyObj->setAuthorizedForAllHostCommands($this->authorized_for_all_host_commands); + + $copyObj->setAuthorizedForAllServices($this->authorized_for_all_services); + + $copyObj->setAuthorizedForAllServiceCommands($this->authorized_for_all_service_commands); + + $copyObj->setLockAuthorNames($this->lock_author_names); + + $copyObj->setStatusmapBackgroundImage($this->statusmap_background_image); + + $copyObj->setDefaultStatusmapLayout($this->default_statusmap_layout); + + $copyObj->setStatuswrlInclude($this->statuswrl_include); + + $copyObj->setDefaultStatuswrlLayout($this->default_statuswrl_layout); + + $copyObj->setRefreshRate($this->refresh_rate); + + $copyObj->setHostUnreachableSound($this->host_unreachable_sound); + + $copyObj->setHostDownSound($this->host_down_sound); + + $copyObj->setServiceCriticalSound($this->service_critical_sound); + + $copyObj->setServiceWarningSound($this->service_warning_sound); + + $copyObj->setServiceUnknownSound($this->service_unknown_sound); + + $copyObj->setPingSyntax($this->ping_syntax); + + $copyObj->setEscapeHtmlTags($this->escape_html_tags); + + $copyObj->setNotesUrlTarget($this->notes_url_target); + + $copyObj->setActionUrlTarget($this->action_url_target); + + $copyObj->setEnableSplunkIntegration($this->enable_splunk_integration); + + $copyObj->setSplunkUrl($this->splunk_url); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosCgiConfiguration 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); + $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 NagiosCgiConfigurationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosCgiConfigurationPeer(); + } + return self::$peer; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + +} // BaseNagiosCgiConfiguration diff --git a/classes/om/BaseNagiosCgiConfigurationPeer.php b/classes/om/BaseNagiosCgiConfigurationPeer.php new file mode 100755 index 0000000..491d4f5 --- /dev/null +++ b/classes/om/BaseNagiosCgiConfigurationPeer.php @@ -0,0 +1,822 @@ + array ('Id', 'PhysicalHtmlPath', 'UrlHtmlPath', 'UseAuthentication', 'DefaultUserName', 'AuthorizedForSystemInformation', 'AuthorizedForSystemCommands', 'AuthorizedForConfigurationInformation', 'AuthorizedForAllHosts', 'AuthorizedForAllHostCommands', 'AuthorizedForAllServices', 'AuthorizedForAllServiceCommands', 'LockAuthorNames', 'StatusmapBackgroundImage', 'DefaultStatusmapLayout', 'StatuswrlInclude', 'DefaultStatuswrlLayout', 'RefreshRate', 'HostUnreachableSound', 'HostDownSound', 'ServiceCriticalSound', 'ServiceWarningSound', 'ServiceUnknownSound', 'PingSyntax', 'EscapeHtmlTags', 'NotesUrlTarget', 'ActionUrlTarget', 'EnableSplunkIntegration', 'SplunkUrl', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'physicalHtmlPath', 'urlHtmlPath', 'useAuthentication', 'defaultUserName', 'authorizedForSystemInformation', 'authorizedForSystemCommands', 'authorizedForConfigurationInformation', 'authorizedForAllHosts', 'authorizedForAllHostCommands', 'authorizedForAllServices', 'authorizedForAllServiceCommands', 'lockAuthorNames', 'statusmapBackgroundImage', 'defaultStatusmapLayout', 'statuswrlInclude', 'defaultStatuswrlLayout', 'refreshRate', 'hostUnreachableSound', 'hostDownSound', 'serviceCriticalSound', 'serviceWarningSound', 'serviceUnknownSound', 'pingSyntax', 'escapeHtmlTags', 'notesUrlTarget', 'actionUrlTarget', 'enableSplunkIntegration', 'splunkUrl', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::PHYSICAL_HTML_PATH, self::URL_HTML_PATH, self::USE_AUTHENTICATION, self::DEFAULT_USER_NAME, self::AUTHORIZED_FOR_SYSTEM_INFORMATION, self::AUTHORIZED_FOR_SYSTEM_COMMANDS, self::AUTHORIZED_FOR_CONFIGURATION_INFORMATION, self::AUTHORIZED_FOR_ALL_HOSTS, self::AUTHORIZED_FOR_ALL_HOST_COMMANDS, self::AUTHORIZED_FOR_ALL_SERVICES, self::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS, self::LOCK_AUTHOR_NAMES, self::STATUSMAP_BACKGROUND_IMAGE, self::DEFAULT_STATUSMAP_LAYOUT, self::STATUSWRL_INCLUDE, self::DEFAULT_STATUSWRL_LAYOUT, self::REFRESH_RATE, self::HOST_UNREACHABLE_SOUND, self::HOST_DOWN_SOUND, self::SERVICE_CRITICAL_SOUND, self::SERVICE_WARNING_SOUND, self::SERVICE_UNKNOWN_SOUND, self::PING_SYNTAX, self::ESCAPE_HTML_TAGS, self::NOTES_URL_TARGET, self::ACTION_URL_TARGET, self::ENABLE_SPLUNK_INTEGRATION, self::SPLUNK_URL, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'physical_html_path', 'url_html_path', 'use_authentication', 'default_user_name', 'authorized_for_system_information', 'authorized_for_system_commands', 'authorized_for_configuration_information', 'authorized_for_all_hosts', 'authorized_for_all_host_commands', 'authorized_for_all_services', 'authorized_for_all_service_commands', 'lock_author_names', 'statusmap_background_image', 'default_statusmap_layout', 'statuswrl_include', 'default_statuswrl_layout', 'refresh_rate', 'host_unreachable_sound', 'host_down_sound', 'service_critical_sound', 'service_warning_sound', 'service_unknown_sound', 'ping_syntax', 'escape_html_tags', 'notes_url_target', 'action_url_target', 'enable_splunk_integration', 'splunk_url', ), + 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, 23, 24, 25, 26, 27, 28, ) + ); + + /** + * 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, 'PhysicalHtmlPath' => 1, 'UrlHtmlPath' => 2, 'UseAuthentication' => 3, 'DefaultUserName' => 4, 'AuthorizedForSystemInformation' => 5, 'AuthorizedForSystemCommands' => 6, 'AuthorizedForConfigurationInformation' => 7, 'AuthorizedForAllHosts' => 8, 'AuthorizedForAllHostCommands' => 9, 'AuthorizedForAllServices' => 10, 'AuthorizedForAllServiceCommands' => 11, 'LockAuthorNames' => 12, 'StatusmapBackgroundImage' => 13, 'DefaultStatusmapLayout' => 14, 'StatuswrlInclude' => 15, 'DefaultStatuswrlLayout' => 16, 'RefreshRate' => 17, 'HostUnreachableSound' => 18, 'HostDownSound' => 19, 'ServiceCriticalSound' => 20, 'ServiceWarningSound' => 21, 'ServiceUnknownSound' => 22, 'PingSyntax' => 23, 'EscapeHtmlTags' => 24, 'NotesUrlTarget' => 25, 'ActionUrlTarget' => 26, 'EnableSplunkIntegration' => 27, 'SplunkUrl' => 28, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'physicalHtmlPath' => 1, 'urlHtmlPath' => 2, 'useAuthentication' => 3, 'defaultUserName' => 4, 'authorizedForSystemInformation' => 5, 'authorizedForSystemCommands' => 6, 'authorizedForConfigurationInformation' => 7, 'authorizedForAllHosts' => 8, 'authorizedForAllHostCommands' => 9, 'authorizedForAllServices' => 10, 'authorizedForAllServiceCommands' => 11, 'lockAuthorNames' => 12, 'statusmapBackgroundImage' => 13, 'defaultStatusmapLayout' => 14, 'statuswrlInclude' => 15, 'defaultStatuswrlLayout' => 16, 'refreshRate' => 17, 'hostUnreachableSound' => 18, 'hostDownSound' => 19, 'serviceCriticalSound' => 20, 'serviceWarningSound' => 21, 'serviceUnknownSound' => 22, 'pingSyntax' => 23, 'escapeHtmlTags' => 24, 'notesUrlTarget' => 25, 'actionUrlTarget' => 26, 'enableSplunkIntegration' => 27, 'splunkUrl' => 28, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PHYSICAL_HTML_PATH => 1, self::URL_HTML_PATH => 2, self::USE_AUTHENTICATION => 3, self::DEFAULT_USER_NAME => 4, self::AUTHORIZED_FOR_SYSTEM_INFORMATION => 5, self::AUTHORIZED_FOR_SYSTEM_COMMANDS => 6, self::AUTHORIZED_FOR_CONFIGURATION_INFORMATION => 7, self::AUTHORIZED_FOR_ALL_HOSTS => 8, self::AUTHORIZED_FOR_ALL_HOST_COMMANDS => 9, self::AUTHORIZED_FOR_ALL_SERVICES => 10, self::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS => 11, self::LOCK_AUTHOR_NAMES => 12, self::STATUSMAP_BACKGROUND_IMAGE => 13, self::DEFAULT_STATUSMAP_LAYOUT => 14, self::STATUSWRL_INCLUDE => 15, self::DEFAULT_STATUSWRL_LAYOUT => 16, self::REFRESH_RATE => 17, self::HOST_UNREACHABLE_SOUND => 18, self::HOST_DOWN_SOUND => 19, self::SERVICE_CRITICAL_SOUND => 20, self::SERVICE_WARNING_SOUND => 21, self::SERVICE_UNKNOWN_SOUND => 22, self::PING_SYNTAX => 23, self::ESCAPE_HTML_TAGS => 24, self::NOTES_URL_TARGET => 25, self::ACTION_URL_TARGET => 26, self::ENABLE_SPLUNK_INTEGRATION => 27, self::SPLUNK_URL => 28, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'physical_html_path' => 1, 'url_html_path' => 2, 'use_authentication' => 3, 'default_user_name' => 4, 'authorized_for_system_information' => 5, 'authorized_for_system_commands' => 6, 'authorized_for_configuration_information' => 7, 'authorized_for_all_hosts' => 8, 'authorized_for_all_host_commands' => 9, 'authorized_for_all_services' => 10, 'authorized_for_all_service_commands' => 11, 'lock_author_names' => 12, 'statusmap_background_image' => 13, 'default_statusmap_layout' => 14, 'statuswrl_include' => 15, 'default_statuswrl_layout' => 16, 'refresh_rate' => 17, 'host_unreachable_sound' => 18, 'host_down_sound' => 19, 'service_critical_sound' => 20, 'service_warning_sound' => 21, 'service_unknown_sound' => 22, 'ping_syntax' => 23, 'escape_html_tags' => 24, 'notes_url_target' => 25, 'action_url_target' => 26, 'enable_splunk_integration' => 27, 'splunk_url' => 28, ), + 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, 23, 24, 25, 26, 27, 28, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosCgiConfigurationMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosCgiConfigurationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosCgiConfigurationPeer::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) + { + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::ID); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::PHYSICAL_HTML_PATH); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::URL_HTML_PATH); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::USE_AUTHENTICATION); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::DEFAULT_USER_NAME); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_INFORMATION); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_SYSTEM_COMMANDS); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_CONFIGURATION_INFORMATION); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOSTS); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_HOST_COMMANDS); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICES); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::AUTHORIZED_FOR_ALL_SERVICE_COMMANDS); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::LOCK_AUTHOR_NAMES); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::STATUSMAP_BACKGROUND_IMAGE); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::DEFAULT_STATUSMAP_LAYOUT); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::STATUSWRL_INCLUDE); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::DEFAULT_STATUSWRL_LAYOUT); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::REFRESH_RATE); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::HOST_UNREACHABLE_SOUND); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::HOST_DOWN_SOUND); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::SERVICE_CRITICAL_SOUND); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::SERVICE_WARNING_SOUND); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::SERVICE_UNKNOWN_SOUND); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::PING_SYNTAX); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::ESCAPE_HTML_TAGS); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::NOTES_URL_TARGET); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::ACTION_URL_TARGET); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::ENABLE_SPLUNK_INTEGRATION); + + $criteria->addSelectColumn(NagiosCgiConfigurationPeer::SPLUNK_URL); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosCgiConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosCgiConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosCgiConfiguration + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosCgiConfigurationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosCgiConfigurationPeer::populateObjects(NagiosCgiConfigurationPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosCgiConfigurationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosCgiConfiguration $value A NagiosCgiConfiguration object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosCgiConfiguration $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosCgiConfiguration object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosCgiConfiguration) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosCgiConfiguration object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosCgiConfiguration Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosCgiConfigurationPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosCgiConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosCgiConfigurationPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosCgiConfigurationPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosCgiConfigurationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosCgiConfiguration or Criteria object. + * + * @param mixed $values Criteria or NagiosCgiConfiguration object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosCgiConfiguration object + } + + if ($criteria->containsKey(NagiosCgiConfigurationPeer::ID) && $criteria->keyContainsValue(NagiosCgiConfigurationPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosCgiConfigurationPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosCgiConfiguration or Criteria object. + * + * @param mixed $values Criteria or NagiosCgiConfiguration object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosCgiConfigurationPeer::ID); + $selectCriteria->add(NagiosCgiConfigurationPeer::ID, $criteria->remove(NagiosCgiConfigurationPeer::ID), $comparison); + + } else { // $values is NagiosCgiConfiguration object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_cgi_configuration 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(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosCgiConfigurationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosCgiConfiguration or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosCgiConfiguration object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosCgiConfigurationPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosCgiConfiguration) { + // invalidate the cache for this single object + NagiosCgiConfigurationPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosCgiConfigurationPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosCgiConfigurationPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosCgiConfiguration 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 NagiosCgiConfiguration $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(NagiosCgiConfiguration $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosCgiConfigurationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosCgiConfigurationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosCgiConfigurationPeer::DATABASE_NAME, NagiosCgiConfigurationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosCgiConfiguration + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosCgiConfigurationPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosCgiConfigurationPeer::DATABASE_NAME); + $criteria->add(NagiosCgiConfigurationPeer::ID, $pk); + + $v = NagiosCgiConfigurationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCgiConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosCgiConfigurationPeer::DATABASE_NAME); + $criteria->add(NagiosCgiConfigurationPeer::ID, $pks, Criteria::IN); + $objs = NagiosCgiConfigurationPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosCgiConfigurationPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosCgiConfigurationPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosCgiConfigurationPeer class: +// +// Propel::getDatabaseMap(NagiosCgiConfigurationPeer::DATABASE_NAME)->addTableBuilder(NagiosCgiConfigurationPeer::TABLE_NAME, NagiosCgiConfigurationPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosCgiConfigurationPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosCgiConfigurationPeer::TABLE_NAME, BaseNagiosCgiConfigurationPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosCommand.php b/classes/om/BaseNagiosCommand.php new file mode 100755 index 0000000..9cf4e24 --- /dev/null +++ b/classes/om/BaseNagiosCommand.php @@ -0,0 +1,5170 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [line] column value. + * + * @return string + */ + public function getLine() + { + return $this->line; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosCommand The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosCommandPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosCommand The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosCommandPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [line] column. + * + * @param string $v new value + * @return NagiosCommand The current object (for fluent API support) + */ + public function setLine($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->line !== $v) { + $this->line = $v; + $this->modifiedColumns[] = NagiosCommandPeer::LINE; + } + + return $this; + } // setLine() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return NagiosCommand The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = NagiosCommandPeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->line = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosCommand object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosCommandPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collNagiosContactNotificationCommands = null; + $this->lastNagiosContactNotificationCommandCriteria = null; + + $this->collNagiosHostTemplatesRelatedByCheckCommand = null; + $this->lastNagiosHostTemplateRelatedByCheckCommandCriteria = null; + + $this->collNagiosHostTemplatesRelatedByEventHandler = null; + $this->lastNagiosHostTemplateRelatedByEventHandlerCriteria = null; + + $this->collNagiosHostsRelatedByCheckCommand = null; + $this->lastNagiosHostRelatedByCheckCommandCriteria = null; + + $this->collNagiosHostsRelatedByEventHandler = null; + $this->lastNagiosHostRelatedByEventHandlerCriteria = null; + + $this->collNagiosServiceTemplatesRelatedByCheckCommand = null; + $this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria = null; + + $this->collNagiosServiceTemplatesRelatedByEventHandler = null; + $this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria = null; + + $this->collNagiosServicesRelatedByCheckCommand = null; + $this->lastNagiosServiceRelatedByCheckCommandCriteria = null; + + $this->collNagiosServicesRelatedByEventHandler = null; + $this->lastNagiosServiceRelatedByEventHandlerCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByOcspCommand = null; + $this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByOchpCommand = null; + $this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = null; + $this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = null; + $this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = null; + $this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = null; + $this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = null; + $this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria = null; + + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = null; + $this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosCommandPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosCommandPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosCommandPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosCommandPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosCommandPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosContactNotificationCommands !== null) { + foreach ($this->collNagiosContactNotificationCommands as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByEventHandler !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostsRelatedByCheckCommand !== null) { + foreach ($this->collNagiosHostsRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostsRelatedByEventHandler !== null) { + foreach ($this->collNagiosHostsRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServicesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosServicesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServicesRelatedByEventHandler !== null) { + foreach ($this->collNagiosServicesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByOcspCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByOchpCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosCommandPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosContactNotificationCommands !== null) { + foreach ($this->collNagiosContactNotificationCommands as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByEventHandler !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostsRelatedByCheckCommand !== null) { + foreach ($this->collNagiosHostsRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostsRelatedByEventHandler !== null) { + foreach ($this->collNagiosHostsRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServicesRelatedByCheckCommand !== null) { + foreach ($this->collNagiosServicesRelatedByCheckCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServicesRelatedByEventHandler !== null) { + foreach ($this->collNagiosServicesRelatedByEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByOcspCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByOchpCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler !== null) { + foreach ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosCommandPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getLine(); + break; + case 3: + return $this->getDescription(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosCommandPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getLine(), + $keys[3] => $this->getDescription(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosCommandPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setLine($value); + break; + case 3: + $this->setDescription($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosCommandPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setLine($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDescription($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(NagiosCommandPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosCommandPeer::ID)) $criteria->add(NagiosCommandPeer::ID, $this->id); + if ($this->isColumnModified(NagiosCommandPeer::NAME)) $criteria->add(NagiosCommandPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosCommandPeer::LINE)) $criteria->add(NagiosCommandPeer::LINE, $this->line); + if ($this->isColumnModified(NagiosCommandPeer::DESCRIPTION)) $criteria->add(NagiosCommandPeer::DESCRIPTION, $this->description); + + 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(NagiosCommandPeer::DATABASE_NAME); + + $criteria->add(NagiosCommandPeer::ID, $this->id); + + 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 NagiosCommand (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) + { + + $copyObj->setName($this->name); + + $copyObj->setLine($this->line); + + $copyObj->setDescription($this->description); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosContactNotificationCommands() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactNotificationCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplatesRelatedByCheckCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateRelatedByCheckCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplatesRelatedByEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateRelatedByEventHandler($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostsRelatedByCheckCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostRelatedByCheckCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostsRelatedByEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostRelatedByEventHandler($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplatesRelatedByCheckCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateRelatedByCheckCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplatesRelatedByEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateRelatedByEventHandler($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServicesRelatedByCheckCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceRelatedByCheckCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServicesRelatedByEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceRelatedByEventHandler($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByOcspCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByOcspCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByOchpCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByOchpCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByHostPerfdataCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByHostPerfdataCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByServicePerfdataCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByServicePerfdataCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByGlobalServiceEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByGlobalServiceEventHandler($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosMainConfigurationsRelatedByGlobalHostEventHandler() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosMainConfigurationRelatedByGlobalHostEventHandler($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosCommand 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); + $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 NagiosCommandPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosCommandPeer(); + } + return self::$peer; + } + + /** + * Clears out the collNagiosContactNotificationCommands collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactNotificationCommands() + */ + public function clearNagiosContactNotificationCommands() + { + $this->collNagiosContactNotificationCommands = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactNotificationCommands collection (array). + * + * By default this just sets the collNagiosContactNotificationCommands collection to an empty array (like clearcollNagiosContactNotificationCommands()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactNotificationCommands() + { + $this->collNagiosContactNotificationCommands = array(); + } + + /** + * Gets an array of NagiosContactNotificationCommand objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosContactNotificationCommands from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContactNotificationCommand[] + * @throws PropelException + */ + public function getNagiosContactNotificationCommands($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $this->collNagiosContactNotificationCommands = array(); + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::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. + + + $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactNotificationCommandCriteria = $criteria; + return $this->collNagiosContactNotificationCommands; + } + + /** + * Returns the number of related NagiosContactNotificationCommand objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContactNotificationCommand objects. + * @throws PropelException + */ + public function countNagiosContactNotificationCommands(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + $count = NagiosContactNotificationCommandPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $count = NagiosContactNotificationCommandPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactNotificationCommands); + } + } else { + $count = count($this->collNagiosContactNotificationCommands); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContactNotificationCommand object to this object + * through the NagiosContactNotificationCommand foreign key attribute. + * + * @param NagiosContactNotificationCommand $l NagiosContactNotificationCommand + * @return void + * @throws PropelException + */ + public function addNagiosContactNotificationCommand(NagiosContactNotificationCommand $l) + { + if ($this->collNagiosContactNotificationCommands === null) { + $this->initNagiosContactNotificationCommands(); + } + if (!in_array($l, $this->collNagiosContactNotificationCommands, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactNotificationCommands, $l); + $l->setNagiosCommand($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosContactNotificationCommands 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 NagiosCommand. + */ + public function getNagiosContactNotificationCommandsJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $this->collNagiosContactNotificationCommands = array(); + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosContactNotificationCommandPeer::COMMAND, $this->id); + + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosContactNotificationCommandCriteria = $criteria; + + return $this->collNagiosContactNotificationCommands; + } + + /** + * Clears out the collNagiosHostTemplatesRelatedByCheckCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplatesRelatedByCheckCommand() + */ + public function clearNagiosHostTemplatesRelatedByCheckCommand() + { + $this->collNagiosHostTemplatesRelatedByCheckCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplatesRelatedByCheckCommand collection (array). + * + * By default this just sets the collNagiosHostTemplatesRelatedByCheckCommand collection to an empty array (like clearcollNagiosHostTemplatesRelatedByCheckCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplatesRelatedByCheckCommand() + { + $this->collNagiosHostTemplatesRelatedByCheckCommand = array(); + } + + /** + * Gets an array of NagiosHostTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosHostTemplatesRelatedByCheckCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplate[] + * @throws PropelException + */ + public function getNagiosHostTemplatesRelatedByCheckCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::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. + + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateRelatedByCheckCommandCriteria = $criteria; + return $this->collNagiosHostTemplatesRelatedByCheckCommand; + } + + /** + * Returns the number of related NagiosHostTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplate objects. + * @throws PropelException + */ + public function countNagiosHostTemplatesRelatedByCheckCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + $count = NagiosHostTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $count = NagiosHostTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplatesRelatedByCheckCommand); + } + } else { + $count = count($this->collNagiosHostTemplatesRelatedByCheckCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplate object to this object + * through the NagiosHostTemplate foreign key attribute. + * + * @param NagiosHostTemplate $l NagiosHostTemplate + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateRelatedByCheckCommand(NagiosHostTemplate $l) + { + if ($this->collNagiosHostTemplatesRelatedByCheckCommand === null) { + $this->initNagiosHostTemplatesRelatedByCheckCommand(); + } + if (!in_array($l, $this->collNagiosHostTemplatesRelatedByCheckCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplatesRelatedByCheckCommand, $l); + $l->setNagiosCommandRelatedByCheckCommand($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosHostTemplatesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosHostTemplatesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckCommand = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByCheckCommand; + } + + /** + * Clears out the collNagiosHostTemplatesRelatedByEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplatesRelatedByEventHandler() + */ + public function clearNagiosHostTemplatesRelatedByEventHandler() + { + $this->collNagiosHostTemplatesRelatedByEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplatesRelatedByEventHandler collection (array). + * + * By default this just sets the collNagiosHostTemplatesRelatedByEventHandler collection to an empty array (like clearcollNagiosHostTemplatesRelatedByEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplatesRelatedByEventHandler() + { + $this->collNagiosHostTemplatesRelatedByEventHandler = array(); + } + + /** + * Gets an array of NagiosHostTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosHostTemplatesRelatedByEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplate[] + * @throws PropelException + */ + public function getNagiosHostTemplatesRelatedByEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::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. + + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosHostTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateRelatedByEventHandlerCriteria = $criteria; + return $this->collNagiosHostTemplatesRelatedByEventHandler; + } + + /** + * Returns the number of related NagiosHostTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplate objects. + * @throws PropelException + */ + public function countNagiosHostTemplatesRelatedByEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + $count = NagiosHostTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosHostTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $count = NagiosHostTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplatesRelatedByEventHandler); + } + } else { + $count = count($this->collNagiosHostTemplatesRelatedByEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplate object to this object + * through the NagiosHostTemplate foreign key attribute. + * + * @param NagiosHostTemplate $l NagiosHostTemplate + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateRelatedByEventHandler(NagiosHostTemplate $l) + { + if ($this->collNagiosHostTemplatesRelatedByEventHandler === null) { + $this->initNagiosHostTemplatesRelatedByEventHandler(); + } + if (!in_array($l, $this->collNagiosHostTemplatesRelatedByEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplatesRelatedByEventHandler, $l); + $l->setNagiosCommandRelatedByEventHandler($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosHostTemplatesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosHostTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosHostTemplatesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosHostTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByEventHandler = NagiosHostTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByEventHandler; + } + + /** + * Clears out the collNagiosHostsRelatedByCheckCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostsRelatedByCheckCommand() + */ + public function clearNagiosHostsRelatedByCheckCommand() + { + $this->collNagiosHostsRelatedByCheckCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostsRelatedByCheckCommand collection (array). + * + * By default this just sets the collNagiosHostsRelatedByCheckCommand collection to an empty array (like clearcollNagiosHostsRelatedByCheckCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostsRelatedByCheckCommand() + { + $this->collNagiosHostsRelatedByCheckCommand = array(); + } + + /** + * Gets an array of NagiosHost objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosHostsRelatedByCheckCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHost[] + * @throws PropelException + */ + public function getNagiosHostsRelatedByCheckCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::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. + + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostRelatedByCheckCommandCriteria) || !$this->lastNagiosHostRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostRelatedByCheckCommandCriteria = $criteria; + return $this->collNagiosHostsRelatedByCheckCommand; + } + + /** + * Returns the number of related NagiosHost objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHost objects. + * @throws PropelException + */ + public function countNagiosHostsRelatedByCheckCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostsRelatedByCheckCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + $count = NagiosHostPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckCommandCriteria) || !$this->lastNagiosHostRelatedByCheckCommandCriteria->equals($criteria)) { + $count = NagiosHostPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostsRelatedByCheckCommand); + } + } else { + $count = count($this->collNagiosHostsRelatedByCheckCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHost object to this object + * through the NagiosHost foreign key attribute. + * + * @param NagiosHost $l NagiosHost + * @return void + * @throws PropelException + */ + public function addNagiosHostRelatedByCheckCommand(NagiosHost $l) + { + if ($this->collNagiosHostsRelatedByCheckCommand === null) { + $this->initNagiosHostsRelatedByCheckCommand(); + } + if (!in_array($l, $this->collNagiosHostsRelatedByCheckCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostsRelatedByCheckCommand, $l); + $l->setNagiosCommandRelatedByCheckCommand($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostsRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosHostsRelatedByCheckCommandJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckCommandCriteria) || !$this->lastNagiosHostRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosHostsRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostsRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosHostsRelatedByCheckCommandJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->id); + + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckCommandCriteria) || !$this->lastNagiosHostRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckCommand = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosHostsRelatedByCheckCommand; + } + + /** + * Clears out the collNagiosHostsRelatedByEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostsRelatedByEventHandler() + */ + public function clearNagiosHostsRelatedByEventHandler() + { + $this->collNagiosHostsRelatedByEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostsRelatedByEventHandler collection (array). + * + * By default this just sets the collNagiosHostsRelatedByEventHandler collection to an empty array (like clearcollNagiosHostsRelatedByEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostsRelatedByEventHandler() + { + $this->collNagiosHostsRelatedByEventHandler = array(); + } + + /** + * Gets an array of NagiosHost objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosHostsRelatedByEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHost[] + * @throws PropelException + */ + public function getNagiosHostsRelatedByEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::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. + + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostRelatedByEventHandlerCriteria) || !$this->lastNagiosHostRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostRelatedByEventHandlerCriteria = $criteria; + return $this->collNagiosHostsRelatedByEventHandler; + } + + /** + * Returns the number of related NagiosHost objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHost objects. + * @throws PropelException + */ + public function countNagiosHostsRelatedByEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostsRelatedByEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + $count = NagiosHostPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostRelatedByEventHandlerCriteria) || !$this->lastNagiosHostRelatedByEventHandlerCriteria->equals($criteria)) { + $count = NagiosHostPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostsRelatedByEventHandler); + } + } else { + $count = count($this->collNagiosHostsRelatedByEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHost object to this object + * through the NagiosHost foreign key attribute. + * + * @param NagiosHost $l NagiosHost + * @return void + * @throws PropelException + */ + public function addNagiosHostRelatedByEventHandler(NagiosHost $l) + { + if ($this->collNagiosHostsRelatedByEventHandler === null) { + $this->initNagiosHostsRelatedByEventHandler(); + } + if (!in_array($l, $this->collNagiosHostsRelatedByEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostsRelatedByEventHandler, $l); + $l->setNagiosCommandRelatedByEventHandler($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostsRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosHostsRelatedByEventHandlerJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostRelatedByEventHandlerCriteria) || !$this->lastNagiosHostRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosHostsRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosHostsRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosHostsRelatedByEventHandlerJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->id); + + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosHostRelatedByEventHandlerCriteria) || !$this->lastNagiosHostRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByEventHandler = NagiosHostPeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosHostsRelatedByEventHandler; + } + + /** + * Clears out the collNagiosServiceTemplatesRelatedByCheckCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplatesRelatedByCheckCommand() + */ + public function clearNagiosServiceTemplatesRelatedByCheckCommand() + { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplatesRelatedByCheckCommand collection (array). + * + * By default this just sets the collNagiosServiceTemplatesRelatedByCheckCommand collection to an empty array (like clearcollNagiosServiceTemplatesRelatedByCheckCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplatesRelatedByCheckCommand() + { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = array(); + } + + /** + * Gets an array of NagiosServiceTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosServiceTemplatesRelatedByCheckCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplate[] + * @throws PropelException + */ + public function getNagiosServiceTemplatesRelatedByCheckCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::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. + + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria = $criteria; + return $this->collNagiosServiceTemplatesRelatedByCheckCommand; + } + + /** + * Returns the number of related NagiosServiceTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplate objects. + * @throws PropelException + */ + public function countNagiosServiceTemplatesRelatedByCheckCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + $count = NagiosServiceTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $count = NagiosServiceTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByCheckCommand); + } + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByCheckCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplate object to this object + * through the NagiosServiceTemplate foreign key attribute. + * + * @param NagiosServiceTemplate $l NagiosServiceTemplate + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateRelatedByCheckCommand(NagiosServiceTemplate $l) + { + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand === null) { + $this->initNagiosServiceTemplatesRelatedByCheckCommand(); + } + if (!in_array($l, $this->collNagiosServiceTemplatesRelatedByCheckCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplatesRelatedByCheckCommand, $l); + $l->setNagiosCommandRelatedByCheckCommand($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServiceTemplatesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServiceTemplatesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckCommand = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByCheckCommand; + } + + /** + * Clears out the collNagiosServiceTemplatesRelatedByEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplatesRelatedByEventHandler() + */ + public function clearNagiosServiceTemplatesRelatedByEventHandler() + { + $this->collNagiosServiceTemplatesRelatedByEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplatesRelatedByEventHandler collection (array). + * + * By default this just sets the collNagiosServiceTemplatesRelatedByEventHandler collection to an empty array (like clearcollNagiosServiceTemplatesRelatedByEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplatesRelatedByEventHandler() + { + $this->collNagiosServiceTemplatesRelatedByEventHandler = array(); + } + + /** + * Gets an array of NagiosServiceTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosServiceTemplatesRelatedByEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplate[] + * @throws PropelException + */ + public function getNagiosServiceTemplatesRelatedByEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::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. + + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria = $criteria; + return $this->collNagiosServiceTemplatesRelatedByEventHandler; + } + + /** + * Returns the number of related NagiosServiceTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplate objects. + * @throws PropelException + */ + public function countNagiosServiceTemplatesRelatedByEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + $count = NagiosServiceTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $count = NagiosServiceTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByEventHandler); + } + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplate object to this object + * through the NagiosServiceTemplate foreign key attribute. + * + * @param NagiosServiceTemplate $l NagiosServiceTemplate + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateRelatedByEventHandler(NagiosServiceTemplate $l) + { + if ($this->collNagiosServiceTemplatesRelatedByEventHandler === null) { + $this->initNagiosServiceTemplatesRelatedByEventHandler(); + } + if (!in_array($l, $this->collNagiosServiceTemplatesRelatedByEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplatesRelatedByEventHandler, $l); + $l->setNagiosCommandRelatedByEventHandler($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServiceTemplatesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServiceTemplatesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByEventHandler = NagiosServiceTemplatePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByEventHandler; + } + + /** + * Clears out the collNagiosServicesRelatedByCheckCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServicesRelatedByCheckCommand() + */ + public function clearNagiosServicesRelatedByCheckCommand() + { + $this->collNagiosServicesRelatedByCheckCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServicesRelatedByCheckCommand collection (array). + * + * By default this just sets the collNagiosServicesRelatedByCheckCommand collection to an empty array (like clearcollNagiosServicesRelatedByCheckCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServicesRelatedByCheckCommand() + { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosServicesRelatedByCheckCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServicesRelatedByCheckCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + return $this->collNagiosServicesRelatedByCheckCommand; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServicesRelatedByCheckCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServicesRelatedByCheckCommand); + } + } else { + $count = count($this->collNagiosServicesRelatedByCheckCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosServiceRelatedByCheckCommand(NagiosService $l) + { + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + $this->initNagiosServicesRelatedByCheckCommand(); + } + if (!in_array($l, $this->collNagiosServicesRelatedByCheckCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServicesRelatedByCheckCommand, $l); + $l->setNagiosCommandRelatedByCheckCommand($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByCheckCommandJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByCheckCommandJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByCheckCommandJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckCommand; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckCommand 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByCheckCommandJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckCommand === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckCommand = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->id); + + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_COMMAND, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckCommandCriteria) || !$this->lastNagiosServiceRelatedByCheckCommandCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckCommand = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckCommandCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckCommand; + } + + /** + * Clears out the collNagiosServicesRelatedByEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServicesRelatedByEventHandler() + */ + public function clearNagiosServicesRelatedByEventHandler() + { + $this->collNagiosServicesRelatedByEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServicesRelatedByEventHandler collection (array). + * + * By default this just sets the collNagiosServicesRelatedByEventHandler collection to an empty array (like clearcollNagiosServicesRelatedByEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServicesRelatedByEventHandler() + { + $this->collNagiosServicesRelatedByEventHandler = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosServicesRelatedByEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServicesRelatedByEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + return $this->collNagiosServicesRelatedByEventHandler; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServicesRelatedByEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServicesRelatedByEventHandler); + } + } else { + $count = count($this->collNagiosServicesRelatedByEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosServiceRelatedByEventHandler(NagiosService $l) + { + if ($this->collNagiosServicesRelatedByEventHandler === null) { + $this->initNagiosServicesRelatedByEventHandler(); + } + if (!in_array($l, $this->collNagiosServicesRelatedByEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServicesRelatedByEventHandler, $l); + $l->setNagiosCommandRelatedByEventHandler($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByEventHandlerJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServicesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByEventHandlerJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServicesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByEventHandlerJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServicesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServicesRelatedByEventHandler; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosCommand is new, it will return + * an empty collection; or if this NagiosCommand has previously + * been saved, it will retrieve related NagiosServicesRelatedByEventHandler 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 NagiosCommand. + */ + public function getNagiosServicesRelatedByEventHandlerJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByEventHandler = array(); + } else { + + $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->id); + + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByEventHandlerCriteria) || !$this->lastNagiosServiceRelatedByEventHandlerCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByEventHandler = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByEventHandlerCriteria = $criteria; + + return $this->collNagiosServicesRelatedByEventHandler; + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByOcspCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByOcspCommand() + */ + public function clearNagiosMainConfigurationsRelatedByOcspCommand() + { + $this->collNagiosMainConfigurationsRelatedByOcspCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByOcspCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByOcspCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByOcspCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByOcspCommand() + { + $this->collNagiosMainConfigurationsRelatedByOcspCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByOcspCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByOcspCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByOcspCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByOcspCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByOcspCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByOcspCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByOcspCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByOcspCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByOcspCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByOcspCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByOcspCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand === null) { + $this->initNagiosMainConfigurationsRelatedByOcspCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByOcspCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByOcspCommand, $l); + $l->setNagiosCommandRelatedByOcspCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByOchpCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByOchpCommand() + */ + public function clearNagiosMainConfigurationsRelatedByOchpCommand() + { + $this->collNagiosMainConfigurationsRelatedByOchpCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByOchpCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByOchpCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByOchpCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByOchpCommand() + { + $this->collNagiosMainConfigurationsRelatedByOchpCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByOchpCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByOchpCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByOchpCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByOchpCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByOchpCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByOchpCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByOchpCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByOchpCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByOchpCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByOchpCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByOchpCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand === null) { + $this->initNagiosMainConfigurationsRelatedByOchpCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByOchpCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByOchpCommand, $l); + $l->setNagiosCommandRelatedByOchpCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByHostPerfdataCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByHostPerfdataCommand() + */ + public function clearNagiosMainConfigurationsRelatedByHostPerfdataCommand() + { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByHostPerfdataCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByHostPerfdataCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByHostPerfdataCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByHostPerfdataCommand() + { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByHostPerfdataCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByHostPerfdataCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByHostPerfdataCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByHostPerfdataCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByHostPerfdataCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand === null) { + $this->initNagiosMainConfigurationsRelatedByHostPerfdataCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand, $l); + $l->setNagiosCommandRelatedByHostPerfdataCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByServicePerfdataCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByServicePerfdataCommand() + */ + public function clearNagiosMainConfigurationsRelatedByServicePerfdataCommand() + { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByServicePerfdataCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByServicePerfdataCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByServicePerfdataCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByServicePerfdataCommand() + { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByServicePerfdataCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByServicePerfdataCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByServicePerfdataCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByServicePerfdataCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByServicePerfdataCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand === null) { + $this->initNagiosMainConfigurationsRelatedByServicePerfdataCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand, $l); + $l->setNagiosCommandRelatedByServicePerfdataCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand() + */ + public function clearNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand() + { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand() + { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand === null) { + $this->initNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand, $l); + $l->setNagiosCommandRelatedByHostPerfdataFileProcessingCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand() + */ + public function clearNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand() + { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand() + { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria) || !$this->lastNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommandCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommand(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand === null) { + $this->initNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand, $l); + $l->setNagiosCommandRelatedByServicePerfdataFileProcessingCommand($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByGlobalServiceEventHandler() + */ + public function clearNagiosMainConfigurationsRelatedByGlobalServiceEventHandler() + { + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByGlobalServiceEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByGlobalServiceEventHandler() + { + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByGlobalServiceEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByGlobalServiceEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria) || !$this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByGlobalServiceEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria) || !$this->lastNagiosMainConfigurationRelatedByGlobalServiceEventHandlerCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByGlobalServiceEventHandler(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler === null) { + $this->initNagiosMainConfigurationsRelatedByGlobalServiceEventHandler(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler, $l); + $l->setNagiosCommandRelatedByGlobalServiceEventHandler($this); + } + } + + /** + * Clears out the collNagiosMainConfigurationsRelatedByGlobalHostEventHandler collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosMainConfigurationsRelatedByGlobalHostEventHandler() + */ + public function clearNagiosMainConfigurationsRelatedByGlobalHostEventHandler() + { + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosMainConfigurationsRelatedByGlobalHostEventHandler collection (array). + * + * By default this just sets the collNagiosMainConfigurationsRelatedByGlobalHostEventHandler collection to an empty array (like clearcollNagiosMainConfigurationsRelatedByGlobalHostEventHandler()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosMainConfigurationsRelatedByGlobalHostEventHandler() + { + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = array(); + } + + /** + * Gets an array of NagiosMainConfiguration objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosCommand has previously been saved, it will retrieve + * related NagiosMainConfigurationsRelatedByGlobalHostEventHandler from storage. If this NagiosCommand is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosMainConfiguration[] + * @throws PropelException + */ + public function getNagiosMainConfigurationsRelatedByGlobalHostEventHandler($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler === null) { + if ($this->isNew()) { + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = array(); + } else { + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = NagiosMainConfigurationPeer::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. + + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $this->id); + + NagiosMainConfigurationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria) || !$this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria->equals($criteria)) { + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria = $criteria; + return $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler; + } + + /** + * Returns the number of related NagiosMainConfiguration objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosMainConfiguration objects. + * @throws PropelException + */ + public function countNagiosMainConfigurationsRelatedByGlobalHostEventHandler(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $this->id); + + $count = NagiosMainConfigurationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $this->id); + + if (!isset($this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria) || !$this->lastNagiosMainConfigurationRelatedByGlobalHostEventHandlerCriteria->equals($criteria)) { + $count = NagiosMainConfigurationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler); + } + } else { + $count = count($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler); + } + } + return $count; + } + + /** + * Method called to associate a NagiosMainConfiguration object to this object + * through the NagiosMainConfiguration foreign key attribute. + * + * @param NagiosMainConfiguration $l NagiosMainConfiguration + * @return void + * @throws PropelException + */ + public function addNagiosMainConfigurationRelatedByGlobalHostEventHandler(NagiosMainConfiguration $l) + { + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler === null) { + $this->initNagiosMainConfigurationsRelatedByGlobalHostEventHandler(); + } + if (!in_array($l, $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler, $l); + $l->setNagiosCommandRelatedByGlobalHostEventHandler($this); + } + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosContactNotificationCommands) { + foreach ((array) $this->collNagiosContactNotificationCommands as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplatesRelatedByCheckCommand) { + foreach ((array) $this->collNagiosHostTemplatesRelatedByCheckCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplatesRelatedByEventHandler) { + foreach ((array) $this->collNagiosHostTemplatesRelatedByEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostsRelatedByCheckCommand) { + foreach ((array) $this->collNagiosHostsRelatedByCheckCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostsRelatedByEventHandler) { + foreach ((array) $this->collNagiosHostsRelatedByEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplatesRelatedByCheckCommand) { + foreach ((array) $this->collNagiosServiceTemplatesRelatedByCheckCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplatesRelatedByEventHandler) { + foreach ((array) $this->collNagiosServiceTemplatesRelatedByEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServicesRelatedByCheckCommand) { + foreach ((array) $this->collNagiosServicesRelatedByCheckCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServicesRelatedByEventHandler) { + foreach ((array) $this->collNagiosServicesRelatedByEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByOcspCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByOcspCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByOchpCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByOchpCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler) { + foreach ((array) $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosContactNotificationCommands = null; + $this->collNagiosHostTemplatesRelatedByCheckCommand = null; + $this->collNagiosHostTemplatesRelatedByEventHandler = null; + $this->collNagiosHostsRelatedByCheckCommand = null; + $this->collNagiosHostsRelatedByEventHandler = null; + $this->collNagiosServiceTemplatesRelatedByCheckCommand = null; + $this->collNagiosServiceTemplatesRelatedByEventHandler = null; + $this->collNagiosServicesRelatedByCheckCommand = null; + $this->collNagiosServicesRelatedByEventHandler = null; + $this->collNagiosMainConfigurationsRelatedByOcspCommand = null; + $this->collNagiosMainConfigurationsRelatedByOchpCommand = null; + $this->collNagiosMainConfigurationsRelatedByHostPerfdataCommand = null; + $this->collNagiosMainConfigurationsRelatedByServicePerfdataCommand = null; + $this->collNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand = null; + $this->collNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand = null; + $this->collNagiosMainConfigurationsRelatedByGlobalServiceEventHandler = null; + $this->collNagiosMainConfigurationsRelatedByGlobalHostEventHandler = null; + } + +} // BaseNagiosCommand diff --git a/classes/om/BaseNagiosCommandPeer.php b/classes/om/BaseNagiosCommandPeer.php new file mode 100755 index 0000000..6784689 --- /dev/null +++ b/classes/om/BaseNagiosCommandPeer.php @@ -0,0 +1,928 @@ + array ('Id', 'Name', 'Line', 'Description', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'line', 'description', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::LINE, self::DESCRIPTION, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'line', 'description', ), + 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, 'Name' => 1, 'Line' => 2, 'Description' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'line' => 2, 'description' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::LINE => 2, self::DESCRIPTION => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'line' => 2, 'description' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosCommandMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosCommandPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosCommandPeer::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) + { + + $criteria->addSelectColumn(NagiosCommandPeer::ID); + + $criteria->addSelectColumn(NagiosCommandPeer::NAME); + + $criteria->addSelectColumn(NagiosCommandPeer::LINE); + + $criteria->addSelectColumn(NagiosCommandPeer::DESCRIPTION); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosCommand + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosCommandPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosCommandPeer::populateObjects(NagiosCommandPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosCommandPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosCommand $value A NagiosCommand object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosCommand $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosCommand object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosCommand) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosCommand object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosCommand Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosCommandPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosCommandPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosCommandPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosCommandPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosCommand or Criteria object. + * + * @param mixed $values Criteria or NagiosCommand object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosCommand object + } + + if ($criteria->containsKey(NagiosCommandPeer::ID) && $criteria->keyContainsValue(NagiosCommandPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosCommandPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosCommand or Criteria object. + * + * @param mixed $values Criteria or NagiosCommand object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosCommandPeer::ID); + $selectCriteria->add(NagiosCommandPeer::ID, $criteria->remove(NagiosCommandPeer::ID), $comparison); + + } else { // $values is NagiosCommand object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_command 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(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosCommandPeer::doOnDeleteCascade(new Criteria(NagiosCommandPeer::DATABASE_NAME), $con); + NagiosCommandPeer::doOnDeleteSetNull(new Criteria(NagiosCommandPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosCommandPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosCommand or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosCommand object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosCommandPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosCommand) { + // invalidate the cache for this single object + NagiosCommandPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosCommandPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosCommandPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosCommandPeer::doOnDeleteCascade($criteria, $con); + NagiosCommandPeer::doOnDeleteSetNull($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosCommandPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosCommandPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosContactNotificationCommandPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactNotificationCommandPeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosHostPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostPeer::clearInstancePool(); + + // invalidate objects in NagiosHostPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + // invalidate objects in NagiosMainConfigurationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosMainConfigurationPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosCommandPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosContactNotificationCommand objects + $c = new Criteria(NagiosContactNotificationCommandPeer::DATABASE_NAME); + + $c->add(NagiosContactNotificationCommandPeer::COMMAND, $obj->getId()); + $affectedRows += NagiosContactNotificationCommandPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + + // delete related NagiosMainConfiguration objects + $c = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + + $c->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $obj->getId()); + $affectedRows += NagiosMainConfigurationPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * This is a method for emulating ON DELETE SET NULL DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return void + */ + protected static function doOnDeleteSetNull(Criteria $criteria, PropelPDO $con) + { + + // first find the objects that are implicated by the $criteria + $objects = NagiosCommandPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + // set fkey col in related NagiosHostTemplate rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $obj->getId()); + $updateValues->add(NagiosHostTemplatePeer::CHECK_COMMAND, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHostTemplate rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $obj->getId()); + $updateValues->add(NagiosHostTemplatePeer::EVENT_HANDLER, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHost rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostPeer::CHECK_COMMAND, $obj->getId()); + $updateValues->add(NagiosHostPeer::CHECK_COMMAND, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHost rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostPeer::EVENT_HANDLER, $obj->getId()); + $updateValues->add(NagiosHostPeer::EVENT_HANDLER, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosServiceTemplate rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $obj->getId()); + $updateValues->add(NagiosServiceTemplatePeer::CHECK_COMMAND, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosServiceTemplate rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $obj->getId()); + $updateValues->add(NagiosServiceTemplatePeer::EVENT_HANDLER, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosService rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServicePeer::CHECK_COMMAND, $obj->getId()); + $updateValues->add(NagiosServicePeer::CHECK_COMMAND, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosService rows to NULL + $selectCriteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServicePeer::EVENT_HANDLER, $obj->getId()); + $updateValues->add(NagiosServicePeer::EVENT_HANDLER, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + } + } + + /** + * Validates all modified columns of given NagiosCommand 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 NagiosCommand $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(NagiosCommand $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosCommandPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosCommandPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosCommandPeer::DATABASE_NAME, NagiosCommandPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosCommand + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosCommandPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $criteria->add(NagiosCommandPeer::ID, $pk); + + $v = NagiosCommandPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $criteria->add(NagiosCommandPeer::ID, $pks, Criteria::IN); + $objs = NagiosCommandPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosCommandPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosCommandPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosCommandPeer class: +// +// Propel::getDatabaseMap(NagiosCommandPeer::DATABASE_NAME)->addTableBuilder(NagiosCommandPeer::TABLE_NAME, NagiosCommandPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosCommandPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosCommandPeer::TABLE_NAME, BaseNagiosCommandPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosContact.php b/classes/om/BaseNagiosContact.php new file mode 100755 index 0000000..6af88a6 --- /dev/null +++ b/classes/om/BaseNagiosContact.php @@ -0,0 +1,3304 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Get the [email] column value. + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Get the [pager] column value. + * + * @return string + */ + public function getPager() + { + return $this->pager; + } + + /** + * Get the [host_notifications_enabled] column value. + * + * @return boolean + */ + public function getHostNotificationsEnabled() + { + return $this->host_notifications_enabled; + } + + /** + * Get the [service_notifications_enabled] column value. + * + * @return boolean + */ + public function getServiceNotificationsEnabled() + { + return $this->service_notifications_enabled; + } + + /** + * Get the [host_notification_period] column value. + * + * @return int + */ + public function getHostNotificationPeriod() + { + return $this->host_notification_period; + } + + /** + * Get the [service_notification_period] column value. + * + * @return int + */ + public function getServiceNotificationPeriod() + { + return $this->service_notification_period; + } + + /** + * Get the [host_notification_on_down] column value. + * + * @return boolean + */ + public function getHostNotificationOnDown() + { + return $this->host_notification_on_down; + } + + /** + * Get the [host_notification_on_unreachable] column value. + * + * @return boolean + */ + public function getHostNotificationOnUnreachable() + { + return $this->host_notification_on_unreachable; + } + + /** + * Get the [host_notification_on_recovery] column value. + * + * @return boolean + */ + public function getHostNotificationOnRecovery() + { + return $this->host_notification_on_recovery; + } + + /** + * Get the [host_notification_on_flapping] column value. + * + * @return boolean + */ + public function getHostNotificationOnFlapping() + { + return $this->host_notification_on_flapping; + } + + /** + * Get the [host_notification_on_scheduled_downtime] column value. + * + * @return boolean + */ + public function getHostNotificationOnScheduledDowntime() + { + return $this->host_notification_on_scheduled_downtime; + } + + /** + * Get the [service_notification_on_warning] column value. + * + * @return boolean + */ + public function getServiceNotificationOnWarning() + { + return $this->service_notification_on_warning; + } + + /** + * Get the [service_notification_on_unknown] column value. + * + * @return boolean + */ + public function getServiceNotificationOnUnknown() + { + return $this->service_notification_on_unknown; + } + + /** + * Get the [service_notification_on_critical] column value. + * + * @return boolean + */ + public function getServiceNotificationOnCritical() + { + return $this->service_notification_on_critical; + } + + /** + * Get the [service_notification_on_recovery] column value. + * + * @return boolean + */ + public function getServiceNotificationOnRecovery() + { + return $this->service_notification_on_recovery; + } + + /** + * Get the [service_notification_on_flapping] column value. + * + * @return boolean + */ + public function getServiceNotificationOnFlapping() + { + return $this->service_notification_on_flapping; + } + + /** + * Get the [can_submit_commands] column value. + * + * @return boolean + */ + public function getCanSubmitCommands() + { + return $this->can_submit_commands; + } + + /** + * Get the [retain_status_information] column value. + * + * @return boolean + */ + public function getRetainStatusInformation() + { + return $this->retain_status_information; + } + + /** + * Get the [retain_nonstatus_information] column value. + * + * @return boolean + */ + public function getRetainNonstatusInformation() + { + return $this->retain_nonstatus_information; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosContactPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosContactPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosContactPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Set the value of [email] column. + * + * @param string $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setEmail($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->email !== $v) { + $this->email = $v; + $this->modifiedColumns[] = NagiosContactPeer::EMAIL; + } + + return $this; + } // setEmail() + + /** + * Set the value of [pager] column. + * + * @param string $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setPager($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->pager !== $v) { + $this->pager = $v; + $this->modifiedColumns[] = NagiosContactPeer::PAGER; + } + + return $this; + } // setPager() + + /** + * Set the value of [host_notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notifications_enabled !== $v) { + $this->host_notifications_enabled = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATIONS_ENABLED; + } + + return $this; + } // setHostNotificationsEnabled() + + /** + * Set the value of [service_notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notifications_enabled !== $v) { + $this->service_notifications_enabled = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATIONS_ENABLED; + } + + return $this; + } // setServiceNotificationsEnabled() + + /** + * Set the value of [host_notification_period] column. + * + * @param int $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_notification_period !== $v) { + $this->host_notification_period = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByHostNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = null; + } + + return $this; + } // setHostNotificationPeriod() + + /** + * Set the value of [service_notification_period] column. + * + * @param int $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_notification_period !== $v) { + $this->service_notification_period = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = null; + } + + return $this; + } // setServiceNotificationPeriod() + + /** + * Set the value of [host_notification_on_down] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notification_on_down !== $v) { + $this->host_notification_on_down = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_ON_DOWN; + } + + return $this; + } // setHostNotificationOnDown() + + /** + * Set the value of [host_notification_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notification_on_unreachable !== $v) { + $this->host_notification_on_unreachable = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_ON_UNREACHABLE; + } + + return $this; + } // setHostNotificationOnUnreachable() + + /** + * Set the value of [host_notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notification_on_recovery !== $v) { + $this->host_notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setHostNotificationOnRecovery() + + /** + * Set the value of [host_notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notification_on_flapping !== $v) { + $this->host_notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setHostNotificationOnFlapping() + + /** + * Set the value of [host_notification_on_scheduled_downtime] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setHostNotificationOnScheduledDowntime($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->host_notification_on_scheduled_downtime !== $v) { + $this->host_notification_on_scheduled_downtime = $v; + $this->modifiedColumns[] = NagiosContactPeer::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME; + } + + return $this; + } // setHostNotificationOnScheduledDowntime() + + /** + * Set the value of [service_notification_on_warning] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notification_on_warning !== $v) { + $this->service_notification_on_warning = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_ON_WARNING; + } + + return $this; + } // setServiceNotificationOnWarning() + + /** + * Set the value of [service_notification_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notification_on_unknown !== $v) { + $this->service_notification_on_unknown = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_ON_UNKNOWN; + } + + return $this; + } // setServiceNotificationOnUnknown() + + /** + * Set the value of [service_notification_on_critical] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notification_on_critical !== $v) { + $this->service_notification_on_critical = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_ON_CRITICAL; + } + + return $this; + } // setServiceNotificationOnCritical() + + /** + * Set the value of [service_notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notification_on_recovery !== $v) { + $this->service_notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setServiceNotificationOnRecovery() + + /** + * Set the value of [service_notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setServiceNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->service_notification_on_flapping !== $v) { + $this->service_notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosContactPeer::SERVICE_NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setServiceNotificationOnFlapping() + + /** + * Set the value of [can_submit_commands] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setCanSubmitCommands($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->can_submit_commands !== $v) { + $this->can_submit_commands = $v; + $this->modifiedColumns[] = NagiosContactPeer::CAN_SUBMIT_COMMANDS; + } + + return $this; + } // setCanSubmitCommands() + + /** + * Set the value of [retain_status_information] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setRetainStatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_status_information !== $v) { + $this->retain_status_information = $v; + $this->modifiedColumns[] = NagiosContactPeer::RETAIN_STATUS_INFORMATION; + } + + return $this; + } // setRetainStatusInformation() + + /** + * Set the value of [retain_nonstatus_information] column. + * + * @param boolean $v new value + * @return NagiosContact The current object (for fluent API support) + */ + public function setRetainNonstatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_nonstatus_information !== $v) { + $this->retain_nonstatus_information = $v; + $this->modifiedColumns[] = NagiosContactPeer::RETAIN_NONSTATUS_INFORMATION; + } + + return $this; + } // setRetainNonstatusInformation() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->email = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->pager = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->host_notifications_enabled = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null; + $this->service_notifications_enabled = ($row[$startcol + 6] !== null) ? (boolean) $row[$startcol + 6] : null; + $this->host_notification_period = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->service_notification_period = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->host_notification_on_down = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->host_notification_on_unreachable = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null; + $this->host_notification_on_recovery = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->host_notification_on_flapping = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->host_notification_on_scheduled_downtime = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->service_notification_on_warning = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->service_notification_on_unknown = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; + $this->service_notification_on_critical = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null; + $this->service_notification_on_recovery = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->service_notification_on_flapping = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; + $this->can_submit_commands = ($row[$startcol + 19] !== null) ? (boolean) $row[$startcol + 19] : null; + $this->retain_status_information = ($row[$startcol + 20] !== null) ? (boolean) $row[$startcol + 20] : null; + $this->retain_nonstatus_information = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 22; // 22 = NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosContact object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosTimeperiodRelatedByHostNotificationPeriod !== null && $this->host_notification_period !== $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = null; + } + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod !== null && $this->service_notification_period !== $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosContactPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = null; + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = null; + $this->collNagiosContactAddresss = null; + $this->lastNagiosContactAddressCriteria = null; + + $this->collNagiosContactGroupMembers = null; + $this->lastNagiosContactGroupMemberCriteria = null; + + $this->collNagiosContactNotificationCommands = null; + $this->lastNagiosContactNotificationCommandCriteria = null; + + $this->collNagiosHostContactMembers = null; + $this->lastNagiosHostContactMemberCriteria = null; + + $this->collNagiosServiceContactMembers = null; + $this->lastNagiosServiceContactMemberCriteria = null; + + $this->collNagiosEscalationContacts = null; + $this->lastNagiosEscalationContactCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosContactPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosContactPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosTimeperiodRelatedByHostNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByHostNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByHostNotificationPeriod($this->aNagiosTimeperiodRelatedByHostNotificationPeriod); + } + + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByServiceNotificationPeriod($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosContactPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosContactPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosContactPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosContactAddresss !== null) { + foreach ($this->collNagiosContactAddresss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosContactGroupMembers !== null) { + foreach ($this->collNagiosContactGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosContactNotificationCommands !== null) { + foreach ($this->collNagiosContactNotificationCommands as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalationContacts !== null) { + foreach ($this->collNagiosEscalationContacts as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosTimeperiodRelatedByHostNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByHostNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->getValidationFailures()); + } + } + + + if (($retval = NagiosContactPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosContactAddresss !== null) { + foreach ($this->collNagiosContactAddresss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosContactGroupMembers !== null) { + foreach ($this->collNagiosContactGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosContactNotificationCommands !== null) { + foreach ($this->collNagiosContactNotificationCommands as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalationContacts !== null) { + foreach ($this->collNagiosEscalationContacts as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + case 3: + return $this->getEmail(); + break; + case 4: + return $this->getPager(); + break; + case 5: + return $this->getHostNotificationsEnabled(); + break; + case 6: + return $this->getServiceNotificationsEnabled(); + break; + case 7: + return $this->getHostNotificationPeriod(); + break; + case 8: + return $this->getServiceNotificationPeriod(); + break; + case 9: + return $this->getHostNotificationOnDown(); + break; + case 10: + return $this->getHostNotificationOnUnreachable(); + break; + case 11: + return $this->getHostNotificationOnRecovery(); + break; + case 12: + return $this->getHostNotificationOnFlapping(); + break; + case 13: + return $this->getHostNotificationOnScheduledDowntime(); + break; + case 14: + return $this->getServiceNotificationOnWarning(); + break; + case 15: + return $this->getServiceNotificationOnUnknown(); + break; + case 16: + return $this->getServiceNotificationOnCritical(); + break; + case 17: + return $this->getServiceNotificationOnRecovery(); + break; + case 18: + return $this->getServiceNotificationOnFlapping(); + break; + case 19: + return $this->getCanSubmitCommands(); + break; + case 20: + return $this->getRetainStatusInformation(); + break; + case 21: + return $this->getRetainNonstatusInformation(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosContactPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + $keys[3] => $this->getEmail(), + $keys[4] => $this->getPager(), + $keys[5] => $this->getHostNotificationsEnabled(), + $keys[6] => $this->getServiceNotificationsEnabled(), + $keys[7] => $this->getHostNotificationPeriod(), + $keys[8] => $this->getServiceNotificationPeriod(), + $keys[9] => $this->getHostNotificationOnDown(), + $keys[10] => $this->getHostNotificationOnUnreachable(), + $keys[11] => $this->getHostNotificationOnRecovery(), + $keys[12] => $this->getHostNotificationOnFlapping(), + $keys[13] => $this->getHostNotificationOnScheduledDowntime(), + $keys[14] => $this->getServiceNotificationOnWarning(), + $keys[15] => $this->getServiceNotificationOnUnknown(), + $keys[16] => $this->getServiceNotificationOnCritical(), + $keys[17] => $this->getServiceNotificationOnRecovery(), + $keys[18] => $this->getServiceNotificationOnFlapping(), + $keys[19] => $this->getCanSubmitCommands(), + $keys[20] => $this->getRetainStatusInformation(), + $keys[21] => $this->getRetainNonstatusInformation(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($value); + break; + case 3: + $this->setEmail($value); + break; + case 4: + $this->setPager($value); + break; + case 5: + $this->setHostNotificationsEnabled($value); + break; + case 6: + $this->setServiceNotificationsEnabled($value); + break; + case 7: + $this->setHostNotificationPeriod($value); + break; + case 8: + $this->setServiceNotificationPeriod($value); + break; + case 9: + $this->setHostNotificationOnDown($value); + break; + case 10: + $this->setHostNotificationOnUnreachable($value); + break; + case 11: + $this->setHostNotificationOnRecovery($value); + break; + case 12: + $this->setHostNotificationOnFlapping($value); + break; + case 13: + $this->setHostNotificationOnScheduledDowntime($value); + break; + case 14: + $this->setServiceNotificationOnWarning($value); + break; + case 15: + $this->setServiceNotificationOnUnknown($value); + break; + case 16: + $this->setServiceNotificationOnCritical($value); + break; + case 17: + $this->setServiceNotificationOnRecovery($value); + break; + case 18: + $this->setServiceNotificationOnFlapping($value); + break; + case 19: + $this->setCanSubmitCommands($value); + break; + case 20: + $this->setRetainStatusInformation($value); + break; + case 21: + $this->setRetainNonstatusInformation($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosContactPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setEmail($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setPager($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHostNotificationsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setServiceNotificationsEnabled($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setHostNotificationPeriod($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setServiceNotificationPeriod($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setHostNotificationOnDown($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setHostNotificationOnUnreachable($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setHostNotificationOnRecovery($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setHostNotificationOnFlapping($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setHostNotificationOnScheduledDowntime($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setServiceNotificationOnWarning($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setServiceNotificationOnUnknown($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setServiceNotificationOnCritical($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setServiceNotificationOnRecovery($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setServiceNotificationOnFlapping($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setCanSubmitCommands($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setRetainStatusInformation($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setRetainNonstatusInformation($arr[$keys[21]]); + } + + /** + * 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(NagiosContactPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosContactPeer::ID)) $criteria->add(NagiosContactPeer::ID, $this->id); + if ($this->isColumnModified(NagiosContactPeer::NAME)) $criteria->add(NagiosContactPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosContactPeer::ALIAS)) $criteria->add(NagiosContactPeer::ALIAS, $this->alias); + if ($this->isColumnModified(NagiosContactPeer::EMAIL)) $criteria->add(NagiosContactPeer::EMAIL, $this->email); + if ($this->isColumnModified(NagiosContactPeer::PAGER)) $criteria->add(NagiosContactPeer::PAGER, $this->pager); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATIONS_ENABLED)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATIONS_ENABLED, $this->host_notifications_enabled); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATIONS_ENABLED)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATIONS_ENABLED, $this->service_notifications_enabled); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_PERIOD)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $this->host_notification_period); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $this->service_notification_period); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_ON_DOWN)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_ON_DOWN, $this->host_notification_on_down); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_ON_UNREACHABLE)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_ON_UNREACHABLE, $this->host_notification_on_unreachable); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_ON_RECOVERY, $this->host_notification_on_recovery); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_ON_FLAPPING, $this->host_notification_on_flapping); + if ($this->isColumnModified(NagiosContactPeer::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME)) $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME, $this->host_notification_on_scheduled_downtime); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_ON_WARNING)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_ON_WARNING, $this->service_notification_on_warning); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_ON_UNKNOWN)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_ON_UNKNOWN, $this->service_notification_on_unknown); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_ON_CRITICAL)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_ON_CRITICAL, $this->service_notification_on_critical); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_ON_RECOVERY, $this->service_notification_on_recovery); + if ($this->isColumnModified(NagiosContactPeer::SERVICE_NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_ON_FLAPPING, $this->service_notification_on_flapping); + if ($this->isColumnModified(NagiosContactPeer::CAN_SUBMIT_COMMANDS)) $criteria->add(NagiosContactPeer::CAN_SUBMIT_COMMANDS, $this->can_submit_commands); + if ($this->isColumnModified(NagiosContactPeer::RETAIN_STATUS_INFORMATION)) $criteria->add(NagiosContactPeer::RETAIN_STATUS_INFORMATION, $this->retain_status_information); + if ($this->isColumnModified(NagiosContactPeer::RETAIN_NONSTATUS_INFORMATION)) $criteria->add(NagiosContactPeer::RETAIN_NONSTATUS_INFORMATION, $this->retain_nonstatus_information); + + 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(NagiosContactPeer::DATABASE_NAME); + + $criteria->add(NagiosContactPeer::ID, $this->id); + + 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 NagiosContact (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + $copyObj->setEmail($this->email); + + $copyObj->setPager($this->pager); + + $copyObj->setHostNotificationsEnabled($this->host_notifications_enabled); + + $copyObj->setServiceNotificationsEnabled($this->service_notifications_enabled); + + $copyObj->setHostNotificationPeriod($this->host_notification_period); + + $copyObj->setServiceNotificationPeriod($this->service_notification_period); + + $copyObj->setHostNotificationOnDown($this->host_notification_on_down); + + $copyObj->setHostNotificationOnUnreachable($this->host_notification_on_unreachable); + + $copyObj->setHostNotificationOnRecovery($this->host_notification_on_recovery); + + $copyObj->setHostNotificationOnFlapping($this->host_notification_on_flapping); + + $copyObj->setHostNotificationOnScheduledDowntime($this->host_notification_on_scheduled_downtime); + + $copyObj->setServiceNotificationOnWarning($this->service_notification_on_warning); + + $copyObj->setServiceNotificationOnUnknown($this->service_notification_on_unknown); + + $copyObj->setServiceNotificationOnCritical($this->service_notification_on_critical); + + $copyObj->setServiceNotificationOnRecovery($this->service_notification_on_recovery); + + $copyObj->setServiceNotificationOnFlapping($this->service_notification_on_flapping); + + $copyObj->setCanSubmitCommands($this->can_submit_commands); + + $copyObj->setRetainStatusInformation($this->retain_status_information); + + $copyObj->setRetainNonstatusInformation($this->retain_nonstatus_information); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosContactAddresss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactAddress($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosContactGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosContactNotificationCommands() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactNotificationCommand($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalationContacts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalationContact($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosContact 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); + $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 NagiosContactPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosContactPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosContact The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByHostNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setHostNotificationPeriod(NULL); + } else { + $this->setHostNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactRelatedByHostNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByHostNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByHostNotificationPeriod === null && ($this->host_notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->host_notification_period); + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod->addNagiosContactsRelatedByHostNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByHostNotificationPeriod; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosContact The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByServiceNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setServiceNotificationPeriod(NULL); + } else { + $this->setServiceNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactRelatedByServiceNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByServiceNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByServiceNotificationPeriod === null && ($this->service_notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->service_notification_period); + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod->addNagiosContactsRelatedByServiceNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod; + } + + /** + * Clears out the collNagiosContactAddresss collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactAddresss() + */ + public function clearNagiosContactAddresss() + { + $this->collNagiosContactAddresss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactAddresss collection (array). + * + * By default this just sets the collNagiosContactAddresss collection to an empty array (like clearcollNagiosContactAddresss()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactAddresss() + { + $this->collNagiosContactAddresss = array(); + } + + /** + * Gets an array of NagiosContactAddress objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosContactAddresss from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContactAddress[] + * @throws PropelException + */ + public function getNagiosContactAddresss($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactAddresss === null) { + if ($this->isNew()) { + $this->collNagiosContactAddresss = array(); + } else { + + $criteria->add(NagiosContactAddressPeer::CONTACT, $this->id); + + NagiosContactAddressPeer::addSelectColumns($criteria); + $this->collNagiosContactAddresss = NagiosContactAddressPeer::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. + + + $criteria->add(NagiosContactAddressPeer::CONTACT, $this->id); + + NagiosContactAddressPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactAddressCriteria) || !$this->lastNagiosContactAddressCriteria->equals($criteria)) { + $this->collNagiosContactAddresss = NagiosContactAddressPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactAddressCriteria = $criteria; + return $this->collNagiosContactAddresss; + } + + /** + * Returns the number of related NagiosContactAddress objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContactAddress objects. + * @throws PropelException + */ + public function countNagiosContactAddresss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactAddresss === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactAddressPeer::CONTACT, $this->id); + + $count = NagiosContactAddressPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactAddressPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosContactAddressCriteria) || !$this->lastNagiosContactAddressCriteria->equals($criteria)) { + $count = NagiosContactAddressPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactAddresss); + } + } else { + $count = count($this->collNagiosContactAddresss); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContactAddress object to this object + * through the NagiosContactAddress foreign key attribute. + * + * @param NagiosContactAddress $l NagiosContactAddress + * @return void + * @throws PropelException + */ + public function addNagiosContactAddress(NagiosContactAddress $l) + { + if ($this->collNagiosContactAddresss === null) { + $this->initNagiosContactAddresss(); + } + if (!in_array($l, $this->collNagiosContactAddresss, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactAddresss, $l); + $l->setNagiosContact($this); + } + } + + /** + * Clears out the collNagiosContactGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactGroupMembers() + */ + public function clearNagiosContactGroupMembers() + { + $this->collNagiosContactGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactGroupMembers collection (array). + * + * By default this just sets the collNagiosContactGroupMembers collection to an empty array (like clearcollNagiosContactGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactGroupMembers() + { + $this->collNagiosContactGroupMembers = array(); + } + + /** + * Gets an array of NagiosContactGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosContactGroupMembers from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContactGroupMember[] + * @throws PropelException + */ + public function getNagiosContactGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosContactGroupMembers = array(); + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::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. + + + $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactGroupMemberCriteria = $criteria; + return $this->collNagiosContactGroupMembers; + } + + /** + * Returns the number of related NagiosContactGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContactGroupMember objects. + * @throws PropelException + */ + public function countNagiosContactGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + $count = NagiosContactGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $count = NagiosContactGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactGroupMembers); + } + } else { + $count = count($this->collNagiosContactGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContactGroupMember object to this object + * through the NagiosContactGroupMember foreign key attribute. + * + * @param NagiosContactGroupMember $l NagiosContactGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosContactGroupMember(NagiosContactGroupMember $l) + { + if ($this->collNagiosContactGroupMembers === null) { + $this->initNagiosContactGroupMembers(); + } + if (!in_array($l, $this->collNagiosContactGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactGroupMembers, $l); + $l->setNagiosContact($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosContactGroupMembers 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 NagiosContact. + */ + public function getNagiosContactGroupMembersJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosContactGroupMembers = array(); + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosContactGroupMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosContactGroupMemberCriteria = $criteria; + + return $this->collNagiosContactGroupMembers; + } + + /** + * Clears out the collNagiosContactNotificationCommands collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactNotificationCommands() + */ + public function clearNagiosContactNotificationCommands() + { + $this->collNagiosContactNotificationCommands = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactNotificationCommands collection (array). + * + * By default this just sets the collNagiosContactNotificationCommands collection to an empty array (like clearcollNagiosContactNotificationCommands()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactNotificationCommands() + { + $this->collNagiosContactNotificationCommands = array(); + } + + /** + * Gets an array of NagiosContactNotificationCommand objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosContactNotificationCommands from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContactNotificationCommand[] + * @throws PropelException + */ + public function getNagiosContactNotificationCommands($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $this->collNagiosContactNotificationCommands = array(); + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::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. + + + $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactNotificationCommandCriteria = $criteria; + return $this->collNagiosContactNotificationCommands; + } + + /** + * Returns the number of related NagiosContactNotificationCommand objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContactNotificationCommand objects. + * @throws PropelException + */ + public function countNagiosContactNotificationCommands(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + $count = NagiosContactNotificationCommandPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $count = NagiosContactNotificationCommandPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactNotificationCommands); + } + } else { + $count = count($this->collNagiosContactNotificationCommands); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContactNotificationCommand object to this object + * through the NagiosContactNotificationCommand foreign key attribute. + * + * @param NagiosContactNotificationCommand $l NagiosContactNotificationCommand + * @return void + * @throws PropelException + */ + public function addNagiosContactNotificationCommand(NagiosContactNotificationCommand $l) + { + if ($this->collNagiosContactNotificationCommands === null) { + $this->initNagiosContactNotificationCommands(); + } + if (!in_array($l, $this->collNagiosContactNotificationCommands, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactNotificationCommands, $l); + $l->setNagiosContact($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosContactNotificationCommands 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 NagiosContact. + */ + public function getNagiosContactNotificationCommandsJoinNagiosCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactNotificationCommands === null) { + if ($this->isNew()) { + $this->collNagiosContactNotificationCommands = array(); + } else { + + $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelectJoinNagiosCommand($criteria, $con, $join_behavior); + } + } 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(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->id); + + if (!isset($this->lastNagiosContactNotificationCommandCriteria) || !$this->lastNagiosContactNotificationCommandCriteria->equals($criteria)) { + $this->collNagiosContactNotificationCommands = NagiosContactNotificationCommandPeer::doSelectJoinNagiosCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosContactNotificationCommandCriteria = $criteria; + + return $this->collNagiosContactNotificationCommands; + } + + /** + * Clears out the collNagiosHostContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactMembers() + */ + public function clearNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactMembers collection (array). + * + * By default this just sets the collNagiosHostContactMembers collection to an empty array (like clearcollNagiosHostContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = array(); + } + + /** + * Gets an array of NagiosHostContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosHostContactMembers from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactMember[] + * @throws PropelException + */ + public function getNagiosHostContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::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. + + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + return $this->collNagiosHostContactMembers; + } + + /** + * Returns the number of related NagiosHostContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactMember objects. + * @throws PropelException + */ + public function countNagiosHostContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + $count = NagiosHostContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $count = NagiosHostContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactMembers); + } + } else { + $count = count($this->collNagiosHostContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactMember object to this object + * through the NagiosHostContactMember foreign key attribute. + * + * @param NagiosHostContactMember $l NagiosHostContactMember + * @return void + * @throws PropelException + */ + public function addNagiosHostContactMember(NagiosHostContactMember $l) + { + if ($this->collNagiosHostContactMembers === null) { + $this->initNagiosHostContactMembers(); + } + if (!in_array($l, $this->collNagiosHostContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactMembers, $l); + $l->setNagiosContact($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosContact. + */ + public function getNagiosHostContactMembersJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosContact. + */ + public function getNagiosHostContactMembersJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + /** + * Clears out the collNagiosServiceContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactMembers() + */ + public function clearNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactMembers collection (array). + * + * By default this just sets the collNagiosServiceContactMembers collection to an empty array (like clearcollNagiosServiceContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosServiceContactMembers from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactMember[] + * @throws PropelException + */ + public function getNagiosServiceContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::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. + + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + return $this->collNagiosServiceContactMembers; + } + + /** + * Returns the number of related NagiosServiceContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + $count = NagiosServiceContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactMember object to this object + * through the NagiosServiceContactMember foreign key attribute. + * + * @param NagiosServiceContactMember $l NagiosServiceContactMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactMember(NagiosServiceContactMember $l) + { + if ($this->collNagiosServiceContactMembers === null) { + $this->initNagiosServiceContactMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactMembers, $l); + $l->setNagiosContact($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosContact. + */ + public function getNagiosServiceContactMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosContact. + */ + public function getNagiosServiceContactMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + /** + * Clears out the collNagiosEscalationContacts collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalationContacts() + */ + public function clearNagiosEscalationContacts() + { + $this->collNagiosEscalationContacts = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalationContacts collection (array). + * + * By default this just sets the collNagiosEscalationContacts collection to an empty array (like clearcollNagiosEscalationContacts()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalationContacts() + { + $this->collNagiosEscalationContacts = array(); + } + + /** + * Gets an array of NagiosEscalationContact objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContact has previously been saved, it will retrieve + * related NagiosEscalationContacts from storage. If this NagiosContact is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalationContact[] + * @throws PropelException + */ + public function getNagiosEscalationContacts($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContacts = array(); + } else { + + $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->id); + + NagiosEscalationContactPeer::addSelectColumns($criteria); + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::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. + + + $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->id); + + NagiosEscalationContactPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationContactCriteria = $criteria; + return $this->collNagiosEscalationContacts; + } + + /** + * Returns the number of related NagiosEscalationContact objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalationContact objects. + * @throws PropelException + */ + public function countNagiosEscalationContacts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->id); + + $count = NagiosEscalationContactPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $count = NagiosEscalationContactPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalationContacts); + } + } else { + $count = count($this->collNagiosEscalationContacts); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalationContact object to this object + * through the NagiosEscalationContact foreign key attribute. + * + * @param NagiosEscalationContact $l NagiosEscalationContact + * @return void + * @throws PropelException + */ + public function addNagiosEscalationContact(NagiosEscalationContact $l) + { + if ($this->collNagiosEscalationContacts === null) { + $this->initNagiosEscalationContacts(); + } + if (!in_array($l, $this->collNagiosEscalationContacts, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalationContacts, $l); + $l->setNagiosContact($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContact is new, it will return + * an empty collection; or if this NagiosContact has previously + * been saved, it will retrieve related NagiosEscalationContacts 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 NagiosContact. + */ + public function getNagiosEscalationContactsJoinNagiosEscalation($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContacts = array(); + } else { + + $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->id); + + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelectJoinNagiosEscalation($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationContactPeer::CONTACT, $this->id); + + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelectJoinNagiosEscalation($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationContactCriteria = $criteria; + + return $this->collNagiosEscalationContacts; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosContactAddresss) { + foreach ((array) $this->collNagiosContactAddresss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosContactGroupMembers) { + foreach ((array) $this->collNagiosContactGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosContactNotificationCommands) { + foreach ((array) $this->collNagiosContactNotificationCommands as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactMembers) { + foreach ((array) $this->collNagiosHostContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactMembers) { + foreach ((array) $this->collNagiosServiceContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalationContacts) { + foreach ((array) $this->collNagiosEscalationContacts as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosContactAddresss = null; + $this->collNagiosContactGroupMembers = null; + $this->collNagiosContactNotificationCommands = null; + $this->collNagiosHostContactMembers = null; + $this->collNagiosServiceContactMembers = null; + $this->collNagiosEscalationContacts = null; + $this->aNagiosTimeperiodRelatedByHostNotificationPeriod = null; + $this->aNagiosTimeperiodRelatedByServiceNotificationPeriod = null; + } + +} // BaseNagiosContact diff --git a/classes/om/BaseNagiosContactAddress.php b/classes/om/BaseNagiosContactAddress.php new file mode 100755 index 0000000..cdb7e39 --- /dev/null +++ b/classes/om/BaseNagiosContactAddress.php @@ -0,0 +1,807 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [contact] column value. + * + * @return int + */ + public function getContact() + { + return $this->contact; + } + + /** + * Get the [address] column value. + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosContactAddress The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosContactAddressPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [contact] column. + * + * @param int $v new value + * @return NagiosContactAddress The current object (for fluent API support) + */ + public function setContact($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact !== $v) { + $this->contact = $v; + $this->modifiedColumns[] = NagiosContactAddressPeer::CONTACT; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContact() + + /** + * Set the value of [address] column. + * + * @param string $v new value + * @return NagiosContactAddress The current object (for fluent API support) + */ + public function setAddress($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address !== $v) { + $this->address = $v; + $this->modifiedColumns[] = NagiosContactAddressPeer::ADDRESS; + } + + return $this; + } // setAddress() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->contact = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->address = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosContactAddressPeer::NUM_COLUMNS - NagiosContactAddressPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosContactAddress object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosContact !== null && $this->contact !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosContactAddressPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosContact = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosContactAddressPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosContactAddressPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosContactAddressPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosContactAddressPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosContactAddressPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + + if (($retval = NagiosContactAddressPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactAddressPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getContact(); + break; + case 2: + return $this->getAddress(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosContactAddressPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getContact(), + $keys[2] => $this->getAddress(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactAddressPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setContact($value); + break; + case 2: + $this->setAddress($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosContactAddressPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setContact($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAddress($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(NagiosContactAddressPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosContactAddressPeer::ID)) $criteria->add(NagiosContactAddressPeer::ID, $this->id); + if ($this->isColumnModified(NagiosContactAddressPeer::CONTACT)) $criteria->add(NagiosContactAddressPeer::CONTACT, $this->contact); + if ($this->isColumnModified(NagiosContactAddressPeer::ADDRESS)) $criteria->add(NagiosContactAddressPeer::ADDRESS, $this->address); + + 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(NagiosContactAddressPeer::DATABASE_NAME); + + $criteria->add(NagiosContactAddressPeer::ID, $this->id); + + 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 NagiosContactAddress (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) + { + + $copyObj->setContact($this->contact); + + $copyObj->setAddress($this->address); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosContactAddress 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); + $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 NagiosContactAddressPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosContactAddressPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosContactAddress The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContact(NULL); + } else { + $this->setContact($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactAddress($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosContactAddresss($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosContact = null; + } + +} // BaseNagiosContactAddress diff --git a/classes/om/BaseNagiosContactAddressPeer.php b/classes/om/BaseNagiosContactAddressPeer.php new file mode 100755 index 0000000..e44178d --- /dev/null +++ b/classes/om/BaseNagiosContactAddressPeer.php @@ -0,0 +1,927 @@ + array ('Id', 'Contact', 'Address', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'contact', 'address', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::CONTACT, self::ADDRESS, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'contact', 'address', ), + 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, 'Contact' => 1, 'Address' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'contact' => 1, 'address' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CONTACT => 1, self::ADDRESS => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'contact' => 1, 'address' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosContactAddressMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosContactAddressPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosContactAddressPeer::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) + { + + $criteria->addSelectColumn(NagiosContactAddressPeer::ID); + + $criteria->addSelectColumn(NagiosContactAddressPeer::CONTACT); + + $criteria->addSelectColumn(NagiosContactAddressPeer::ADDRESS); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactAddressPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactAddressPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosContactAddress + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosContactAddressPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosContactAddressPeer::populateObjects(NagiosContactAddressPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosContactAddressPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosContactAddress $value A NagiosContactAddress object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosContactAddress $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosContactAddress object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosContactAddress) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosContactAddress object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosContactAddress Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosContactAddressPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosContactAddressPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosContactAddressPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosContactAddressPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactAddressPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactAddressPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactAddressPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContactAddress objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactAddress objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactAddressPeer::addSelectColumns($c); + $startcol = (NagiosContactAddressPeer::NUM_COLUMNS - NagiosContactAddressPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactAddressPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactAddressPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactAddressPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactAddressPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactAddressPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContactAddress) to $obj2 (NagiosContact) + $obj2->addNagiosContactAddress($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactAddressPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactAddressPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactAddressPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosContactAddress objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactAddress objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactAddressPeer::addSelectColumns($c); + $startcol2 = (NagiosContactAddressPeer::NUM_COLUMNS - NagiosContactAddressPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactAddressPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactAddressPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactAddressPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactAddressPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactAddressPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosContactAddress) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosContactAddress($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosContactAddressPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosContactAddress or Criteria object. + * + * @param mixed $values Criteria or NagiosContactAddress object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosContactAddress object + } + + if ($criteria->containsKey(NagiosContactAddressPeer::ID) && $criteria->keyContainsValue(NagiosContactAddressPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosContactAddressPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosContactAddress or Criteria object. + * + * @param mixed $values Criteria or NagiosContactAddress object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosContactAddressPeer::ID); + $selectCriteria->add(NagiosContactAddressPeer::ID, $criteria->remove(NagiosContactAddressPeer::ID), $comparison); + + } else { // $values is NagiosContactAddress object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_contact_address 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(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosContactAddressPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosContactAddress or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosContactAddress object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosContactAddressPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosContactAddress) { + // invalidate the cache for this single object + NagiosContactAddressPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosContactAddressPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosContactAddressPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosContactAddress 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 NagiosContactAddress $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(NagiosContactAddress $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosContactAddressPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosContactAddressPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosContactAddressPeer::DATABASE_NAME, NagiosContactAddressPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosContactAddress + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosContactAddressPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosContactAddressPeer::DATABASE_NAME); + $criteria->add(NagiosContactAddressPeer::ID, $pk); + + $v = NagiosContactAddressPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactAddressPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosContactAddressPeer::DATABASE_NAME); + $criteria->add(NagiosContactAddressPeer::ID, $pks, Criteria::IN); + $objs = NagiosContactAddressPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosContactAddressPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosContactAddressPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosContactAddressPeer class: +// +// Propel::getDatabaseMap(NagiosContactAddressPeer::DATABASE_NAME)->addTableBuilder(NagiosContactAddressPeer::TABLE_NAME, NagiosContactAddressPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosContactAddressPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosContactAddressPeer::TABLE_NAME, BaseNagiosContactAddressPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosContactGroup.php b/classes/om/BaseNagiosContactGroup.php new file mode 100755 index 0000000..006670b --- /dev/null +++ b/classes/om/BaseNagiosContactGroup.php @@ -0,0 +1,1788 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosContactGroup The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosContactGroupPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosContactGroup The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosContactGroupPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosContactGroup The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosContactGroupPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosContactGroup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosContactGroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collNagiosContactGroupMembers = null; + $this->lastNagiosContactGroupMemberCriteria = null; + + $this->collNagiosServiceContactGroupMembers = null; + $this->lastNagiosServiceContactGroupMemberCriteria = null; + + $this->collNagiosEscalationContactgroups = null; + $this->lastNagiosEscalationContactgroupCriteria = null; + + $this->collNagiosHostContactgroups = null; + $this->lastNagiosHostContactgroupCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosContactGroupPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosContactGroupPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosContactGroupPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosContactGroupPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosContactGroupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosContactGroupMembers !== null) { + foreach ($this->collNagiosContactGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalationContactgroups !== null) { + foreach ($this->collNagiosEscalationContactgroups as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosContactGroupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosContactGroupMembers !== null) { + foreach ($this->collNagiosContactGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalationContactgroups !== null) { + foreach ($this->collNagiosEscalationContactgroups as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosContactGroupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactGroupPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosContactGroupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($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(NagiosContactGroupPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosContactGroupPeer::ID)) $criteria->add(NagiosContactGroupPeer::ID, $this->id); + if ($this->isColumnModified(NagiosContactGroupPeer::NAME)) $criteria->add(NagiosContactGroupPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosContactGroupPeer::ALIAS)) $criteria->add(NagiosContactGroupPeer::ALIAS, $this->alias); + + 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(NagiosContactGroupPeer::DATABASE_NAME); + + $criteria->add(NagiosContactGroupPeer::ID, $this->id); + + 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 NagiosContactGroup (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosContactGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalationContactgroups() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalationContactgroup($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactgroups() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactgroup($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosContactGroup 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); + $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 NagiosContactGroupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosContactGroupPeer(); + } + return self::$peer; + } + + /** + * Clears out the collNagiosContactGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactGroupMembers() + */ + public function clearNagiosContactGroupMembers() + { + $this->collNagiosContactGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactGroupMembers collection (array). + * + * By default this just sets the collNagiosContactGroupMembers collection to an empty array (like clearcollNagiosContactGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactGroupMembers() + { + $this->collNagiosContactGroupMembers = array(); + } + + /** + * Gets an array of NagiosContactGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContactGroup has previously been saved, it will retrieve + * related NagiosContactGroupMembers from storage. If this NagiosContactGroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContactGroupMember[] + * @throws PropelException + */ + public function getNagiosContactGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosContactGroupMembers = array(); + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::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. + + + $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactGroupMemberCriteria = $criteria; + return $this->collNagiosContactGroupMembers; + } + + /** + * Returns the number of related NagiosContactGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContactGroupMember objects. + * @throws PropelException + */ + public function countNagiosContactGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + $count = NagiosContactGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $count = NagiosContactGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactGroupMembers); + } + } else { + $count = count($this->collNagiosContactGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContactGroupMember object to this object + * through the NagiosContactGroupMember foreign key attribute. + * + * @param NagiosContactGroupMember $l NagiosContactGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosContactGroupMember(NagiosContactGroupMember $l) + { + if ($this->collNagiosContactGroupMembers === null) { + $this->initNagiosContactGroupMembers(); + } + if (!in_array($l, $this->collNagiosContactGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactGroupMembers, $l); + $l->setNagiosContactGroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosContactGroupMembers 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 NagiosContactGroup. + */ + public function getNagiosContactGroupMembersJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosContactGroupMembers = array(); + } else { + + $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosContactGroupMemberCriteria) || !$this->lastNagiosContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosContactGroupMembers = NagiosContactGroupMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosContactGroupMemberCriteria = $criteria; + + return $this->collNagiosContactGroupMembers; + } + + /** + * Clears out the collNagiosServiceContactGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactGroupMembers() + */ + public function clearNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceContactGroupMembers collection to an empty array (like clearcollNagiosServiceContactGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContactGroup has previously been saved, it will retrieve + * related NagiosServiceContactGroupMembers from storage. If this NagiosContactGroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceContactGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::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. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Returns the number of related NagiosServiceContactGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + $count = NagiosServiceContactGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactGroupMember object to this object + * through the NagiosServiceContactGroupMember foreign key attribute. + * + * @param NagiosServiceContactGroupMember $l NagiosServiceContactGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactGroupMember(NagiosServiceContactGroupMember $l) + { + if ($this->collNagiosServiceContactGroupMembers === null) { + $this->initNagiosServiceContactGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactGroupMembers, $l); + $l->setNagiosContactGroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosContactGroup. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosContactGroup. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Clears out the collNagiosEscalationContactgroups collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalationContactgroups() + */ + public function clearNagiosEscalationContactgroups() + { + $this->collNagiosEscalationContactgroups = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalationContactgroups collection (array). + * + * By default this just sets the collNagiosEscalationContactgroups collection to an empty array (like clearcollNagiosEscalationContactgroups()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalationContactgroups() + { + $this->collNagiosEscalationContactgroups = array(); + } + + /** + * Gets an array of NagiosEscalationContactgroup objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContactGroup has previously been saved, it will retrieve + * related NagiosEscalationContactgroups from storage. If this NagiosContactGroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalationContactgroup[] + * @throws PropelException + */ + public function getNagiosEscalationContactgroups($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContactgroups = array(); + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::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. + + + $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationContactgroupCriteria = $criteria; + return $this->collNagiosEscalationContactgroups; + } + + /** + * Returns the number of related NagiosEscalationContactgroup objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalationContactgroup objects. + * @throws PropelException + */ + public function countNagiosEscalationContactgroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + $count = NagiosEscalationContactgroupPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $count = NagiosEscalationContactgroupPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalationContactgroups); + } + } else { + $count = count($this->collNagiosEscalationContactgroups); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalationContactgroup object to this object + * through the NagiosEscalationContactgroup foreign key attribute. + * + * @param NagiosEscalationContactgroup $l NagiosEscalationContactgroup + * @return void + * @throws PropelException + */ + public function addNagiosEscalationContactgroup(NagiosEscalationContactgroup $l) + { + if ($this->collNagiosEscalationContactgroups === null) { + $this->initNagiosEscalationContactgroups(); + } + if (!in_array($l, $this->collNagiosEscalationContactgroups, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalationContactgroups, $l); + $l->setNagiosContactGroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosEscalationContactgroups 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 NagiosContactGroup. + */ + public function getNagiosEscalationContactgroupsJoinNagiosEscalation($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContactgroups = array(); + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelectJoinNagiosEscalation($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelectJoinNagiosEscalation($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationContactgroupCriteria = $criteria; + + return $this->collNagiosEscalationContactgroups; + } + + /** + * Clears out the collNagiosHostContactgroups collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactgroups() + */ + public function clearNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactgroups collection (array). + * + * By default this just sets the collNagiosHostContactgroups collection to an empty array (like clearcollNagiosHostContactgroups()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = array(); + } + + /** + * Gets an array of NagiosHostContactgroup objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosContactGroup has previously been saved, it will retrieve + * related NagiosHostContactgroups from storage. If this NagiosContactGroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactgroup[] + * @throws PropelException + */ + public function getNagiosHostContactgroups($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::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. + + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + return $this->collNagiosHostContactgroups; + } + + /** + * Returns the number of related NagiosHostContactgroup objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactgroup objects. + * @throws PropelException + */ + public function countNagiosHostContactgroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + $count = NagiosHostContactgroupPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $count = NagiosHostContactgroupPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactgroups); + } + } else { + $count = count($this->collNagiosHostContactgroups); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactgroup object to this object + * through the NagiosHostContactgroup foreign key attribute. + * + * @param NagiosHostContactgroup $l NagiosHostContactgroup + * @return void + * @throws PropelException + */ + public function addNagiosHostContactgroup(NagiosHostContactgroup $l) + { + if ($this->collNagiosHostContactgroups === null) { + $this->initNagiosHostContactgroups(); + } + if (!in_array($l, $this->collNagiosHostContactgroups, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactgroups, $l); + $l->setNagiosContactGroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosContactGroup. + */ + public function getNagiosHostContactgroupsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosContactGroup is new, it will return + * an empty collection; or if this NagiosContactGroup has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosContactGroup. + */ + public function getNagiosHostContactgroupsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::CONTACTGROUP, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosContactGroupMembers) { + foreach ((array) $this->collNagiosContactGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactGroupMembers) { + foreach ((array) $this->collNagiosServiceContactGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalationContactgroups) { + foreach ((array) $this->collNagiosEscalationContactgroups as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactgroups) { + foreach ((array) $this->collNagiosHostContactgroups as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosContactGroupMembers = null; + $this->collNagiosServiceContactGroupMembers = null; + $this->collNagiosEscalationContactgroups = null; + $this->collNagiosHostContactgroups = null; + } + +} // BaseNagiosContactGroup diff --git a/classes/om/BaseNagiosContactGroupMember.php b/classes/om/BaseNagiosContactGroupMember.php new file mode 100755 index 0000000..63d647e --- /dev/null +++ b/classes/om/BaseNagiosContactGroupMember.php @@ -0,0 +1,885 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [contact] column value. + * + * @return int + */ + public function getContact() + { + return $this->contact; + } + + /** + * Get the [contactgroup] column value. + * + * @return int + */ + public function getContactgroup() + { + return $this->contactgroup; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosContactGroupMember The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosContactGroupMemberPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [contact] column. + * + * @param int $v new value + * @return NagiosContactGroupMember The current object (for fluent API support) + */ + public function setContact($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact !== $v) { + $this->contact = $v; + $this->modifiedColumns[] = NagiosContactGroupMemberPeer::CONTACT; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContact() + + /** + * Set the value of [contactgroup] column. + * + * @param int $v new value + * @return NagiosContactGroupMember The current object (for fluent API support) + */ + public function setContactgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contactgroup !== $v) { + $this->contactgroup = $v; + $this->modifiedColumns[] = NagiosContactGroupMemberPeer::CONTACTGROUP; + } + + if ($this->aNagiosContactGroup !== null && $this->aNagiosContactGroup->getId() !== $v) { + $this->aNagiosContactGroup = null; + } + + return $this; + } // setContactgroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->contact = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->contactgroup = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosContactGroupMember object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosContact !== null && $this->contact !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + if ($this->aNagiosContactGroup !== null && $this->contactgroup !== $this->aNagiosContactGroup->getId()) { + $this->aNagiosContactGroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosContactGroupMemberPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosContact = null; + $this->aNagiosContactGroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosContactGroupMemberPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosContactGroupMemberPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->aNagiosContactGroup !== null) { + if ($this->aNagiosContactGroup->isModified() || $this->aNagiosContactGroup->isNew()) { + $affectedRows += $this->aNagiosContactGroup->save($con); + } + $this->setNagiosContactGroup($this->aNagiosContactGroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosContactGroupMemberPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosContactGroupMemberPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosContactGroupMemberPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + if ($this->aNagiosContactGroup !== null) { + if (!$this->aNagiosContactGroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContactGroup->getValidationFailures()); + } + } + + + if (($retval = NagiosContactGroupMemberPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactGroupMemberPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getContact(); + break; + case 2: + return $this->getContactgroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosContactGroupMemberPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getContact(), + $keys[2] => $this->getContactgroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactGroupMemberPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setContact($value); + break; + case 2: + $this->setContactgroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosContactGroupMemberPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setContact($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setContactgroup($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(NagiosContactGroupMemberPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosContactGroupMemberPeer::ID)) $criteria->add(NagiosContactGroupMemberPeer::ID, $this->id); + if ($this->isColumnModified(NagiosContactGroupMemberPeer::CONTACT)) $criteria->add(NagiosContactGroupMemberPeer::CONTACT, $this->contact); + if ($this->isColumnModified(NagiosContactGroupMemberPeer::CONTACTGROUP)) $criteria->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $this->contactgroup); + + 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(NagiosContactGroupMemberPeer::DATABASE_NAME); + + $criteria->add(NagiosContactGroupMemberPeer::ID, $this->id); + + 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 NagiosContactGroupMember (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) + { + + $copyObj->setContact($this->contact); + + $copyObj->setContactgroup($this->contactgroup); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosContactGroupMember 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); + $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 NagiosContactGroupMemberPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosContactGroupMemberPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosContactGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContact(NULL); + } else { + $this->setContact($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosContactGroupMembers($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Declares an association between this object and a NagiosContactGroup object. + * + * @param NagiosContactGroup $v + * @return NagiosContactGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContactGroup(NagiosContactGroup $v = null) + { + if ($v === null) { + $this->setContactgroup(NULL); + } else { + $this->setContactgroup($v->getId()); + } + + $this->aNagiosContactGroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContactGroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContactGroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContactGroup The associated NagiosContactGroup object. + * @throws PropelException + */ + public function getNagiosContactGroup(PropelPDO $con = null) + { + if ($this->aNagiosContactGroup === null && ($this->contactgroup !== null)) { + $c = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $c->add(NagiosContactGroupPeer::ID, $this->contactgroup); + $this->aNagiosContactGroup = NagiosContactGroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContactGroup->addNagiosContactGroupMembers($this); + */ + } + return $this->aNagiosContactGroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosContact = null; + $this->aNagiosContactGroup = null; + } + +} // BaseNagiosContactGroupMember diff --git a/classes/om/BaseNagiosContactGroupMemberPeer.php b/classes/om/BaseNagiosContactGroupMemberPeer.php new file mode 100755 index 0000000..919f4ab --- /dev/null +++ b/classes/om/BaseNagiosContactGroupMemberPeer.php @@ -0,0 +1,1316 @@ + array ('Id', 'Contact', 'Contactgroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'contact', 'contactgroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::CONTACT, self::CONTACTGROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'contact', 'contactgroup', ), + 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, 'Contact' => 1, 'Contactgroup' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'contact' => 1, 'contactgroup' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CONTACT => 1, self::CONTACTGROUP => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'contact' => 1, 'contactgroup' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosContactGroupMemberMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosContactGroupMemberPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosContactGroupMemberPeer::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) + { + + $criteria->addSelectColumn(NagiosContactGroupMemberPeer::ID); + + $criteria->addSelectColumn(NagiosContactGroupMemberPeer::CONTACT); + + $criteria->addSelectColumn(NagiosContactGroupMemberPeer::CONTACTGROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosContactGroupMember + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosContactGroupMemberPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosContactGroupMemberPeer::populateObjects(NagiosContactGroupMemberPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosContactGroupMember $value A NagiosContactGroupMember object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosContactGroupMember $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosContactGroupMember object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosContactGroupMember) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosContactGroupMember object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosContactGroupMember Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosContactGroupMemberPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosContactGroupMemberPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosContactGroupMemberPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContactGroupMember objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContactGroupMember) to $obj2 (NagiosContact) + $obj2->addNagiosContactGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContactGroupMember objects pre-filled with their NagiosContactGroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactGroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContactGroupMember) to $obj2 (NagiosContactGroup) + $obj2->addNagiosContactGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosContactGroupMember objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosContactGroupMember) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosContactGroupMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosContactGroupMember) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosContactGroupMember($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContactGroupMember objects pre-filled with all related objects except NagiosContact. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContactGroup rows + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosContactGroupMember) to the collection in $obj2 (NagiosContactGroup) + $obj2->addNagiosContactGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContactGroupMember objects pre-filled with all related objects except NagiosContactGroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosContactGroupMemberPeer::NUM_COLUMNS - NagiosContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactGroupMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosContactGroupMember) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosContactGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosContactGroupMemberPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosContactGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosContactGroupMember object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosContactGroupMember object + } + + if ($criteria->containsKey(NagiosContactGroupMemberPeer::ID) && $criteria->keyContainsValue(NagiosContactGroupMemberPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosContactGroupMemberPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosContactGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosContactGroupMember object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosContactGroupMemberPeer::ID); + $selectCriteria->add(NagiosContactGroupMemberPeer::ID, $criteria->remove(NagiosContactGroupMemberPeer::ID), $comparison); + + } else { // $values is NagiosContactGroupMember object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_contact_group_member 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(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosContactGroupMemberPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosContactGroupMember or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosContactGroupMember object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosContactGroupMemberPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosContactGroupMember) { + // invalidate the cache for this single object + NagiosContactGroupMemberPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosContactGroupMemberPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosContactGroupMemberPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosContactGroupMember 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 NagiosContactGroupMember $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(NagiosContactGroupMember $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosContactGroupMemberPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosContactGroupMemberPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosContactGroupMemberPeer::DATABASE_NAME, NagiosContactGroupMemberPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosContactGroupMember + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosContactGroupMemberPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosContactGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosContactGroupMemberPeer::ID, $pk); + + $v = NagiosContactGroupMemberPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosContactGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosContactGroupMemberPeer::ID, $pks, Criteria::IN); + $objs = NagiosContactGroupMemberPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosContactGroupMemberPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosContactGroupMemberPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosContactGroupMemberPeer class: +// +// Propel::getDatabaseMap(NagiosContactGroupMemberPeer::DATABASE_NAME)->addTableBuilder(NagiosContactGroupMemberPeer::TABLE_NAME, NagiosContactGroupMemberPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosContactGroupMemberPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosContactGroupMemberPeer::TABLE_NAME, BaseNagiosContactGroupMemberPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosContactGroupPeer.php b/classes/om/BaseNagiosContactGroupPeer.php new file mode 100755 index 0000000..4f6e8fd --- /dev/null +++ b/classes/om/BaseNagiosContactGroupPeer.php @@ -0,0 +1,765 @@ + array ('Id', 'Name', 'Alias', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', ), + 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, 'Name' => 1, 'Alias' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosContactGroupMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosContactGroupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosContactGroupPeer::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) + { + + $criteria->addSelectColumn(NagiosContactGroupPeer::ID); + + $criteria->addSelectColumn(NagiosContactGroupPeer::NAME); + + $criteria->addSelectColumn(NagiosContactGroupPeer::ALIAS); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactGroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactGroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosContactGroup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosContactGroupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosContactGroupPeer::populateObjects(NagiosContactGroupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosContactGroupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosContactGroup $value A NagiosContactGroup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosContactGroup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosContactGroup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosContactGroup) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosContactGroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosContactGroup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosContactGroupPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosContactGroupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosContactGroupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosContactGroupPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosContactGroup or Criteria object. + * + * @param mixed $values Criteria or NagiosContactGroup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosContactGroup object + } + + if ($criteria->containsKey(NagiosContactGroupPeer::ID) && $criteria->keyContainsValue(NagiosContactGroupPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosContactGroupPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosContactGroup or Criteria object. + * + * @param mixed $values Criteria or NagiosContactGroup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosContactGroupPeer::ID); + $selectCriteria->add(NagiosContactGroupPeer::ID, $criteria->remove(NagiosContactGroupPeer::ID), $comparison); + + } else { // $values is NagiosContactGroup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_contact_group 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(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosContactGroupPeer::doOnDeleteCascade(new Criteria(NagiosContactGroupPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosContactGroupPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosContactGroup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosContactGroup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosContactGroupPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosContactGroup) { + // invalidate the cache for this single object + NagiosContactGroupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosContactGroupPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosContactGroupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosContactGroupPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosContactGroupPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosContactGroupPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosContactGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationContactgroupPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationContactgroupPeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactgroupPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactgroupPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosContactGroupPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosContactGroupMember objects + $c = new Criteria(NagiosContactGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $obj->getId()); + $affectedRows += NagiosContactGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactGroupMember objects + $c = new Criteria(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $obj->getId()); + $affectedRows += NagiosServiceContactGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosEscalationContactgroup objects + $c = new Criteria(NagiosEscalationContactgroupPeer::DATABASE_NAME); + + $c->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $obj->getId()); + $affectedRows += NagiosEscalationContactgroupPeer::doDelete($c, $con); + + // delete related NagiosHostContactgroup objects + $c = new Criteria(NagiosHostContactgroupPeer::DATABASE_NAME); + + $c->add(NagiosHostContactgroupPeer::CONTACTGROUP, $obj->getId()); + $affectedRows += NagiosHostContactgroupPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosContactGroup 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 NagiosContactGroup $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(NagiosContactGroup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosContactGroupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosContactGroupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosContactGroupPeer::DATABASE_NAME, NagiosContactGroupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosContactGroup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosContactGroupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $criteria->add(NagiosContactGroupPeer::ID, $pk); + + $v = NagiosContactGroupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $criteria->add(NagiosContactGroupPeer::ID, $pks, Criteria::IN); + $objs = NagiosContactGroupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosContactGroupPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosContactGroupPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosContactGroupPeer class: +// +// Propel::getDatabaseMap(NagiosContactGroupPeer::DATABASE_NAME)->addTableBuilder(NagiosContactGroupPeer::TABLE_NAME, NagiosContactGroupPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosContactGroupPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosContactGroupPeer::TABLE_NAME, BaseNagiosContactGroupPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosContactNotificationCommand.php b/classes/om/BaseNagiosContactNotificationCommand.php new file mode 100755 index 0000000..b8a2624 --- /dev/null +++ b/classes/om/BaseNagiosContactNotificationCommand.php @@ -0,0 +1,933 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [contact_id] column value. + * + * @return int + */ + public function getContactId() + { + return $this->contact_id; + } + + /** + * Get the [command] column value. + * + * @return int + */ + public function getCommand() + { + return $this->command; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosContactNotificationCommand The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosContactNotificationCommandPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [contact_id] column. + * + * @param int $v new value + * @return NagiosContactNotificationCommand The current object (for fluent API support) + */ + public function setContactId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact_id !== $v) { + $this->contact_id = $v; + $this->modifiedColumns[] = NagiosContactNotificationCommandPeer::CONTACT_ID; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContactId() + + /** + * Set the value of [command] column. + * + * @param int $v new value + * @return NagiosContactNotificationCommand The current object (for fluent API support) + */ + public function setCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->command !== $v) { + $this->command = $v; + $this->modifiedColumns[] = NagiosContactNotificationCommandPeer::COMMAND; + } + + if ($this->aNagiosCommand !== null && $this->aNagiosCommand->getId() !== $v) { + $this->aNagiosCommand = null; + } + + return $this; + } // setCommand() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return NagiosContactNotificationCommand The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = NagiosContactNotificationCommandPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->contact_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->command = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->type = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosContactNotificationCommand object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosContact !== null && $this->contact_id !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + if ($this->aNagiosCommand !== null && $this->command !== $this->aNagiosCommand->getId()) { + $this->aNagiosCommand = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosContactNotificationCommandPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosContact = null; + $this->aNagiosCommand = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosContactNotificationCommandPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosContactNotificationCommandPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->aNagiosCommand !== null) { + if ($this->aNagiosCommand->isModified() || $this->aNagiosCommand->isNew()) { + $affectedRows += $this->aNagiosCommand->save($con); + } + $this->setNagiosCommand($this->aNagiosCommand); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosContactNotificationCommandPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosContactNotificationCommandPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosContactNotificationCommandPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + if ($this->aNagiosCommand !== null) { + if (!$this->aNagiosCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommand->getValidationFailures()); + } + } + + + if (($retval = NagiosContactNotificationCommandPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactNotificationCommandPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getContactId(); + break; + case 2: + return $this->getCommand(); + break; + case 3: + return $this->getType(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosContactNotificationCommandPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getContactId(), + $keys[2] => $this->getCommand(), + $keys[3] => $this->getType(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosContactNotificationCommandPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setContactId($value); + break; + case 2: + $this->setCommand($value); + break; + case 3: + $this->setType($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosContactNotificationCommandPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setContactId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setCommand($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setType($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(NagiosContactNotificationCommandPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosContactNotificationCommandPeer::ID)) $criteria->add(NagiosContactNotificationCommandPeer::ID, $this->id); + if ($this->isColumnModified(NagiosContactNotificationCommandPeer::CONTACT_ID)) $criteria->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $this->contact_id); + if ($this->isColumnModified(NagiosContactNotificationCommandPeer::COMMAND)) $criteria->add(NagiosContactNotificationCommandPeer::COMMAND, $this->command); + if ($this->isColumnModified(NagiosContactNotificationCommandPeer::TYPE)) $criteria->add(NagiosContactNotificationCommandPeer::TYPE, $this->type); + + 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(NagiosContactNotificationCommandPeer::DATABASE_NAME); + + $criteria->add(NagiosContactNotificationCommandPeer::ID, $this->id); + + 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 NagiosContactNotificationCommand (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) + { + + $copyObj->setContactId($this->contact_id); + + $copyObj->setCommand($this->command); + + $copyObj->setType($this->type); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosContactNotificationCommand 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); + $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 NagiosContactNotificationCommandPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosContactNotificationCommandPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosContactNotificationCommand The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContactId(NULL); + } else { + $this->setContactId($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactNotificationCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact_id !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact_id); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosContactNotificationCommands($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosContactNotificationCommand The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setCommand(NULL); + } else { + $this->setCommand($v->getId()); + } + + $this->aNagiosCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosContactNotificationCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommand === null && ($this->command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->command); + $this->aNagiosCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommand->addNagiosContactNotificationCommands($this); + */ + } + return $this->aNagiosCommand; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosContact = null; + $this->aNagiosCommand = null; + } + +} // BaseNagiosContactNotificationCommand diff --git a/classes/om/BaseNagiosContactNotificationCommandPeer.php b/classes/om/BaseNagiosContactNotificationCommandPeer.php new file mode 100755 index 0000000..8a90ace --- /dev/null +++ b/classes/om/BaseNagiosContactNotificationCommandPeer.php @@ -0,0 +1,1321 @@ + array ('Id', 'ContactId', 'Command', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'contactId', 'command', 'type', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::CONTACT_ID, self::COMMAND, self::TYPE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'contact_id', 'command', 'type', ), + 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, 'ContactId' => 1, 'Command' => 2, 'Type' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'contactId' => 1, 'command' => 2, 'type' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CONTACT_ID => 1, self::COMMAND => 2, self::TYPE => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'contact_id' => 1, 'command' => 2, 'type' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosContactNotificationCommandMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosContactNotificationCommandPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosContactNotificationCommandPeer::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) + { + + $criteria->addSelectColumn(NagiosContactNotificationCommandPeer::ID); + + $criteria->addSelectColumn(NagiosContactNotificationCommandPeer::CONTACT_ID); + + $criteria->addSelectColumn(NagiosContactNotificationCommandPeer::COMMAND); + + $criteria->addSelectColumn(NagiosContactNotificationCommandPeer::TYPE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosContactNotificationCommand + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosContactNotificationCommandPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosContactNotificationCommandPeer::populateObjects(NagiosContactNotificationCommandPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosContactNotificationCommand $value A NagiosContactNotificationCommand object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosContactNotificationCommand $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosContactNotificationCommand object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosContactNotificationCommand) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosContactNotificationCommand object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosContactNotificationCommand Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosContactNotificationCommandPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosContactNotificationCommandPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosContactNotificationCommandPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContactNotificationCommand objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactNotificationCommand objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactNotificationCommandPeer::addSelectColumns($c); + $startcol = (NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactNotificationCommandPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactNotificationCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactNotificationCommandPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to $obj2 (NagiosContact) + $obj2->addNagiosContactNotificationCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContactNotificationCommand objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactNotificationCommand objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactNotificationCommandPeer::addSelectColumns($c); + $startcol = (NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactNotificationCommandPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactNotificationCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactNotificationCommandPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to $obj2 (NagiosCommand) + $obj2->addNagiosContactNotificationCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosContactNotificationCommand objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactNotificationCommand objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactNotificationCommandPeer::addSelectColumns($c); + $startcol2 = (NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactNotificationCommandPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactNotificationCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactNotificationCommandPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosContactNotificationCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosContactNotificationCommand($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactNotificationCommandPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContactNotificationCommand objects pre-filled with all related objects except NagiosContact. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactNotificationCommand objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactNotificationCommandPeer::addSelectColumns($c); + $startcol2 = (NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactNotificationCommandPeer::COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactNotificationCommandPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactNotificationCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactNotificationCommandPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosContactNotificationCommand($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContactNotificationCommand objects pre-filled with all related objects except NagiosCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContactNotificationCommand objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactNotificationCommandPeer::addSelectColumns($c); + $startcol2 = (NagiosContactNotificationCommandPeer::NUM_COLUMNS - NagiosContactNotificationCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactNotificationCommandPeer::CONTACT_ID,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactNotificationCommandPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactNotificationCommandPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactNotificationCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactNotificationCommandPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosContactNotificationCommand) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosContactNotificationCommand($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosContactNotificationCommandPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosContactNotificationCommand or Criteria object. + * + * @param mixed $values Criteria or NagiosContactNotificationCommand object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosContactNotificationCommand object + } + + if ($criteria->containsKey(NagiosContactNotificationCommandPeer::ID) && $criteria->keyContainsValue(NagiosContactNotificationCommandPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosContactNotificationCommandPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosContactNotificationCommand or Criteria object. + * + * @param mixed $values Criteria or NagiosContactNotificationCommand object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosContactNotificationCommandPeer::ID); + $selectCriteria->add(NagiosContactNotificationCommandPeer::ID, $criteria->remove(NagiosContactNotificationCommandPeer::ID), $comparison); + + } else { // $values is NagiosContactNotificationCommand object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_contact_notification_command 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(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosContactNotificationCommandPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosContactNotificationCommand or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosContactNotificationCommand object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosContactNotificationCommandPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosContactNotificationCommand) { + // invalidate the cache for this single object + NagiosContactNotificationCommandPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosContactNotificationCommandPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosContactNotificationCommandPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosContactNotificationCommand 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 NagiosContactNotificationCommand $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(NagiosContactNotificationCommand $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosContactNotificationCommandPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosContactNotificationCommandPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosContactNotificationCommandPeer::DATABASE_NAME, NagiosContactNotificationCommandPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosContactNotificationCommand + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosContactNotificationCommandPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosContactNotificationCommandPeer::DATABASE_NAME); + $criteria->add(NagiosContactNotificationCommandPeer::ID, $pk); + + $v = NagiosContactNotificationCommandPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactNotificationCommandPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosContactNotificationCommandPeer::DATABASE_NAME); + $criteria->add(NagiosContactNotificationCommandPeer::ID, $pks, Criteria::IN); + $objs = NagiosContactNotificationCommandPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosContactNotificationCommandPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosContactNotificationCommandPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosContactNotificationCommandPeer class: +// +// Propel::getDatabaseMap(NagiosContactNotificationCommandPeer::DATABASE_NAME)->addTableBuilder(NagiosContactNotificationCommandPeer::TABLE_NAME, NagiosContactNotificationCommandPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosContactNotificationCommandPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosContactNotificationCommandPeer::TABLE_NAME, BaseNagiosContactNotificationCommandPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosContactPeer.php b/classes/om/BaseNagiosContactPeer.php new file mode 100755 index 0000000..328a4c5 --- /dev/null +++ b/classes/om/BaseNagiosContactPeer.php @@ -0,0 +1,1450 @@ + array ('Id', 'Name', 'Alias', 'Email', 'Pager', 'HostNotificationsEnabled', 'ServiceNotificationsEnabled', 'HostNotificationPeriod', 'ServiceNotificationPeriod', 'HostNotificationOnDown', 'HostNotificationOnUnreachable', 'HostNotificationOnRecovery', 'HostNotificationOnFlapping', 'HostNotificationOnScheduledDowntime', 'ServiceNotificationOnWarning', 'ServiceNotificationOnUnknown', 'ServiceNotificationOnCritical', 'ServiceNotificationOnRecovery', 'ServiceNotificationOnFlapping', 'CanSubmitCommands', 'RetainStatusInformation', 'RetainNonstatusInformation', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', 'email', 'pager', 'hostNotificationsEnabled', 'serviceNotificationsEnabled', 'hostNotificationPeriod', 'serviceNotificationPeriod', 'hostNotificationOnDown', 'hostNotificationOnUnreachable', 'hostNotificationOnRecovery', 'hostNotificationOnFlapping', 'hostNotificationOnScheduledDowntime', 'serviceNotificationOnWarning', 'serviceNotificationOnUnknown', 'serviceNotificationOnCritical', 'serviceNotificationOnRecovery', 'serviceNotificationOnFlapping', 'canSubmitCommands', 'retainStatusInformation', 'retainNonstatusInformation', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, self::EMAIL, self::PAGER, self::HOST_NOTIFICATIONS_ENABLED, self::SERVICE_NOTIFICATIONS_ENABLED, self::HOST_NOTIFICATION_PERIOD, self::SERVICE_NOTIFICATION_PERIOD, self::HOST_NOTIFICATION_ON_DOWN, self::HOST_NOTIFICATION_ON_UNREACHABLE, self::HOST_NOTIFICATION_ON_RECOVERY, self::HOST_NOTIFICATION_ON_FLAPPING, self::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME, self::SERVICE_NOTIFICATION_ON_WARNING, self::SERVICE_NOTIFICATION_ON_UNKNOWN, self::SERVICE_NOTIFICATION_ON_CRITICAL, self::SERVICE_NOTIFICATION_ON_RECOVERY, self::SERVICE_NOTIFICATION_ON_FLAPPING, self::CAN_SUBMIT_COMMANDS, self::RETAIN_STATUS_INFORMATION, self::RETAIN_NONSTATUS_INFORMATION, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', 'email', 'pager', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_on_down', 'host_notification_on_unreachable', 'host_notification_on_recovery', 'host_notification_on_flapping', 'host_notification_on_scheduled_downtime', 'service_notification_on_warning', 'service_notification_on_unknown', 'service_notification_on_critical', 'service_notification_on_recovery', 'service_notification_on_flapping', 'can_submit_commands', 'retain_status_information', 'retain_nonstatus_information', ), + 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, ) + ); + + /** + * 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, 'Name' => 1, 'Alias' => 2, 'Email' => 3, 'Pager' => 4, 'HostNotificationsEnabled' => 5, 'ServiceNotificationsEnabled' => 6, 'HostNotificationPeriod' => 7, 'ServiceNotificationPeriod' => 8, 'HostNotificationOnDown' => 9, 'HostNotificationOnUnreachable' => 10, 'HostNotificationOnRecovery' => 11, 'HostNotificationOnFlapping' => 12, 'HostNotificationOnScheduledDowntime' => 13, 'ServiceNotificationOnWarning' => 14, 'ServiceNotificationOnUnknown' => 15, 'ServiceNotificationOnCritical' => 16, 'ServiceNotificationOnRecovery' => 17, 'ServiceNotificationOnFlapping' => 18, 'CanSubmitCommands' => 19, 'RetainStatusInformation' => 20, 'RetainNonstatusInformation' => 21, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'email' => 3, 'pager' => 4, 'hostNotificationsEnabled' => 5, 'serviceNotificationsEnabled' => 6, 'hostNotificationPeriod' => 7, 'serviceNotificationPeriod' => 8, 'hostNotificationOnDown' => 9, 'hostNotificationOnUnreachable' => 10, 'hostNotificationOnRecovery' => 11, 'hostNotificationOnFlapping' => 12, 'hostNotificationOnScheduledDowntime' => 13, 'serviceNotificationOnWarning' => 14, 'serviceNotificationOnUnknown' => 15, 'serviceNotificationOnCritical' => 16, 'serviceNotificationOnRecovery' => 17, 'serviceNotificationOnFlapping' => 18, 'canSubmitCommands' => 19, 'retainStatusInformation' => 20, 'retainNonstatusInformation' => 21, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, self::EMAIL => 3, self::PAGER => 4, self::HOST_NOTIFICATIONS_ENABLED => 5, self::SERVICE_NOTIFICATIONS_ENABLED => 6, self::HOST_NOTIFICATION_PERIOD => 7, self::SERVICE_NOTIFICATION_PERIOD => 8, self::HOST_NOTIFICATION_ON_DOWN => 9, self::HOST_NOTIFICATION_ON_UNREACHABLE => 10, self::HOST_NOTIFICATION_ON_RECOVERY => 11, self::HOST_NOTIFICATION_ON_FLAPPING => 12, self::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME => 13, self::SERVICE_NOTIFICATION_ON_WARNING => 14, self::SERVICE_NOTIFICATION_ON_UNKNOWN => 15, self::SERVICE_NOTIFICATION_ON_CRITICAL => 16, self::SERVICE_NOTIFICATION_ON_RECOVERY => 17, self::SERVICE_NOTIFICATION_ON_FLAPPING => 18, self::CAN_SUBMIT_COMMANDS => 19, self::RETAIN_STATUS_INFORMATION => 20, self::RETAIN_NONSTATUS_INFORMATION => 21, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'email' => 3, 'pager' => 4, 'host_notifications_enabled' => 5, 'service_notifications_enabled' => 6, 'host_notification_period' => 7, 'service_notification_period' => 8, 'host_notification_on_down' => 9, 'host_notification_on_unreachable' => 10, 'host_notification_on_recovery' => 11, 'host_notification_on_flapping' => 12, 'host_notification_on_scheduled_downtime' => 13, 'service_notification_on_warning' => 14, 'service_notification_on_unknown' => 15, 'service_notification_on_critical' => 16, 'service_notification_on_recovery' => 17, 'service_notification_on_flapping' => 18, 'can_submit_commands' => 19, 'retain_status_information' => 20, 'retain_nonstatus_information' => 21, ), + 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, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosContactMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosContactPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosContactPeer::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) + { + + $criteria->addSelectColumn(NagiosContactPeer::ID); + + $criteria->addSelectColumn(NagiosContactPeer::NAME); + + $criteria->addSelectColumn(NagiosContactPeer::ALIAS); + + $criteria->addSelectColumn(NagiosContactPeer::EMAIL); + + $criteria->addSelectColumn(NagiosContactPeer::PAGER); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_ON_DOWN); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosContactPeer::HOST_NOTIFICATION_ON_SCHEDULED_DOWNTIME); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_ON_WARNING); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosContactPeer::SERVICE_NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosContactPeer::CAN_SUBMIT_COMMANDS); + + $criteria->addSelectColumn(NagiosContactPeer::RETAIN_STATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosContactPeer::RETAIN_NONSTATUS_INFORMATION); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosContact + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosContactPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosContactPeer::populateObjects(NagiosContactPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosContactPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosContact $value A NagiosContact object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosContact $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosContact object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosContact) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosContact object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosContact Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosContactPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosContactPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosContactPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByHostNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByHostNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactPeer::HOST_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByServiceNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByServiceNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContact objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByHostNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactPeer::addSelectColumns($c); + $startcol = (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactPeer::HOST_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContact) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosContactRelatedByHostNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContact objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByServiceNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactPeer::addSelectColumns($c); + $startcol = (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosContact) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosContactRelatedByServiceNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosContactPeer::HOST_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosContact objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactPeer::addSelectColumns($c); + $startcol2 = (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosContactPeer::HOST_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosContact) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosContactRelatedByHostNotificationPeriod($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosContact) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosContactRelatedByServiceNotificationPeriod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByHostNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByHostNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByServiceNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByServiceNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosContact objects pre-filled with all related objects except NagiosTimeperiodRelatedByHostNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByHostNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactPeer::addSelectColumns($c); + $startcol2 = (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosContact objects pre-filled with all related objects except NagiosTimeperiodRelatedByServiceNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByServiceNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosContactPeer::addSelectColumns($c); + $startcol2 = (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosContactPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosContact or Criteria object. + * + * @param mixed $values Criteria or NagiosContact object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosContact object + } + + if ($criteria->containsKey(NagiosContactPeer::ID) && $criteria->keyContainsValue(NagiosContactPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosContactPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosContact or Criteria object. + * + * @param mixed $values Criteria or NagiosContact object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosContactPeer::ID); + $selectCriteria->add(NagiosContactPeer::ID, $criteria->remove(NagiosContactPeer::ID), $comparison); + + } else { // $values is NagiosContact object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_contact 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(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosContactPeer::doOnDeleteCascade(new Criteria(NagiosContactPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosContactPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosContact or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosContact object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosContactPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosContact) { + // invalidate the cache for this single object + NagiosContactPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosContactPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosContactPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosContactPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosContactPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosContactPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosContactAddressPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactAddressPeer::clearInstancePool(); + + // invalidate objects in NagiosContactGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosContactNotificationCommandPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactNotificationCommandPeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationContactPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationContactPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosContactPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosContactAddress objects + $c = new Criteria(NagiosContactAddressPeer::DATABASE_NAME); + + $c->add(NagiosContactAddressPeer::CONTACT, $obj->getId()); + $affectedRows += NagiosContactAddressPeer::doDelete($c, $con); + + // delete related NagiosContactGroupMember objects + $c = new Criteria(NagiosContactGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosContactGroupMemberPeer::CONTACT, $obj->getId()); + $affectedRows += NagiosContactGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosContactNotificationCommand objects + $c = new Criteria(NagiosContactNotificationCommandPeer::DATABASE_NAME); + + $c->add(NagiosContactNotificationCommandPeer::CONTACT_ID, $obj->getId()); + $affectedRows += NagiosContactNotificationCommandPeer::doDelete($c, $con); + + // delete related NagiosHostContactMember objects + $c = new Criteria(NagiosHostContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosHostContactMemberPeer::CONTACT, $obj->getId()); + $affectedRows += NagiosHostContactMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactMember objects + $c = new Criteria(NagiosServiceContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactMemberPeer::CONTACT, $obj->getId()); + $affectedRows += NagiosServiceContactMemberPeer::doDelete($c, $con); + + // delete related NagiosEscalationContact objects + $c = new Criteria(NagiosEscalationContactPeer::DATABASE_NAME); + + $c->add(NagiosEscalationContactPeer::CONTACT, $obj->getId()); + $affectedRows += NagiosEscalationContactPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosContact 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 NagiosContact $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(NagiosContact $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosContactPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosContactPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosContactPeer::DATABASE_NAME, NagiosContactPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosContact + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosContactPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + $criteria->add(NagiosContactPeer::ID, $pk); + + $v = NagiosContactPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosContactPeer::DATABASE_NAME); + $criteria->add(NagiosContactPeer::ID, $pks, Criteria::IN); + $objs = NagiosContactPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosContactPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosContactPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosContactPeer class: +// +// Propel::getDatabaseMap(NagiosContactPeer::DATABASE_NAME)->addTableBuilder(NagiosContactPeer::TABLE_NAME, NagiosContactPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosContactPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosContactPeer::TABLE_NAME, BaseNagiosContactPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosDependency.php b/classes/om/BaseNagiosDependency.php new file mode 100755 index 0000000..cdfd8e5 --- /dev/null +++ b/classes/om/BaseNagiosDependency.php @@ -0,0 +1,2597 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [service_template] column value. + * + * @return int + */ + public function getServiceTemplate() + { + return $this->service_template; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [hostgroup] column value. + * + * @return int + */ + public function getHostgroup() + { + return $this->hostgroup; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [execution_failure_criteria_up] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaUp() + { + return $this->execution_failure_criteria_up; + } + + /** + * Get the [execution_failure_criteria_down] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaDown() + { + return $this->execution_failure_criteria_down; + } + + /** + * Get the [execution_failure_criteria_unreachable] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaUnreachable() + { + return $this->execution_failure_criteria_unreachable; + } + + /** + * Get the [execution_failure_criteria_pending] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaPending() + { + return $this->execution_failure_criteria_pending; + } + + /** + * Get the [execution_failure_criteria_ok] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaOk() + { + return $this->execution_failure_criteria_ok; + } + + /** + * Get the [execution_failure_criteria_warning] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaWarning() + { + return $this->execution_failure_criteria_warning; + } + + /** + * Get the [execution_failure_criteria_unknown] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaUnknown() + { + return $this->execution_failure_criteria_unknown; + } + + /** + * Get the [execution_failure_criteria_critical] column value. + * + * @return boolean + */ + public function getExecutionFailureCriteriaCritical() + { + return $this->execution_failure_criteria_critical; + } + + /** + * Get the [notification_failure_criteria_ok] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaOk() + { + return $this->notification_failure_criteria_ok; + } + + /** + * Get the [notification_failure_criteria_warning] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaWarning() + { + return $this->notification_failure_criteria_warning; + } + + /** + * Get the [notification_failure_criteria_unknown] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaUnknown() + { + return $this->notification_failure_criteria_unknown; + } + + /** + * Get the [notification_failure_criteria_critical] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaCritical() + { + return $this->notification_failure_criteria_critical; + } + + /** + * Get the [notification_failure_criteria_pending] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaPending() + { + return $this->notification_failure_criteria_pending; + } + + /** + * Get the [notification_failure_criteria_up] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaUp() + { + return $this->notification_failure_criteria_up; + } + + /** + * Get the [notification_failure_criteria_down] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaDown() + { + return $this->notification_failure_criteria_down; + } + + /** + * Get the [notification_failure_criteria_unreachable] column value. + * + * @return boolean + */ + public function getNotificationFailureCriteriaUnreachable() + { + return $this->notification_failure_criteria_unreachable; + } + + /** + * Get the [inherits_parent] column value. + * + * @return boolean + */ + public function getInheritsParent() + { + return $this->inherits_parent; + } + + /** + * Get the [dependency_period] column value. + * + * @return int + */ + public function getDependencyPeriod() + { + return $this->dependency_period; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [service_template] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setServiceTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_template !== $v) { + $this->service_template = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::SERVICE_TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setServiceTemplate() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [hostgroup] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setHostgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->hostgroup !== $v) { + $this->hostgroup = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::HOSTGROUP; + } + + if ($this->aNagiosHostgroup !== null && $this->aNagiosHostgroup->getId() !== $v) { + $this->aNagiosHostgroup = null; + } + + return $this; + } // setHostgroup() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [execution_failure_criteria_up] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_up !== $v) { + $this->execution_failure_criteria_up = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UP; + } + + return $this; + } // setExecutionFailureCriteriaUp() + + /** + * Set the value of [execution_failure_criteria_down] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_down !== $v) { + $this->execution_failure_criteria_down = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_DOWN; + } + + return $this; + } // setExecutionFailureCriteriaDown() + + /** + * Set the value of [execution_failure_criteria_unreachable] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_unreachable !== $v) { + $this->execution_failure_criteria_unreachable = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNREACHABLE; + } + + return $this; + } // setExecutionFailureCriteriaUnreachable() + + /** + * Set the value of [execution_failure_criteria_pending] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaPending($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_pending !== $v) { + $this->execution_failure_criteria_pending = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_PENDING; + } + + return $this; + } // setExecutionFailureCriteriaPending() + + /** + * Set the value of [execution_failure_criteria_ok] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_ok !== $v) { + $this->execution_failure_criteria_ok = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_OK; + } + + return $this; + } // setExecutionFailureCriteriaOk() + + /** + * Set the value of [execution_failure_criteria_warning] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_warning !== $v) { + $this->execution_failure_criteria_warning = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_WARNING; + } + + return $this; + } // setExecutionFailureCriteriaWarning() + + /** + * Set the value of [execution_failure_criteria_unknown] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_unknown !== $v) { + $this->execution_failure_criteria_unknown = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNKNOWN; + } + + return $this; + } // setExecutionFailureCriteriaUnknown() + + /** + * Set the value of [execution_failure_criteria_critical] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setExecutionFailureCriteriaCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execution_failure_criteria_critical !== $v) { + $this->execution_failure_criteria_critical = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_CRITICAL; + } + + return $this; + } // setExecutionFailureCriteriaCritical() + + /** + * Set the value of [notification_failure_criteria_ok] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_ok !== $v) { + $this->notification_failure_criteria_ok = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_OK; + } + + return $this; + } // setNotificationFailureCriteriaOk() + + /** + * Set the value of [notification_failure_criteria_warning] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_warning !== $v) { + $this->notification_failure_criteria_warning = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_WARNING; + } + + return $this; + } // setNotificationFailureCriteriaWarning() + + /** + * Set the value of [notification_failure_criteria_unknown] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_unknown !== $v) { + $this->notification_failure_criteria_unknown = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN; + } + + return $this; + } // setNotificationFailureCriteriaUnknown() + + /** + * Set the value of [notification_failure_criteria_critical] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_critical !== $v) { + $this->notification_failure_criteria_critical = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_CRITICAL; + } + + return $this; + } // setNotificationFailureCriteriaCritical() + + /** + * Set the value of [notification_failure_criteria_pending] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaPending($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_pending !== $v) { + $this->notification_failure_criteria_pending = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_PENDING; + } + + return $this; + } // setNotificationFailureCriteriaPending() + + /** + * Set the value of [notification_failure_criteria_up] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_up !== $v) { + $this->notification_failure_criteria_up = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UP; + } + + return $this; + } // setNotificationFailureCriteriaUp() + + /** + * Set the value of [notification_failure_criteria_down] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_down !== $v) { + $this->notification_failure_criteria_down = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_DOWN; + } + + return $this; + } // setNotificationFailureCriteriaDown() + + /** + * Set the value of [notification_failure_criteria_unreachable] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setNotificationFailureCriteriaUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_failure_criteria_unreachable !== $v) { + $this->notification_failure_criteria_unreachable = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE; + } + + return $this; + } // setNotificationFailureCriteriaUnreachable() + + /** + * Set the value of [inherits_parent] column. + * + * @param boolean $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setInheritsParent($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->inherits_parent !== $v) { + $this->inherits_parent = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::INHERITS_PARENT; + } + + return $this; + } // setInheritsParent() + + /** + * Set the value of [dependency_period] column. + * + * @param int $v new value + * @return NagiosDependency The current object (for fluent API support) + */ + public function setDependencyPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->dependency_period !== $v) { + $this->dependency_period = $v; + $this->modifiedColumns[] = NagiosDependencyPeer::DEPENDENCY_PERIOD; + } + + if ($this->aNagiosTimeperiod !== null && $this->aNagiosTimeperiod->getId() !== $v) { + $this->aNagiosTimeperiod = null; + } + + return $this; + } // setDependencyPeriod() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host_template = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->host = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->service_template = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->service = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->hostgroup = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->name = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->execution_failure_criteria_up = ($row[$startcol + 7] !== null) ? (boolean) $row[$startcol + 7] : null; + $this->execution_failure_criteria_down = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null; + $this->execution_failure_criteria_unreachable = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->execution_failure_criteria_pending = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null; + $this->execution_failure_criteria_ok = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->execution_failure_criteria_warning = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->execution_failure_criteria_unknown = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->execution_failure_criteria_critical = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->notification_failure_criteria_ok = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; + $this->notification_failure_criteria_warning = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null; + $this->notification_failure_criteria_unknown = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->notification_failure_criteria_critical = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; + $this->notification_failure_criteria_pending = ($row[$startcol + 19] !== null) ? (boolean) $row[$startcol + 19] : null; + $this->notification_failure_criteria_up = ($row[$startcol + 20] !== null) ? (boolean) $row[$startcol + 20] : null; + $this->notification_failure_criteria_down = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->notification_failure_criteria_unreachable = ($row[$startcol + 22] !== null) ? (boolean) $row[$startcol + 22] : null; + $this->inherits_parent = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; + $this->dependency_period = ($row[$startcol + 24] !== null) ? (int) $row[$startcol + 24] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 25; // 25 = NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosDependency object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->service_template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosHostgroup !== null && $this->hostgroup !== $this->aNagiosHostgroup->getId()) { + $this->aNagiosHostgroup = null; + } + if ($this->aNagiosTimeperiod !== null && $this->dependency_period !== $this->aNagiosTimeperiod->getId()) { + $this->aNagiosTimeperiod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosDependencyPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + $this->aNagiosTimeperiod = null; + $this->collNagiosDependencyTargets = null; + $this->lastNagiosDependencyTargetCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosDependencyPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosDependencyPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosHostgroup !== null) { + if ($this->aNagiosHostgroup->isModified() || $this->aNagiosHostgroup->isNew()) { + $affectedRows += $this->aNagiosHostgroup->save($con); + } + $this->setNagiosHostgroup($this->aNagiosHostgroup); + } + + if ($this->aNagiosTimeperiod !== null) { + if ($this->aNagiosTimeperiod->isModified() || $this->aNagiosTimeperiod->isNew()) { + $affectedRows += $this->aNagiosTimeperiod->save($con); + } + $this->setNagiosTimeperiod($this->aNagiosTimeperiod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosDependencyPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosDependencyPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosDependencyPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosHostgroup !== null) { + if (!$this->aNagiosHostgroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostgroup->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiod !== null) { + if (!$this->aNagiosTimeperiod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiod->getValidationFailures()); + } + } + + + if (($retval = NagiosDependencyPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosDependencyPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHostTemplate(); + break; + case 2: + return $this->getHost(); + break; + case 3: + return $this->getServiceTemplate(); + break; + case 4: + return $this->getService(); + break; + case 5: + return $this->getHostgroup(); + break; + case 6: + return $this->getName(); + break; + case 7: + return $this->getExecutionFailureCriteriaUp(); + break; + case 8: + return $this->getExecutionFailureCriteriaDown(); + break; + case 9: + return $this->getExecutionFailureCriteriaUnreachable(); + break; + case 10: + return $this->getExecutionFailureCriteriaPending(); + break; + case 11: + return $this->getExecutionFailureCriteriaOk(); + break; + case 12: + return $this->getExecutionFailureCriteriaWarning(); + break; + case 13: + return $this->getExecutionFailureCriteriaUnknown(); + break; + case 14: + return $this->getExecutionFailureCriteriaCritical(); + break; + case 15: + return $this->getNotificationFailureCriteriaOk(); + break; + case 16: + return $this->getNotificationFailureCriteriaWarning(); + break; + case 17: + return $this->getNotificationFailureCriteriaUnknown(); + break; + case 18: + return $this->getNotificationFailureCriteriaCritical(); + break; + case 19: + return $this->getNotificationFailureCriteriaPending(); + break; + case 20: + return $this->getNotificationFailureCriteriaUp(); + break; + case 21: + return $this->getNotificationFailureCriteriaDown(); + break; + case 22: + return $this->getNotificationFailureCriteriaUnreachable(); + break; + case 23: + return $this->getInheritsParent(); + break; + case 24: + return $this->getDependencyPeriod(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosDependencyPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHostTemplate(), + $keys[2] => $this->getHost(), + $keys[3] => $this->getServiceTemplate(), + $keys[4] => $this->getService(), + $keys[5] => $this->getHostgroup(), + $keys[6] => $this->getName(), + $keys[7] => $this->getExecutionFailureCriteriaUp(), + $keys[8] => $this->getExecutionFailureCriteriaDown(), + $keys[9] => $this->getExecutionFailureCriteriaUnreachable(), + $keys[10] => $this->getExecutionFailureCriteriaPending(), + $keys[11] => $this->getExecutionFailureCriteriaOk(), + $keys[12] => $this->getExecutionFailureCriteriaWarning(), + $keys[13] => $this->getExecutionFailureCriteriaUnknown(), + $keys[14] => $this->getExecutionFailureCriteriaCritical(), + $keys[15] => $this->getNotificationFailureCriteriaOk(), + $keys[16] => $this->getNotificationFailureCriteriaWarning(), + $keys[17] => $this->getNotificationFailureCriteriaUnknown(), + $keys[18] => $this->getNotificationFailureCriteriaCritical(), + $keys[19] => $this->getNotificationFailureCriteriaPending(), + $keys[20] => $this->getNotificationFailureCriteriaUp(), + $keys[21] => $this->getNotificationFailureCriteriaDown(), + $keys[22] => $this->getNotificationFailureCriteriaUnreachable(), + $keys[23] => $this->getInheritsParent(), + $keys[24] => $this->getDependencyPeriod(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosDependencyPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHostTemplate($value); + break; + case 2: + $this->setHost($value); + break; + case 3: + $this->setServiceTemplate($value); + break; + case 4: + $this->setService($value); + break; + case 5: + $this->setHostgroup($value); + break; + case 6: + $this->setName($value); + break; + case 7: + $this->setExecutionFailureCriteriaUp($value); + break; + case 8: + $this->setExecutionFailureCriteriaDown($value); + break; + case 9: + $this->setExecutionFailureCriteriaUnreachable($value); + break; + case 10: + $this->setExecutionFailureCriteriaPending($value); + break; + case 11: + $this->setExecutionFailureCriteriaOk($value); + break; + case 12: + $this->setExecutionFailureCriteriaWarning($value); + break; + case 13: + $this->setExecutionFailureCriteriaUnknown($value); + break; + case 14: + $this->setExecutionFailureCriteriaCritical($value); + break; + case 15: + $this->setNotificationFailureCriteriaOk($value); + break; + case 16: + $this->setNotificationFailureCriteriaWarning($value); + break; + case 17: + $this->setNotificationFailureCriteriaUnknown($value); + break; + case 18: + $this->setNotificationFailureCriteriaCritical($value); + break; + case 19: + $this->setNotificationFailureCriteriaPending($value); + break; + case 20: + $this->setNotificationFailureCriteriaUp($value); + break; + case 21: + $this->setNotificationFailureCriteriaDown($value); + break; + case 22: + $this->setNotificationFailureCriteriaUnreachable($value); + break; + case 23: + $this->setInheritsParent($value); + break; + case 24: + $this->setDependencyPeriod($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosDependencyPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHostTemplate($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHost($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setServiceTemplate($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setService($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHostgroup($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setName($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setExecutionFailureCriteriaUp($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setExecutionFailureCriteriaDown($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setExecutionFailureCriteriaUnreachable($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setExecutionFailureCriteriaPending($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setExecutionFailureCriteriaOk($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setExecutionFailureCriteriaWarning($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setExecutionFailureCriteriaUnknown($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setExecutionFailureCriteriaCritical($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setNotificationFailureCriteriaOk($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setNotificationFailureCriteriaWarning($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setNotificationFailureCriteriaUnknown($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setNotificationFailureCriteriaCritical($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setNotificationFailureCriteriaPending($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setNotificationFailureCriteriaUp($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setNotificationFailureCriteriaDown($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setNotificationFailureCriteriaUnreachable($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setInheritsParent($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setDependencyPeriod($arr[$keys[24]]); + } + + /** + * 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(NagiosDependencyPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosDependencyPeer::ID)) $criteria->add(NagiosDependencyPeer::ID, $this->id); + if ($this->isColumnModified(NagiosDependencyPeer::HOST_TEMPLATE)) $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosDependencyPeer::HOST)) $criteria->add(NagiosDependencyPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosDependencyPeer::SERVICE_TEMPLATE)) $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->service_template); + if ($this->isColumnModified(NagiosDependencyPeer::SERVICE)) $criteria->add(NagiosDependencyPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosDependencyPeer::HOSTGROUP)) $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->hostgroup); + if ($this->isColumnModified(NagiosDependencyPeer::NAME)) $criteria->add(NagiosDependencyPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UP)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UP, $this->execution_failure_criteria_up); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_DOWN)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_DOWN, $this->execution_failure_criteria_down); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNREACHABLE)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNREACHABLE, $this->execution_failure_criteria_unreachable); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_PENDING)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_PENDING, $this->execution_failure_criteria_pending); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_OK)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_OK, $this->execution_failure_criteria_ok); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_WARNING)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_WARNING, $this->execution_failure_criteria_warning); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNKNOWN)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNKNOWN, $this->execution_failure_criteria_unknown); + if ($this->isColumnModified(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_CRITICAL)) $criteria->add(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_CRITICAL, $this->execution_failure_criteria_critical); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_OK)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_OK, $this->notification_failure_criteria_ok); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_WARNING)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_WARNING, $this->notification_failure_criteria_warning); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN, $this->notification_failure_criteria_unknown); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_CRITICAL)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_CRITICAL, $this->notification_failure_criteria_critical); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_PENDING)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_PENDING, $this->notification_failure_criteria_pending); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UP)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UP, $this->notification_failure_criteria_up); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_DOWN)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_DOWN, $this->notification_failure_criteria_down); + if ($this->isColumnModified(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE)) $criteria->add(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE, $this->notification_failure_criteria_unreachable); + if ($this->isColumnModified(NagiosDependencyPeer::INHERITS_PARENT)) $criteria->add(NagiosDependencyPeer::INHERITS_PARENT, $this->inherits_parent); + if ($this->isColumnModified(NagiosDependencyPeer::DEPENDENCY_PERIOD)) $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->dependency_period); + + 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(NagiosDependencyPeer::DATABASE_NAME); + + $criteria->add(NagiosDependencyPeer::ID, $this->id); + + 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 NagiosDependency (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) + { + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setHost($this->host); + + $copyObj->setServiceTemplate($this->service_template); + + $copyObj->setService($this->service); + + $copyObj->setHostgroup($this->hostgroup); + + $copyObj->setName($this->name); + + $copyObj->setExecutionFailureCriteriaUp($this->execution_failure_criteria_up); + + $copyObj->setExecutionFailureCriteriaDown($this->execution_failure_criteria_down); + + $copyObj->setExecutionFailureCriteriaUnreachable($this->execution_failure_criteria_unreachable); + + $copyObj->setExecutionFailureCriteriaPending($this->execution_failure_criteria_pending); + + $copyObj->setExecutionFailureCriteriaOk($this->execution_failure_criteria_ok); + + $copyObj->setExecutionFailureCriteriaWarning($this->execution_failure_criteria_warning); + + $copyObj->setExecutionFailureCriteriaUnknown($this->execution_failure_criteria_unknown); + + $copyObj->setExecutionFailureCriteriaCritical($this->execution_failure_criteria_critical); + + $copyObj->setNotificationFailureCriteriaOk($this->notification_failure_criteria_ok); + + $copyObj->setNotificationFailureCriteriaWarning($this->notification_failure_criteria_warning); + + $copyObj->setNotificationFailureCriteriaUnknown($this->notification_failure_criteria_unknown); + + $copyObj->setNotificationFailureCriteriaCritical($this->notification_failure_criteria_critical); + + $copyObj->setNotificationFailureCriteriaPending($this->notification_failure_criteria_pending); + + $copyObj->setNotificationFailureCriteriaUp($this->notification_failure_criteria_up); + + $copyObj->setNotificationFailureCriteriaDown($this->notification_failure_criteria_down); + + $copyObj->setNotificationFailureCriteriaUnreachable($this->notification_failure_criteria_unreachable); + + $copyObj->setInheritsParent($this->inherits_parent); + + $copyObj->setDependencyPeriod($this->dependency_period); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosDependencyTargets() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependencyTarget($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosDependency 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); + $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 NagiosDependencyPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosDependencyPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosDependencys($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosDependencys($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setServiceTemplate(NULL); + } else { + $this->setServiceTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->service_template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->service_template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosDependencys($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosDependencys($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosHostgroup object. + * + * @param NagiosHostgroup $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostgroup(NagiosHostgroup $v = null) + { + if ($v === null) { + $this->setHostgroup(NULL); + } else { + $this->setHostgroup($v->getId()); + } + + $this->aNagiosHostgroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostgroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostgroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostgroup The associated NagiosHostgroup object. + * @throws PropelException + */ + public function getNagiosHostgroup(PropelPDO $con = null) + { + if ($this->aNagiosHostgroup === null && ($this->hostgroup !== null)) { + $c = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $c->add(NagiosHostgroupPeer::ID, $this->hostgroup); + $this->aNagiosHostgroup = NagiosHostgroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostgroup->addNagiosDependencys($this); + */ + } + return $this->aNagiosHostgroup; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosDependency The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setDependencyPeriod(NULL); + } else { + $this->setDependencyPeriod($v->getId()); + } + + $this->aNagiosTimeperiod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependency($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiod === null && ($this->dependency_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->dependency_period); + $this->aNagiosTimeperiod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiod->addNagiosDependencys($this); + */ + } + return $this->aNagiosTimeperiod; + } + + /** + * Clears out the collNagiosDependencyTargets collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencyTargets() + */ + public function clearNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencyTargets collection (array). + * + * By default this just sets the collNagiosDependencyTargets collection to an empty array (like clearcollNagiosDependencyTargets()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = array(); + } + + /** + * Gets an array of NagiosDependencyTarget objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosDependency has previously been saved, it will retrieve + * related NagiosDependencyTargets from storage. If this NagiosDependency is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependencyTarget[] + * @throws PropelException + */ + public function getNagiosDependencyTargets($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::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. + + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + return $this->collNagiosDependencyTargets; + } + + /** + * Returns the number of related NagiosDependencyTarget objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependencyTarget objects. + * @throws PropelException + */ + public function countNagiosDependencyTargets(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + $count = NagiosDependencyTargetPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $count = NagiosDependencyTargetPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencyTargets); + } + } else { + $count = count($this->collNagiosDependencyTargets); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependencyTarget object to this object + * through the NagiosDependencyTarget foreign key attribute. + * + * @param NagiosDependencyTarget $l NagiosDependencyTarget + * @return void + * @throws PropelException + */ + public function addNagiosDependencyTarget(NagiosDependencyTarget $l) + { + if ($this->collNagiosDependencyTargets === null) { + $this->initNagiosDependencyTargets(); + } + if (!in_array($l, $this->collNagiosDependencyTargets, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencyTargets, $l); + $l->setNagiosDependency($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosDependency is new, it will return + * an empty collection; or if this NagiosDependency has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosDependency. + */ + public function getNagiosDependencyTargetsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosDependency is new, it will return + * an empty collection; or if this NagiosDependency has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosDependency. + */ + public function getNagiosDependencyTargetsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosDependency is new, it will return + * an empty collection; or if this NagiosDependency has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosDependency. + */ + public function getNagiosDependencyTargetsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::DEPENDENCY, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosDependencyTargets) { + foreach ((array) $this->collNagiosDependencyTargets as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosDependencyTargets = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + $this->aNagiosTimeperiod = null; + } + +} // BaseNagiosDependency diff --git a/classes/om/BaseNagiosDependencyPeer.php b/classes/om/BaseNagiosDependencyPeer.php new file mode 100755 index 0000000..8309a57 --- /dev/null +++ b/classes/om/BaseNagiosDependencyPeer.php @@ -0,0 +1,3156 @@ + array ('Id', 'HostTemplate', 'Host', 'ServiceTemplate', 'Service', 'Hostgroup', 'Name', 'ExecutionFailureCriteriaUp', 'ExecutionFailureCriteriaDown', 'ExecutionFailureCriteriaUnreachable', 'ExecutionFailureCriteriaPending', 'ExecutionFailureCriteriaOk', 'ExecutionFailureCriteriaWarning', 'ExecutionFailureCriteriaUnknown', 'ExecutionFailureCriteriaCritical', 'NotificationFailureCriteriaOk', 'NotificationFailureCriteriaWarning', 'NotificationFailureCriteriaUnknown', 'NotificationFailureCriteriaCritical', 'NotificationFailureCriteriaPending', 'NotificationFailureCriteriaUp', 'NotificationFailureCriteriaDown', 'NotificationFailureCriteriaUnreachable', 'InheritsParent', 'DependencyPeriod', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'hostTemplate', 'host', 'serviceTemplate', 'service', 'hostgroup', 'name', 'executionFailureCriteriaUp', 'executionFailureCriteriaDown', 'executionFailureCriteriaUnreachable', 'executionFailureCriteriaPending', 'executionFailureCriteriaOk', 'executionFailureCriteriaWarning', 'executionFailureCriteriaUnknown', 'executionFailureCriteriaCritical', 'notificationFailureCriteriaOk', 'notificationFailureCriteriaWarning', 'notificationFailureCriteriaUnknown', 'notificationFailureCriteriaCritical', 'notificationFailureCriteriaPending', 'notificationFailureCriteriaUp', 'notificationFailureCriteriaDown', 'notificationFailureCriteriaUnreachable', 'inheritsParent', 'dependencyPeriod', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST_TEMPLATE, self::HOST, self::SERVICE_TEMPLATE, self::SERVICE, self::HOSTGROUP, self::NAME, self::EXECUTION_FAILURE_CRITERIA_UP, self::EXECUTION_FAILURE_CRITERIA_DOWN, self::EXECUTION_FAILURE_CRITERIA_UNREACHABLE, self::EXECUTION_FAILURE_CRITERIA_PENDING, self::EXECUTION_FAILURE_CRITERIA_OK, self::EXECUTION_FAILURE_CRITERIA_WARNING, self::EXECUTION_FAILURE_CRITERIA_UNKNOWN, self::EXECUTION_FAILURE_CRITERIA_CRITICAL, self::NOTIFICATION_FAILURE_CRITERIA_OK, self::NOTIFICATION_FAILURE_CRITERIA_WARNING, self::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN, self::NOTIFICATION_FAILURE_CRITERIA_CRITICAL, self::NOTIFICATION_FAILURE_CRITERIA_PENDING, self::NOTIFICATION_FAILURE_CRITERIA_UP, self::NOTIFICATION_FAILURE_CRITERIA_DOWN, self::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE, self::INHERITS_PARENT, self::DEPENDENCY_PERIOD, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host_template', 'host', 'service_template', 'service', 'hostgroup', 'name', 'execution_failure_criteria_up', 'execution_failure_criteria_down', 'execution_failure_criteria_unreachable', 'execution_failure_criteria_pending', 'execution_failure_criteria_ok', 'execution_failure_criteria_warning', 'execution_failure_criteria_unknown', 'execution_failure_criteria_critical', 'notification_failure_criteria_ok', 'notification_failure_criteria_warning', 'notification_failure_criteria_unknown', 'notification_failure_criteria_critical', 'notification_failure_criteria_pending', 'notification_failure_criteria_up', 'notification_failure_criteria_down', 'notification_failure_criteria_unreachable', 'inherits_parent', 'dependency_period', ), + 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, 23, 24, ) + ); + + /** + * 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, 'HostTemplate' => 1, 'Host' => 2, 'ServiceTemplate' => 3, 'Service' => 4, 'Hostgroup' => 5, 'Name' => 6, 'ExecutionFailureCriteriaUp' => 7, 'ExecutionFailureCriteriaDown' => 8, 'ExecutionFailureCriteriaUnreachable' => 9, 'ExecutionFailureCriteriaPending' => 10, 'ExecutionFailureCriteriaOk' => 11, 'ExecutionFailureCriteriaWarning' => 12, 'ExecutionFailureCriteriaUnknown' => 13, 'ExecutionFailureCriteriaCritical' => 14, 'NotificationFailureCriteriaOk' => 15, 'NotificationFailureCriteriaWarning' => 16, 'NotificationFailureCriteriaUnknown' => 17, 'NotificationFailureCriteriaCritical' => 18, 'NotificationFailureCriteriaPending' => 19, 'NotificationFailureCriteriaUp' => 20, 'NotificationFailureCriteriaDown' => 21, 'NotificationFailureCriteriaUnreachable' => 22, 'InheritsParent' => 23, 'DependencyPeriod' => 24, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'hostTemplate' => 1, 'host' => 2, 'serviceTemplate' => 3, 'service' => 4, 'hostgroup' => 5, 'name' => 6, 'executionFailureCriteriaUp' => 7, 'executionFailureCriteriaDown' => 8, 'executionFailureCriteriaUnreachable' => 9, 'executionFailureCriteriaPending' => 10, 'executionFailureCriteriaOk' => 11, 'executionFailureCriteriaWarning' => 12, 'executionFailureCriteriaUnknown' => 13, 'executionFailureCriteriaCritical' => 14, 'notificationFailureCriteriaOk' => 15, 'notificationFailureCriteriaWarning' => 16, 'notificationFailureCriteriaUnknown' => 17, 'notificationFailureCriteriaCritical' => 18, 'notificationFailureCriteriaPending' => 19, 'notificationFailureCriteriaUp' => 20, 'notificationFailureCriteriaDown' => 21, 'notificationFailureCriteriaUnreachable' => 22, 'inheritsParent' => 23, 'dependencyPeriod' => 24, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST_TEMPLATE => 1, self::HOST => 2, self::SERVICE_TEMPLATE => 3, self::SERVICE => 4, self::HOSTGROUP => 5, self::NAME => 6, self::EXECUTION_FAILURE_CRITERIA_UP => 7, self::EXECUTION_FAILURE_CRITERIA_DOWN => 8, self::EXECUTION_FAILURE_CRITERIA_UNREACHABLE => 9, self::EXECUTION_FAILURE_CRITERIA_PENDING => 10, self::EXECUTION_FAILURE_CRITERIA_OK => 11, self::EXECUTION_FAILURE_CRITERIA_WARNING => 12, self::EXECUTION_FAILURE_CRITERIA_UNKNOWN => 13, self::EXECUTION_FAILURE_CRITERIA_CRITICAL => 14, self::NOTIFICATION_FAILURE_CRITERIA_OK => 15, self::NOTIFICATION_FAILURE_CRITERIA_WARNING => 16, self::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN => 17, self::NOTIFICATION_FAILURE_CRITERIA_CRITICAL => 18, self::NOTIFICATION_FAILURE_CRITERIA_PENDING => 19, self::NOTIFICATION_FAILURE_CRITERIA_UP => 20, self::NOTIFICATION_FAILURE_CRITERIA_DOWN => 21, self::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE => 22, self::INHERITS_PARENT => 23, self::DEPENDENCY_PERIOD => 24, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host_template' => 1, 'host' => 2, 'service_template' => 3, 'service' => 4, 'hostgroup' => 5, 'name' => 6, 'execution_failure_criteria_up' => 7, 'execution_failure_criteria_down' => 8, 'execution_failure_criteria_unreachable' => 9, 'execution_failure_criteria_pending' => 10, 'execution_failure_criteria_ok' => 11, 'execution_failure_criteria_warning' => 12, 'execution_failure_criteria_unknown' => 13, 'execution_failure_criteria_critical' => 14, 'notification_failure_criteria_ok' => 15, 'notification_failure_criteria_warning' => 16, 'notification_failure_criteria_unknown' => 17, 'notification_failure_criteria_critical' => 18, 'notification_failure_criteria_pending' => 19, 'notification_failure_criteria_up' => 20, 'notification_failure_criteria_down' => 21, 'notification_failure_criteria_unreachable' => 22, 'inherits_parent' => 23, 'dependency_period' => 24, ), + 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, 23, 24, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosDependencyMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosDependencyPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosDependencyPeer::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) + { + + $criteria->addSelectColumn(NagiosDependencyPeer::ID); + + $criteria->addSelectColumn(NagiosDependencyPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosDependencyPeer::HOST); + + $criteria->addSelectColumn(NagiosDependencyPeer::SERVICE_TEMPLATE); + + $criteria->addSelectColumn(NagiosDependencyPeer::SERVICE); + + $criteria->addSelectColumn(NagiosDependencyPeer::HOSTGROUP); + + $criteria->addSelectColumn(NagiosDependencyPeer::NAME); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UP); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_DOWN); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNREACHABLE); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_PENDING); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_OK); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_WARNING); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_UNKNOWN); + + $criteria->addSelectColumn(NagiosDependencyPeer::EXECUTION_FAILURE_CRITERIA_CRITICAL); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_OK); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_WARNING); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNKNOWN); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_CRITICAL); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_PENDING); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UP); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_DOWN); + + $criteria->addSelectColumn(NagiosDependencyPeer::NOTIFICATION_FAILURE_CRITERIA_UNREACHABLE); + + $criteria->addSelectColumn(NagiosDependencyPeer::INHERITS_PARENT); + + $criteria->addSelectColumn(NagiosDependencyPeer::DEPENDENCY_PERIOD); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosDependency + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosDependencyPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosDependencyPeer::populateObjects(NagiosDependencyPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosDependencyPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosDependency $value A NagiosDependency object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosDependency $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosDependency object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosDependency) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosDependency object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosDependency Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosDependencyPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosDependencyPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosDependencyPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosHost) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosService) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosHostgroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostgroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostgroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostgroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosHostgroup) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependency) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosDependency($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + } // if joined row not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependency($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosDependency($obj1); + } // if joined row not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosService) + $obj5->addNagiosDependency($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostgroup rows + + $key6 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosHostgroupPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosHostgroupPeer::addInstanceToPool($obj6, $key6); + } // if obj6 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosHostgroup) + $obj6->addNagiosDependency($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if obj7 loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosDependency($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosService) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosService) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosService) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosHostgroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::DEPENDENCY_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosService) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependency objects pre-filled with all related objects except NagiosTimeperiod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependency objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj5 (NagiosService) + $obj5->addNagiosDependency($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key6 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosHostgroupPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosHostgroupPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosDependency) to the collection in $obj6 (NagiosHostgroup) + $obj6->addNagiosDependency($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosDependencyPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosDependency or Criteria object. + * + * @param mixed $values Criteria or NagiosDependency object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosDependency object + } + + if ($criteria->containsKey(NagiosDependencyPeer::ID) && $criteria->keyContainsValue(NagiosDependencyPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosDependencyPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosDependency or Criteria object. + * + * @param mixed $values Criteria or NagiosDependency object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosDependencyPeer::ID); + $selectCriteria->add(NagiosDependencyPeer::ID, $criteria->remove(NagiosDependencyPeer::ID), $comparison); + + } else { // $values is NagiosDependency object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_dependency 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(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosDependencyPeer::doOnDeleteCascade(new Criteria(NagiosDependencyPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosDependencyPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosDependency or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosDependency object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosDependencyPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosDependency) { + // invalidate the cache for this single object + NagiosDependencyPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosDependencyPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosDependencyPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosDependencyPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosDependencyPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosDependencyPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosDependencyTargetPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyTargetPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosDependencyPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosDependencyTarget objects + $c = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + + $c->add(NagiosDependencyTargetPeer::DEPENDENCY, $obj->getId()); + $affectedRows += NagiosDependencyTargetPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosDependency 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 NagiosDependency $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(NagiosDependency $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosDependencyPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosDependencyPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosDependencyPeer::DATABASE_NAME, NagiosDependencyPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosDependency + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosDependencyPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + $criteria->add(NagiosDependencyPeer::ID, $pk); + + $v = NagiosDependencyPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + $criteria->add(NagiosDependencyPeer::ID, $pks, Criteria::IN); + $objs = NagiosDependencyPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosDependencyPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosDependencyPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosDependencyPeer class: +// +// Propel::getDatabaseMap(NagiosDependencyPeer::DATABASE_NAME)->addTableBuilder(NagiosDependencyPeer::TABLE_NAME, NagiosDependencyPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosDependencyPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosDependencyPeer::TABLE_NAME, BaseNagiosDependencyPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosDependencyTarget.php b/classes/om/BaseNagiosDependencyTarget.php new file mode 100755 index 0000000..11b9ba1 --- /dev/null +++ b/classes/om/BaseNagiosDependencyTarget.php @@ -0,0 +1,1137 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [dependency] column value. + * + * @return int + */ + public function getDependency() + { + return $this->dependency; + } + + /** + * Get the [target_host] column value. + * + * @return int + */ + public function getTargetHost() + { + return $this->target_host; + } + + /** + * Get the [target_service] column value. + * + * @return int + */ + public function getTargetService() + { + return $this->target_service; + } + + /** + * Get the [target_hostgroup] column value. + * + * @return int + */ + public function getTargetHostgroup() + { + return $this->target_hostgroup; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosDependencyTarget The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosDependencyTargetPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [dependency] column. + * + * @param int $v new value + * @return NagiosDependencyTarget The current object (for fluent API support) + */ + public function setDependency($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->dependency !== $v) { + $this->dependency = $v; + $this->modifiedColumns[] = NagiosDependencyTargetPeer::DEPENDENCY; + } + + if ($this->aNagiosDependency !== null && $this->aNagiosDependency->getId() !== $v) { + $this->aNagiosDependency = null; + } + + return $this; + } // setDependency() + + /** + * Set the value of [target_host] column. + * + * @param int $v new value + * @return NagiosDependencyTarget The current object (for fluent API support) + */ + public function setTargetHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->target_host !== $v) { + $this->target_host = $v; + $this->modifiedColumns[] = NagiosDependencyTargetPeer::TARGET_HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setTargetHost() + + /** + * Set the value of [target_service] column. + * + * @param int $v new value + * @return NagiosDependencyTarget The current object (for fluent API support) + */ + public function setTargetService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->target_service !== $v) { + $this->target_service = $v; + $this->modifiedColumns[] = NagiosDependencyTargetPeer::TARGET_SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setTargetService() + + /** + * Set the value of [target_hostgroup] column. + * + * @param int $v new value + * @return NagiosDependencyTarget The current object (for fluent API support) + */ + public function setTargetHostgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->target_hostgroup !== $v) { + $this->target_hostgroup = $v; + $this->modifiedColumns[] = NagiosDependencyTargetPeer::TARGET_HOSTGROUP; + } + + if ($this->aNagiosHostgroup !== null && $this->aNagiosHostgroup->getId() !== $v) { + $this->aNagiosHostgroup = null; + } + + return $this; + } // setTargetHostgroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->dependency = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->target_host = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->target_service = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->target_hostgroup = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosDependencyTarget object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosDependency !== null && $this->dependency !== $this->aNagiosDependency->getId()) { + $this->aNagiosDependency = null; + } + if ($this->aNagiosHost !== null && $this->target_host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosService !== null && $this->target_service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosHostgroup !== null && $this->target_hostgroup !== $this->aNagiosHostgroup->getId()) { + $this->aNagiosHostgroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosDependencyTargetPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosDependency = null; + $this->aNagiosHost = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosDependencyTargetPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosDependencyTargetPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosDependency !== null) { + if ($this->aNagiosDependency->isModified() || $this->aNagiosDependency->isNew()) { + $affectedRows += $this->aNagiosDependency->save($con); + } + $this->setNagiosDependency($this->aNagiosDependency); + } + + if ($this->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosHostgroup !== null) { + if ($this->aNagiosHostgroup->isModified() || $this->aNagiosHostgroup->isNew()) { + $affectedRows += $this->aNagiosHostgroup->save($con); + } + $this->setNagiosHostgroup($this->aNagiosHostgroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosDependencyTargetPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosDependencyTargetPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosDependencyTargetPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosDependency !== null) { + if (!$this->aNagiosDependency->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosDependency->getValidationFailures()); + } + } + + if ($this->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosHostgroup !== null) { + if (!$this->aNagiosHostgroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostgroup->getValidationFailures()); + } + } + + + if (($retval = NagiosDependencyTargetPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosDependencyTargetPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDependency(); + break; + case 2: + return $this->getTargetHost(); + break; + case 3: + return $this->getTargetService(); + break; + case 4: + return $this->getTargetHostgroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosDependencyTargetPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDependency(), + $keys[2] => $this->getTargetHost(), + $keys[3] => $this->getTargetService(), + $keys[4] => $this->getTargetHostgroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosDependencyTargetPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDependency($value); + break; + case 2: + $this->setTargetHost($value); + break; + case 3: + $this->setTargetService($value); + break; + case 4: + $this->setTargetHostgroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosDependencyTargetPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDependency($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTargetHost($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTargetService($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTargetHostgroup($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(NagiosDependencyTargetPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosDependencyTargetPeer::ID)) $criteria->add(NagiosDependencyTargetPeer::ID, $this->id); + if ($this->isColumnModified(NagiosDependencyTargetPeer::DEPENDENCY)) $criteria->add(NagiosDependencyTargetPeer::DEPENDENCY, $this->dependency); + if ($this->isColumnModified(NagiosDependencyTargetPeer::TARGET_HOST)) $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->target_host); + if ($this->isColumnModified(NagiosDependencyTargetPeer::TARGET_SERVICE)) $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->target_service); + if ($this->isColumnModified(NagiosDependencyTargetPeer::TARGET_HOSTGROUP)) $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->target_hostgroup); + + 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(NagiosDependencyTargetPeer::DATABASE_NAME); + + $criteria->add(NagiosDependencyTargetPeer::ID, $this->id); + + 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 NagiosDependencyTarget (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) + { + + $copyObj->setDependency($this->dependency); + + $copyObj->setTargetHost($this->target_host); + + $copyObj->setTargetService($this->target_service); + + $copyObj->setTargetHostgroup($this->target_hostgroup); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosDependencyTarget 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); + $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 NagiosDependencyTargetPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosDependencyTargetPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosDependency object. + * + * @param NagiosDependency $v + * @return NagiosDependencyTarget The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosDependency(NagiosDependency $v = null) + { + if ($v === null) { + $this->setDependency(NULL); + } else { + $this->setDependency($v->getId()); + } + + $this->aNagiosDependency = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosDependency object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependencyTarget($this); + } + + return $this; + } + + + /** + * Get the associated NagiosDependency object + * + * @param PropelPDO Optional Connection object. + * @return NagiosDependency The associated NagiosDependency object. + * @throws PropelException + */ + public function getNagiosDependency(PropelPDO $con = null) + { + if ($this->aNagiosDependency === null && ($this->dependency !== null)) { + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + $c->add(NagiosDependencyPeer::ID, $this->dependency); + $this->aNagiosDependency = NagiosDependencyPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosDependency->addNagiosDependencyTargets($this); + */ + } + return $this->aNagiosDependency; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosDependencyTarget The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setTargetHost(NULL); + } else { + $this->setTargetHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependencyTarget($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->target_host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->target_host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosDependencyTargets($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosDependencyTarget The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setTargetService(NULL); + } else { + $this->setTargetService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependencyTarget($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->target_service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->target_service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosDependencyTargets($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosHostgroup object. + * + * @param NagiosHostgroup $v + * @return NagiosDependencyTarget The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostgroup(NagiosHostgroup $v = null) + { + if ($v === null) { + $this->setTargetHostgroup(NULL); + } else { + $this->setTargetHostgroup($v->getId()); + } + + $this->aNagiosHostgroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostgroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosDependencyTarget($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostgroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostgroup The associated NagiosHostgroup object. + * @throws PropelException + */ + public function getNagiosHostgroup(PropelPDO $con = null) + { + if ($this->aNagiosHostgroup === null && ($this->target_hostgroup !== null)) { + $c = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $c->add(NagiosHostgroupPeer::ID, $this->target_hostgroup); + $this->aNagiosHostgroup = NagiosHostgroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostgroup->addNagiosDependencyTargets($this); + */ + } + return $this->aNagiosHostgroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosDependency = null; + $this->aNagiosHost = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + } + +} // BaseNagiosDependencyTarget diff --git a/classes/om/BaseNagiosDependencyTargetPeer.php b/classes/om/BaseNagiosDependencyTargetPeer.php new file mode 100755 index 0000000..13b8115 --- /dev/null +++ b/classes/om/BaseNagiosDependencyTargetPeer.php @@ -0,0 +1,2064 @@ + array ('Id', 'Dependency', 'TargetHost', 'TargetService', 'TargetHostgroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'dependency', 'targetHost', 'targetService', 'targetHostgroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DEPENDENCY, self::TARGET_HOST, self::TARGET_SERVICE, self::TARGET_HOSTGROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'dependency', 'target_host', 'target_service', 'target_hostgroup', ), + 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, 'Dependency' => 1, 'TargetHost' => 2, 'TargetService' => 3, 'TargetHostgroup' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'dependency' => 1, 'targetHost' => 2, 'targetService' => 3, 'targetHostgroup' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DEPENDENCY => 1, self::TARGET_HOST => 2, self::TARGET_SERVICE => 3, self::TARGET_HOSTGROUP => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'dependency' => 1, 'target_host' => 2, 'target_service' => 3, 'target_hostgroup' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosDependencyTargetMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosDependencyTargetPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosDependencyTargetPeer::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) + { + + $criteria->addSelectColumn(NagiosDependencyTargetPeer::ID); + + $criteria->addSelectColumn(NagiosDependencyTargetPeer::DEPENDENCY); + + $criteria->addSelectColumn(NagiosDependencyTargetPeer::TARGET_HOST); + + $criteria->addSelectColumn(NagiosDependencyTargetPeer::TARGET_SERVICE); + + $criteria->addSelectColumn(NagiosDependencyTargetPeer::TARGET_HOSTGROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosDependencyTarget + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosDependencyTargetPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosDependencyTargetPeer::populateObjects(NagiosDependencyTargetPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosDependencyTarget $value A NagiosDependencyTarget object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosDependencyTarget $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosDependencyTarget object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosDependencyTarget) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosDependencyTarget object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosDependencyTarget Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosDependencyTargetPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosDependencyTargetPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosDependencyTargetPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosDependency table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosDependency(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with their NagiosDependency objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosDependency(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosDependencyPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosDependencyPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosDependencyPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosDependencyPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to $obj2 (NagiosDependency) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to $obj2 (NagiosHost) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to $obj2 (NagiosService) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with their NagiosHostgroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostgroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostgroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostgroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to $obj2 (NagiosHostgroup) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosDependencyPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosDependency rows + + $key2 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosDependencyPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosDependencyPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosDependencyPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj2 (NagiosDependency) + $obj2->addNagiosDependencyTarget($obj1); + } // if joined row not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependencyTarget($obj1); + } // if joined row not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj4 (NagiosService) + $obj4->addNagiosDependencyTarget($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosDependencyTarget($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosDependency table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosDependency(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosDependencyTargetPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosDependencyTargetPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with all related objects except NagiosDependency. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosDependency(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key3 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServicePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServicePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj3 (NagiosService) + $obj3->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosDependencyPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosDependency rows + + $key2 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosDependencyPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosDependencyPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosDependencyPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj2 (NagiosDependency) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key3 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServicePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServicePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj3 (NagiosService) + $obj3->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosDependencyPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosDependency rows + + $key2 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosDependencyPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosDependencyPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosDependencyPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj2 (NagiosDependency) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosDependencyTarget objects pre-filled with all related objects except NagiosHostgroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosDependencyTarget objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosDependencyTargetPeer::addSelectColumns($c); + $startcol2 = (NagiosDependencyTargetPeer::NUM_COLUMNS - NagiosDependencyTargetPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosDependencyPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosDependencyPeer::NUM_COLUMNS - NagiosDependencyPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosDependencyTargetPeer::DEPENDENCY,), array(NagiosDependencyPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosDependencyTargetPeer::TARGET_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosDependencyTargetPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosDependencyTargetPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosDependencyTargetPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosDependencyTargetPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosDependency rows + + $key2 = NagiosDependencyPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosDependencyPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosDependencyPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosDependencyPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj2 (NagiosDependency) + $obj2->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosDependencyTarget) to the collection in $obj4 (NagiosService) + $obj4->addNagiosDependencyTarget($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosDependencyTargetPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosDependencyTarget or Criteria object. + * + * @param mixed $values Criteria or NagiosDependencyTarget object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosDependencyTarget object + } + + if ($criteria->containsKey(NagiosDependencyTargetPeer::ID) && $criteria->keyContainsValue(NagiosDependencyTargetPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosDependencyTargetPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosDependencyTarget or Criteria object. + * + * @param mixed $values Criteria or NagiosDependencyTarget object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosDependencyTargetPeer::ID); + $selectCriteria->add(NagiosDependencyTargetPeer::ID, $criteria->remove(NagiosDependencyTargetPeer::ID), $comparison); + + } else { // $values is NagiosDependencyTarget object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_dependency_target 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(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosDependencyTargetPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosDependencyTarget or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosDependencyTarget object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosDependencyTargetPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosDependencyTarget) { + // invalidate the cache for this single object + NagiosDependencyTargetPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosDependencyTargetPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosDependencyTargetPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosDependencyTarget 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 NagiosDependencyTarget $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(NagiosDependencyTarget $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosDependencyTargetPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosDependencyTargetPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosDependencyTargetPeer::DATABASE_NAME, NagiosDependencyTargetPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosDependencyTarget + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosDependencyTargetPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + $criteria->add(NagiosDependencyTargetPeer::ID, $pk); + + $v = NagiosDependencyTargetPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosDependencyTargetPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + $criteria->add(NagiosDependencyTargetPeer::ID, $pks, Criteria::IN); + $objs = NagiosDependencyTargetPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosDependencyTargetPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosDependencyTargetPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosDependencyTargetPeer class: +// +// Propel::getDatabaseMap(NagiosDependencyTargetPeer::DATABASE_NAME)->addTableBuilder(NagiosDependencyTargetPeer::TABLE_NAME, NagiosDependencyTargetPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosDependencyTargetPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosDependencyTargetPeer::TABLE_NAME, BaseNagiosDependencyTargetPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosEscalation.php b/classes/om/BaseNagiosEscalation.php new file mode 100755 index 0000000..bf18a1f --- /dev/null +++ b/classes/om/BaseNagiosEscalation.php @@ -0,0 +1,2409 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [hostgroup] column value. + * + * @return int + */ + public function getHostgroup() + { + return $this->hostgroup; + } + + /** + * Get the [service_template] column value. + * + * @return int + */ + public function getServiceTemplate() + { + return $this->service_template; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [first_notification] column value. + * + * @return int + */ + public function getFirstNotification() + { + return $this->first_notification; + } + + /** + * Get the [last_notification] column value. + * + * @return int + */ + public function getLastNotification() + { + return $this->last_notification; + } + + /** + * Get the [notification_interval] column value. + * + * @return int + */ + public function getNotificationInterval() + { + return $this->notification_interval; + } + + /** + * Get the [escalation_period] column value. + * + * @return int + */ + public function getEscalationPeriod() + { + return $this->escalation_period; + } + + /** + * Get the [escalation_options_up] column value. + * + * @return boolean + */ + public function getEscalationOptionsUp() + { + return $this->escalation_options_up; + } + + /** + * Get the [escalation_options_down] column value. + * + * @return boolean + */ + public function getEscalationOptionsDown() + { + return $this->escalation_options_down; + } + + /** + * Get the [escalation_options_unreachable] column value. + * + * @return boolean + */ + public function getEscalationOptionsUnreachable() + { + return $this->escalation_options_unreachable; + } + + /** + * Get the [escalation_options_ok] column value. + * + * @return boolean + */ + public function getEscalationOptionsOk() + { + return $this->escalation_options_ok; + } + + /** + * Get the [escalation_options_warning] column value. + * + * @return boolean + */ + public function getEscalationOptionsWarning() + { + return $this->escalation_options_warning; + } + + /** + * Get the [escalation_options_unknown] column value. + * + * @return boolean + */ + public function getEscalationOptionsUnknown() + { + return $this->escalation_options_unknown; + } + + /** + * Get the [escalation_options_critical] column value. + * + * @return boolean + */ + public function getEscalationOptionsCritical() + { + return $this->escalation_options_critical; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [hostgroup] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setHostgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->hostgroup !== $v) { + $this->hostgroup = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::HOSTGROUP; + } + + if ($this->aNagiosHostgroup !== null && $this->aNagiosHostgroup->getId() !== $v) { + $this->aNagiosHostgroup = null; + } + + return $this; + } // setHostgroup() + + /** + * Set the value of [service_template] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setServiceTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_template !== $v) { + $this->service_template = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::SERVICE_TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setServiceTemplate() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [first_notification] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setFirstNotification($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->first_notification !== $v) { + $this->first_notification = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::FIRST_NOTIFICATION; + } + + return $this; + } // setFirstNotification() + + /** + * Set the value of [last_notification] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setLastNotification($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->last_notification !== $v) { + $this->last_notification = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::LAST_NOTIFICATION; + } + + return $this; + } // setLastNotification() + + /** + * Set the value of [notification_interval] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setNotificationInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_interval !== $v) { + $this->notification_interval = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::NOTIFICATION_INTERVAL; + } + + return $this; + } // setNotificationInterval() + + /** + * Set the value of [escalation_period] column. + * + * @param int $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->escalation_period !== $v) { + $this->escalation_period = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_PERIOD; + } + + if ($this->aNagiosTimeperiod !== null && $this->aNagiosTimeperiod->getId() !== $v) { + $this->aNagiosTimeperiod = null; + } + + return $this; + } // setEscalationPeriod() + + /** + * Set the value of [escalation_options_up] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_up !== $v) { + $this->escalation_options_up = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_UP; + } + + return $this; + } // setEscalationOptionsUp() + + /** + * Set the value of [escalation_options_down] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_down !== $v) { + $this->escalation_options_down = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_DOWN; + } + + return $this; + } // setEscalationOptionsDown() + + /** + * Set the value of [escalation_options_unreachable] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_unreachable !== $v) { + $this->escalation_options_unreachable = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_UNREACHABLE; + } + + return $this; + } // setEscalationOptionsUnreachable() + + /** + * Set the value of [escalation_options_ok] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_ok !== $v) { + $this->escalation_options_ok = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_OK; + } + + return $this; + } // setEscalationOptionsOk() + + /** + * Set the value of [escalation_options_warning] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_warning !== $v) { + $this->escalation_options_warning = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_WARNING; + } + + return $this; + } // setEscalationOptionsWarning() + + /** + * Set the value of [escalation_options_unknown] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_unknown !== $v) { + $this->escalation_options_unknown = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_UNKNOWN; + } + + return $this; + } // setEscalationOptionsUnknown() + + /** + * Set the value of [escalation_options_critical] column. + * + * @param boolean $v new value + * @return NagiosEscalation The current object (for fluent API support) + */ + public function setEscalationOptionsCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->escalation_options_critical !== $v) { + $this->escalation_options_critical = $v; + $this->modifiedColumns[] = NagiosEscalationPeer::ESCALATION_OPTIONS_CRITICAL; + } + + return $this; + } // setEscalationOptionsCritical() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->description = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->host = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->hostgroup = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->service_template = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->service = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->first_notification = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->last_notification = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->notification_interval = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->escalation_period = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->escalation_options_up = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->escalation_options_down = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->escalation_options_unreachable = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->escalation_options_ok = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->escalation_options_warning = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; + $this->escalation_options_unknown = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null; + $this->escalation_options_critical = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 18; // 18 = NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosEscalation object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostgroup !== null && $this->hostgroup !== $this->aNagiosHostgroup->getId()) { + $this->aNagiosHostgroup = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->service_template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosTimeperiod !== null && $this->escalation_period !== $this->aNagiosTimeperiod->getId()) { + $this->aNagiosTimeperiod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosEscalationPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + $this->aNagiosTimeperiod = null; + $this->collNagiosEscalationContacts = null; + $this->lastNagiosEscalationContactCriteria = null; + + $this->collNagiosEscalationContactgroups = null; + $this->lastNagiosEscalationContactgroupCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosEscalationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosEscalationPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosHostgroup !== null) { + if ($this->aNagiosHostgroup->isModified() || $this->aNagiosHostgroup->isNew()) { + $affectedRows += $this->aNagiosHostgroup->save($con); + } + $this->setNagiosHostgroup($this->aNagiosHostgroup); + } + + if ($this->aNagiosTimeperiod !== null) { + if ($this->aNagiosTimeperiod->isModified() || $this->aNagiosTimeperiod->isNew()) { + $affectedRows += $this->aNagiosTimeperiod->save($con); + } + $this->setNagiosTimeperiod($this->aNagiosTimeperiod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosEscalationPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosEscalationPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosEscalationPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosEscalationContacts !== null) { + foreach ($this->collNagiosEscalationContacts as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalationContactgroups !== null) { + foreach ($this->collNagiosEscalationContactgroups as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosHostgroup !== null) { + if (!$this->aNagiosHostgroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostgroup->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiod !== null) { + if (!$this->aNagiosTimeperiod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiod->getValidationFailures()); + } + } + + + if (($retval = NagiosEscalationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosEscalationContacts !== null) { + foreach ($this->collNagiosEscalationContacts as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalationContactgroups !== null) { + foreach ($this->collNagiosEscalationContactgroups as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDescription(); + break; + case 2: + return $this->getHostTemplate(); + break; + case 3: + return $this->getHost(); + break; + case 4: + return $this->getHostgroup(); + break; + case 5: + return $this->getServiceTemplate(); + break; + case 6: + return $this->getService(); + break; + case 7: + return $this->getFirstNotification(); + break; + case 8: + return $this->getLastNotification(); + break; + case 9: + return $this->getNotificationInterval(); + break; + case 10: + return $this->getEscalationPeriod(); + break; + case 11: + return $this->getEscalationOptionsUp(); + break; + case 12: + return $this->getEscalationOptionsDown(); + break; + case 13: + return $this->getEscalationOptionsUnreachable(); + break; + case 14: + return $this->getEscalationOptionsOk(); + break; + case 15: + return $this->getEscalationOptionsWarning(); + break; + case 16: + return $this->getEscalationOptionsUnknown(); + break; + case 17: + return $this->getEscalationOptionsCritical(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosEscalationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDescription(), + $keys[2] => $this->getHostTemplate(), + $keys[3] => $this->getHost(), + $keys[4] => $this->getHostgroup(), + $keys[5] => $this->getServiceTemplate(), + $keys[6] => $this->getService(), + $keys[7] => $this->getFirstNotification(), + $keys[8] => $this->getLastNotification(), + $keys[9] => $this->getNotificationInterval(), + $keys[10] => $this->getEscalationPeriod(), + $keys[11] => $this->getEscalationOptionsUp(), + $keys[12] => $this->getEscalationOptionsDown(), + $keys[13] => $this->getEscalationOptionsUnreachable(), + $keys[14] => $this->getEscalationOptionsOk(), + $keys[15] => $this->getEscalationOptionsWarning(), + $keys[16] => $this->getEscalationOptionsUnknown(), + $keys[17] => $this->getEscalationOptionsCritical(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDescription($value); + break; + case 2: + $this->setHostTemplate($value); + break; + case 3: + $this->setHost($value); + break; + case 4: + $this->setHostgroup($value); + break; + case 5: + $this->setServiceTemplate($value); + break; + case 6: + $this->setService($value); + break; + case 7: + $this->setFirstNotification($value); + break; + case 8: + $this->setLastNotification($value); + break; + case 9: + $this->setNotificationInterval($value); + break; + case 10: + $this->setEscalationPeriod($value); + break; + case 11: + $this->setEscalationOptionsUp($value); + break; + case 12: + $this->setEscalationOptionsDown($value); + break; + case 13: + $this->setEscalationOptionsUnreachable($value); + break; + case 14: + $this->setEscalationOptionsOk($value); + break; + case 15: + $this->setEscalationOptionsWarning($value); + break; + case 16: + $this->setEscalationOptionsUnknown($value); + break; + case 17: + $this->setEscalationOptionsCritical($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosEscalationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDescription($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setHost($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setHostgroup($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setServiceTemplate($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setService($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setFirstNotification($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setLastNotification($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setNotificationInterval($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setEscalationPeriod($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setEscalationOptionsUp($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setEscalationOptionsDown($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setEscalationOptionsUnreachable($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setEscalationOptionsOk($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setEscalationOptionsWarning($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setEscalationOptionsUnknown($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setEscalationOptionsCritical($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(NagiosEscalationPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosEscalationPeer::ID)) $criteria->add(NagiosEscalationPeer::ID, $this->id); + if ($this->isColumnModified(NagiosEscalationPeer::DESCRIPTION)) $criteria->add(NagiosEscalationPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(NagiosEscalationPeer::HOST_TEMPLATE)) $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosEscalationPeer::HOST)) $criteria->add(NagiosEscalationPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosEscalationPeer::HOSTGROUP)) $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->hostgroup); + if ($this->isColumnModified(NagiosEscalationPeer::SERVICE_TEMPLATE)) $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->service_template); + if ($this->isColumnModified(NagiosEscalationPeer::SERVICE)) $criteria->add(NagiosEscalationPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosEscalationPeer::FIRST_NOTIFICATION)) $criteria->add(NagiosEscalationPeer::FIRST_NOTIFICATION, $this->first_notification); + if ($this->isColumnModified(NagiosEscalationPeer::LAST_NOTIFICATION)) $criteria->add(NagiosEscalationPeer::LAST_NOTIFICATION, $this->last_notification); + if ($this->isColumnModified(NagiosEscalationPeer::NOTIFICATION_INTERVAL)) $criteria->add(NagiosEscalationPeer::NOTIFICATION_INTERVAL, $this->notification_interval); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_PERIOD)) $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->escalation_period); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_UP)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_UP, $this->escalation_options_up); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_DOWN)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_DOWN, $this->escalation_options_down); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_UNREACHABLE)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_UNREACHABLE, $this->escalation_options_unreachable); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_OK)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_OK, $this->escalation_options_ok); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_WARNING)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_WARNING, $this->escalation_options_warning); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_UNKNOWN)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_UNKNOWN, $this->escalation_options_unknown); + if ($this->isColumnModified(NagiosEscalationPeer::ESCALATION_OPTIONS_CRITICAL)) $criteria->add(NagiosEscalationPeer::ESCALATION_OPTIONS_CRITICAL, $this->escalation_options_critical); + + 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(NagiosEscalationPeer::DATABASE_NAME); + + $criteria->add(NagiosEscalationPeer::ID, $this->id); + + 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 NagiosEscalation (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) + { + + $copyObj->setDescription($this->description); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setHost($this->host); + + $copyObj->setHostgroup($this->hostgroup); + + $copyObj->setServiceTemplate($this->service_template); + + $copyObj->setService($this->service); + + $copyObj->setFirstNotification($this->first_notification); + + $copyObj->setLastNotification($this->last_notification); + + $copyObj->setNotificationInterval($this->notification_interval); + + $copyObj->setEscalationPeriod($this->escalation_period); + + $copyObj->setEscalationOptionsUp($this->escalation_options_up); + + $copyObj->setEscalationOptionsDown($this->escalation_options_down); + + $copyObj->setEscalationOptionsUnreachable($this->escalation_options_unreachable); + + $copyObj->setEscalationOptionsOk($this->escalation_options_ok); + + $copyObj->setEscalationOptionsWarning($this->escalation_options_warning); + + $copyObj->setEscalationOptionsUnknown($this->escalation_options_unknown); + + $copyObj->setEscalationOptionsCritical($this->escalation_options_critical); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosEscalationContacts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalationContact($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalationContactgroups() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalationContactgroup($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosEscalation 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); + $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 NagiosEscalationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosEscalationPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosEscalations($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosEscalations($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setServiceTemplate(NULL); + } else { + $this->setServiceTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->service_template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->service_template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosEscalations($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosEscalations($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosHostgroup object. + * + * @param NagiosHostgroup $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostgroup(NagiosHostgroup $v = null) + { + if ($v === null) { + $this->setHostgroup(NULL); + } else { + $this->setHostgroup($v->getId()); + } + + $this->aNagiosHostgroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostgroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostgroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostgroup The associated NagiosHostgroup object. + * @throws PropelException + */ + public function getNagiosHostgroup(PropelPDO $con = null) + { + if ($this->aNagiosHostgroup === null && ($this->hostgroup !== null)) { + $c = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $c->add(NagiosHostgroupPeer::ID, $this->hostgroup); + $this->aNagiosHostgroup = NagiosHostgroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostgroup->addNagiosEscalations($this); + */ + } + return $this->aNagiosHostgroup; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosEscalation The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setEscalationPeriod(NULL); + } else { + $this->setEscalationPeriod($v->getId()); + } + + $this->aNagiosTimeperiod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalation($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiod === null && ($this->escalation_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->escalation_period); + $this->aNagiosTimeperiod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiod->addNagiosEscalations($this); + */ + } + return $this->aNagiosTimeperiod; + } + + /** + * Clears out the collNagiosEscalationContacts collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalationContacts() + */ + public function clearNagiosEscalationContacts() + { + $this->collNagiosEscalationContacts = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalationContacts collection (array). + * + * By default this just sets the collNagiosEscalationContacts collection to an empty array (like clearcollNagiosEscalationContacts()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalationContacts() + { + $this->collNagiosEscalationContacts = array(); + } + + /** + * Gets an array of NagiosEscalationContact objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosEscalation has previously been saved, it will retrieve + * related NagiosEscalationContacts from storage. If this NagiosEscalation is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalationContact[] + * @throws PropelException + */ + public function getNagiosEscalationContacts($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContacts = array(); + } else { + + $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->id); + + NagiosEscalationContactPeer::addSelectColumns($criteria); + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::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. + + + $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->id); + + NagiosEscalationContactPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationContactCriteria = $criteria; + return $this->collNagiosEscalationContacts; + } + + /** + * Returns the number of related NagiosEscalationContact objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalationContact objects. + * @throws PropelException + */ + public function countNagiosEscalationContacts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->id); + + $count = NagiosEscalationContactPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->id); + + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $count = NagiosEscalationContactPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalationContacts); + } + } else { + $count = count($this->collNagiosEscalationContacts); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalationContact object to this object + * through the NagiosEscalationContact foreign key attribute. + * + * @param NagiosEscalationContact $l NagiosEscalationContact + * @return void + * @throws PropelException + */ + public function addNagiosEscalationContact(NagiosEscalationContact $l) + { + if ($this->collNagiosEscalationContacts === null) { + $this->initNagiosEscalationContacts(); + } + if (!in_array($l, $this->collNagiosEscalationContacts, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalationContacts, $l); + $l->setNagiosEscalation($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosEscalation is new, it will return + * an empty collection; or if this NagiosEscalation has previously + * been saved, it will retrieve related NagiosEscalationContacts 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 NagiosEscalation. + */ + public function getNagiosEscalationContactsJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContacts === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContacts = array(); + } else { + + $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->id); + + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationContactPeer::ESCALATION, $this->id); + + if (!isset($this->lastNagiosEscalationContactCriteria) || !$this->lastNagiosEscalationContactCriteria->equals($criteria)) { + $this->collNagiosEscalationContacts = NagiosEscalationContactPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationContactCriteria = $criteria; + + return $this->collNagiosEscalationContacts; + } + + /** + * Clears out the collNagiosEscalationContactgroups collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalationContactgroups() + */ + public function clearNagiosEscalationContactgroups() + { + $this->collNagiosEscalationContactgroups = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalationContactgroups collection (array). + * + * By default this just sets the collNagiosEscalationContactgroups collection to an empty array (like clearcollNagiosEscalationContactgroups()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalationContactgroups() + { + $this->collNagiosEscalationContactgroups = array(); + } + + /** + * Gets an array of NagiosEscalationContactgroup objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosEscalation has previously been saved, it will retrieve + * related NagiosEscalationContactgroups from storage. If this NagiosEscalation is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalationContactgroup[] + * @throws PropelException + */ + public function getNagiosEscalationContactgroups($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContactgroups = array(); + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::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. + + + $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationContactgroupCriteria = $criteria; + return $this->collNagiosEscalationContactgroups; + } + + /** + * Returns the number of related NagiosEscalationContactgroup objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalationContactgroup objects. + * @throws PropelException + */ + public function countNagiosEscalationContactgroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + $count = NagiosEscalationContactgroupPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $count = NagiosEscalationContactgroupPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalationContactgroups); + } + } else { + $count = count($this->collNagiosEscalationContactgroups); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalationContactgroup object to this object + * through the NagiosEscalationContactgroup foreign key attribute. + * + * @param NagiosEscalationContactgroup $l NagiosEscalationContactgroup + * @return void + * @throws PropelException + */ + public function addNagiosEscalationContactgroup(NagiosEscalationContactgroup $l) + { + if ($this->collNagiosEscalationContactgroups === null) { + $this->initNagiosEscalationContactgroups(); + } + if (!in_array($l, $this->collNagiosEscalationContactgroups, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalationContactgroups, $l); + $l->setNagiosEscalation($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosEscalation is new, it will return + * an empty collection; or if this NagiosEscalation has previously + * been saved, it will retrieve related NagiosEscalationContactgroups 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 NagiosEscalation. + */ + public function getNagiosEscalationContactgroupsJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalationContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosEscalationContactgroups = array(); + } else { + + $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationContactgroupPeer::ESCALATION, $this->id); + + if (!isset($this->lastNagiosEscalationContactgroupCriteria) || !$this->lastNagiosEscalationContactgroupCriteria->equals($criteria)) { + $this->collNagiosEscalationContactgroups = NagiosEscalationContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationContactgroupCriteria = $criteria; + + return $this->collNagiosEscalationContactgroups; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosEscalationContacts) { + foreach ((array) $this->collNagiosEscalationContacts as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalationContactgroups) { + foreach ((array) $this->collNagiosEscalationContactgroups as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosEscalationContacts = null; + $this->collNagiosEscalationContactgroups = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHost = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosService = null; + $this->aNagiosHostgroup = null; + $this->aNagiosTimeperiod = null; + } + +} // BaseNagiosEscalation diff --git a/classes/om/BaseNagiosEscalationContact.php b/classes/om/BaseNagiosEscalationContact.php new file mode 100755 index 0000000..7e610dc --- /dev/null +++ b/classes/om/BaseNagiosEscalationContact.php @@ -0,0 +1,885 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [escalation] column value. + * + * @return int + */ + public function getEscalation() + { + return $this->escalation; + } + + /** + * Get the [contact] column value. + * + * @return int + */ + public function getContact() + { + return $this->contact; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosEscalationContact The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosEscalationContactPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [escalation] column. + * + * @param int $v new value + * @return NagiosEscalationContact The current object (for fluent API support) + */ + public function setEscalation($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->escalation !== $v) { + $this->escalation = $v; + $this->modifiedColumns[] = NagiosEscalationContactPeer::ESCALATION; + } + + if ($this->aNagiosEscalation !== null && $this->aNagiosEscalation->getId() !== $v) { + $this->aNagiosEscalation = null; + } + + return $this; + } // setEscalation() + + /** + * Set the value of [contact] column. + * + * @param int $v new value + * @return NagiosEscalationContact The current object (for fluent API support) + */ + public function setContact($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact !== $v) { + $this->contact = $v; + $this->modifiedColumns[] = NagiosEscalationContactPeer::CONTACT; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContact() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->escalation = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->contact = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosEscalationContact object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosEscalation !== null && $this->escalation !== $this->aNagiosEscalation->getId()) { + $this->aNagiosEscalation = null; + } + if ($this->aNagiosContact !== null && $this->contact !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosEscalationContactPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosEscalation = null; + $this->aNagiosContact = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosEscalationContactPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosEscalationContactPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosEscalation !== null) { + if ($this->aNagiosEscalation->isModified() || $this->aNagiosEscalation->isNew()) { + $affectedRows += $this->aNagiosEscalation->save($con); + } + $this->setNagiosEscalation($this->aNagiosEscalation); + } + + if ($this->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosEscalationContactPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosEscalationContactPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosEscalationContactPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosEscalation !== null) { + if (!$this->aNagiosEscalation->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosEscalation->getValidationFailures()); + } + } + + if ($this->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + + if (($retval = NagiosEscalationContactPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationContactPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getEscalation(); + break; + case 2: + return $this->getContact(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosEscalationContactPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getEscalation(), + $keys[2] => $this->getContact(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationContactPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setEscalation($value); + break; + case 2: + $this->setContact($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosEscalationContactPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setEscalation($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setContact($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(NagiosEscalationContactPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosEscalationContactPeer::ID)) $criteria->add(NagiosEscalationContactPeer::ID, $this->id); + if ($this->isColumnModified(NagiosEscalationContactPeer::ESCALATION)) $criteria->add(NagiosEscalationContactPeer::ESCALATION, $this->escalation); + if ($this->isColumnModified(NagiosEscalationContactPeer::CONTACT)) $criteria->add(NagiosEscalationContactPeer::CONTACT, $this->contact); + + 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(NagiosEscalationContactPeer::DATABASE_NAME); + + $criteria->add(NagiosEscalationContactPeer::ID, $this->id); + + 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 NagiosEscalationContact (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) + { + + $copyObj->setEscalation($this->escalation); + + $copyObj->setContact($this->contact); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosEscalationContact 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); + $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 NagiosEscalationContactPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosEscalationContactPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosEscalation object. + * + * @param NagiosEscalation $v + * @return NagiosEscalationContact The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosEscalation(NagiosEscalation $v = null) + { + if ($v === null) { + $this->setEscalation(NULL); + } else { + $this->setEscalation($v->getId()); + } + + $this->aNagiosEscalation = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosEscalation object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalationContact($this); + } + + return $this; + } + + + /** + * Get the associated NagiosEscalation object + * + * @param PropelPDO Optional Connection object. + * @return NagiosEscalation The associated NagiosEscalation object. + * @throws PropelException + */ + public function getNagiosEscalation(PropelPDO $con = null) + { + if ($this->aNagiosEscalation === null && ($this->escalation !== null)) { + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + $c->add(NagiosEscalationPeer::ID, $this->escalation); + $this->aNagiosEscalation = NagiosEscalationPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosEscalation->addNagiosEscalationContacts($this); + */ + } + return $this->aNagiosEscalation; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosEscalationContact The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContact(NULL); + } else { + $this->setContact($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalationContact($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosEscalationContacts($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosEscalation = null; + $this->aNagiosContact = null; + } + +} // BaseNagiosEscalationContact diff --git a/classes/om/BaseNagiosEscalationContactPeer.php b/classes/om/BaseNagiosEscalationContactPeer.php new file mode 100755 index 0000000..86a1477 --- /dev/null +++ b/classes/om/BaseNagiosEscalationContactPeer.php @@ -0,0 +1,1316 @@ + array ('Id', 'Escalation', 'Contact', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'escalation', 'contact', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::ESCALATION, self::CONTACT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'escalation', 'contact', ), + 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, 'Escalation' => 1, 'Contact' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'escalation' => 1, 'contact' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::ESCALATION => 1, self::CONTACT => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'escalation' => 1, 'contact' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosEscalationContactMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosEscalationContactPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosEscalationContactPeer::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) + { + + $criteria->addSelectColumn(NagiosEscalationContactPeer::ID); + + $criteria->addSelectColumn(NagiosEscalationContactPeer::ESCALATION); + + $criteria->addSelectColumn(NagiosEscalationContactPeer::CONTACT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosEscalationContact + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosEscalationContactPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosEscalationContactPeer::populateObjects(NagiosEscalationContactPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosEscalationContact $value A NagiosEscalationContact object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosEscalationContact $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosEscalationContact object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosEscalationContact) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosEscalationContact object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosEscalationContact Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosEscalationContactPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosEscalationContactPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosEscalationContactPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosEscalation table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosEscalation(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalationContact objects pre-filled with their NagiosEscalation objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosEscalation(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactPeer::addSelectColumns($c); + $startcol = (NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosEscalationPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalationContact) to $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContact($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalationContact objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactPeer::addSelectColumns($c); + $startcol = (NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalationContact) to $obj2 (NagiosContact) + $obj2->addNagiosEscalationContact($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosEscalationContact objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosEscalationPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosEscalation rows + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosEscalationContact) to the collection in $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContact($obj1); + } // if joined row not null + + // Add objects for joined NagiosContact rows + + $key3 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosEscalationContact) to the collection in $obj3 (NagiosContact) + $obj3->addNagiosEscalationContact($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosEscalation table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosEscalation(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalationContact objects pre-filled with all related objects except NagiosEscalation. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosEscalation(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContact rows + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalationContact) to the collection in $obj2 (NagiosContact) + $obj2->addNagiosEscalationContact($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalationContact objects pre-filled with all related objects except NagiosContact. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContact objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactPeer::NUM_COLUMNS - NagiosEscalationContactPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosEscalationPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosEscalation rows + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalationContact) to the collection in $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContact($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosEscalationContactPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosEscalationContact or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalationContact object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosEscalationContact object + } + + if ($criteria->containsKey(NagiosEscalationContactPeer::ID) && $criteria->keyContainsValue(NagiosEscalationContactPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosEscalationContactPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosEscalationContact or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalationContact object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosEscalationContactPeer::ID); + $selectCriteria->add(NagiosEscalationContactPeer::ID, $criteria->remove(NagiosEscalationContactPeer::ID), $comparison); + + } else { // $values is NagiosEscalationContact object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_escalation_contact 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(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosEscalationContactPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosEscalationContact or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosEscalationContact object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosEscalationContactPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosEscalationContact) { + // invalidate the cache for this single object + NagiosEscalationContactPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosEscalationContactPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosEscalationContactPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosEscalationContact 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 NagiosEscalationContact $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(NagiosEscalationContact $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosEscalationContactPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosEscalationContactPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosEscalationContactPeer::DATABASE_NAME, NagiosEscalationContactPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosEscalationContact + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosEscalationContactPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosEscalationContactPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationContactPeer::ID, $pk); + + $v = NagiosEscalationContactPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosEscalationContactPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationContactPeer::ID, $pks, Criteria::IN); + $objs = NagiosEscalationContactPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosEscalationContactPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosEscalationContactPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosEscalationContactPeer class: +// +// Propel::getDatabaseMap(NagiosEscalationContactPeer::DATABASE_NAME)->addTableBuilder(NagiosEscalationContactPeer::TABLE_NAME, NagiosEscalationContactPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosEscalationContactPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosEscalationContactPeer::TABLE_NAME, BaseNagiosEscalationContactPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosEscalationContactgroup.php b/classes/om/BaseNagiosEscalationContactgroup.php new file mode 100755 index 0000000..682f17d --- /dev/null +++ b/classes/om/BaseNagiosEscalationContactgroup.php @@ -0,0 +1,885 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [escalation] column value. + * + * @return int + */ + public function getEscalation() + { + return $this->escalation; + } + + /** + * Get the [contactgroup] column value. + * + * @return int + */ + public function getContactgroup() + { + return $this->contactgroup; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosEscalationContactgroup The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosEscalationContactgroupPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [escalation] column. + * + * @param int $v new value + * @return NagiosEscalationContactgroup The current object (for fluent API support) + */ + public function setEscalation($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->escalation !== $v) { + $this->escalation = $v; + $this->modifiedColumns[] = NagiosEscalationContactgroupPeer::ESCALATION; + } + + if ($this->aNagiosEscalation !== null && $this->aNagiosEscalation->getId() !== $v) { + $this->aNagiosEscalation = null; + } + + return $this; + } // setEscalation() + + /** + * Set the value of [contactgroup] column. + * + * @param int $v new value + * @return NagiosEscalationContactgroup The current object (for fluent API support) + */ + public function setContactgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contactgroup !== $v) { + $this->contactgroup = $v; + $this->modifiedColumns[] = NagiosEscalationContactgroupPeer::CONTACTGROUP; + } + + if ($this->aNagiosContactGroup !== null && $this->aNagiosContactGroup->getId() !== $v) { + $this->aNagiosContactGroup = null; + } + + return $this; + } // setContactgroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->escalation = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->contactgroup = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosEscalationContactgroup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosEscalation !== null && $this->escalation !== $this->aNagiosEscalation->getId()) { + $this->aNagiosEscalation = null; + } + if ($this->aNagiosContactGroup !== null && $this->contactgroup !== $this->aNagiosContactGroup->getId()) { + $this->aNagiosContactGroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosEscalationContactgroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosEscalation = null; + $this->aNagiosContactGroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosEscalationContactgroupPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosEscalationContactgroupPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosEscalation !== null) { + if ($this->aNagiosEscalation->isModified() || $this->aNagiosEscalation->isNew()) { + $affectedRows += $this->aNagiosEscalation->save($con); + } + $this->setNagiosEscalation($this->aNagiosEscalation); + } + + if ($this->aNagiosContactGroup !== null) { + if ($this->aNagiosContactGroup->isModified() || $this->aNagiosContactGroup->isNew()) { + $affectedRows += $this->aNagiosContactGroup->save($con); + } + $this->setNagiosContactGroup($this->aNagiosContactGroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosEscalationContactgroupPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosEscalationContactgroupPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosEscalationContactgroupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosEscalation !== null) { + if (!$this->aNagiosEscalation->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosEscalation->getValidationFailures()); + } + } + + if ($this->aNagiosContactGroup !== null) { + if (!$this->aNagiosContactGroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContactGroup->getValidationFailures()); + } + } + + + if (($retval = NagiosEscalationContactgroupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationContactgroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getEscalation(); + break; + case 2: + return $this->getContactgroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosEscalationContactgroupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getEscalation(), + $keys[2] => $this->getContactgroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosEscalationContactgroupPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setEscalation($value); + break; + case 2: + $this->setContactgroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosEscalationContactgroupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setEscalation($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setContactgroup($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(NagiosEscalationContactgroupPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosEscalationContactgroupPeer::ID)) $criteria->add(NagiosEscalationContactgroupPeer::ID, $this->id); + if ($this->isColumnModified(NagiosEscalationContactgroupPeer::ESCALATION)) $criteria->add(NagiosEscalationContactgroupPeer::ESCALATION, $this->escalation); + if ($this->isColumnModified(NagiosEscalationContactgroupPeer::CONTACTGROUP)) $criteria->add(NagiosEscalationContactgroupPeer::CONTACTGROUP, $this->contactgroup); + + 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(NagiosEscalationContactgroupPeer::DATABASE_NAME); + + $criteria->add(NagiosEscalationContactgroupPeer::ID, $this->id); + + 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 NagiosEscalationContactgroup (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) + { + + $copyObj->setEscalation($this->escalation); + + $copyObj->setContactgroup($this->contactgroup); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosEscalationContactgroup 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); + $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 NagiosEscalationContactgroupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosEscalationContactgroupPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosEscalation object. + * + * @param NagiosEscalation $v + * @return NagiosEscalationContactgroup The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosEscalation(NagiosEscalation $v = null) + { + if ($v === null) { + $this->setEscalation(NULL); + } else { + $this->setEscalation($v->getId()); + } + + $this->aNagiosEscalation = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosEscalation object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalationContactgroup($this); + } + + return $this; + } + + + /** + * Get the associated NagiosEscalation object + * + * @param PropelPDO Optional Connection object. + * @return NagiosEscalation The associated NagiosEscalation object. + * @throws PropelException + */ + public function getNagiosEscalation(PropelPDO $con = null) + { + if ($this->aNagiosEscalation === null && ($this->escalation !== null)) { + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + $c->add(NagiosEscalationPeer::ID, $this->escalation); + $this->aNagiosEscalation = NagiosEscalationPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosEscalation->addNagiosEscalationContactgroups($this); + */ + } + return $this->aNagiosEscalation; + } + + /** + * Declares an association between this object and a NagiosContactGroup object. + * + * @param NagiosContactGroup $v + * @return NagiosEscalationContactgroup The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContactGroup(NagiosContactGroup $v = null) + { + if ($v === null) { + $this->setContactgroup(NULL); + } else { + $this->setContactgroup($v->getId()); + } + + $this->aNagiosContactGroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContactGroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosEscalationContactgroup($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContactGroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContactGroup The associated NagiosContactGroup object. + * @throws PropelException + */ + public function getNagiosContactGroup(PropelPDO $con = null) + { + if ($this->aNagiosContactGroup === null && ($this->contactgroup !== null)) { + $c = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $c->add(NagiosContactGroupPeer::ID, $this->contactgroup); + $this->aNagiosContactGroup = NagiosContactGroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContactGroup->addNagiosEscalationContactgroups($this); + */ + } + return $this->aNagiosContactGroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosEscalation = null; + $this->aNagiosContactGroup = null; + } + +} // BaseNagiosEscalationContactgroup diff --git a/classes/om/BaseNagiosEscalationContactgroupPeer.php b/classes/om/BaseNagiosEscalationContactgroupPeer.php new file mode 100755 index 0000000..2cbe0fb --- /dev/null +++ b/classes/om/BaseNagiosEscalationContactgroupPeer.php @@ -0,0 +1,1316 @@ + array ('Id', 'Escalation', 'Contactgroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'escalation', 'contactgroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::ESCALATION, self::CONTACTGROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'escalation', 'contactgroup', ), + 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, 'Escalation' => 1, 'Contactgroup' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'escalation' => 1, 'contactgroup' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::ESCALATION => 1, self::CONTACTGROUP => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'escalation' => 1, 'contactgroup' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosEscalationContactgroupMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosEscalationContactgroupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosEscalationContactgroupPeer::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) + { + + $criteria->addSelectColumn(NagiosEscalationContactgroupPeer::ID); + + $criteria->addSelectColumn(NagiosEscalationContactgroupPeer::ESCALATION); + + $criteria->addSelectColumn(NagiosEscalationContactgroupPeer::CONTACTGROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosEscalationContactgroup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosEscalationContactgroupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosEscalationContactgroupPeer::populateObjects(NagiosEscalationContactgroupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosEscalationContactgroup $value A NagiosEscalationContactgroup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosEscalationContactgroup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosEscalationContactgroup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosEscalationContactgroup) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosEscalationContactgroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosEscalationContactgroup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosEscalationContactgroupPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosEscalationContactgroupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosEscalationContactgroupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosEscalation table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosEscalation(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalationContactgroup objects pre-filled with their NagiosEscalation objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosEscalation(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactgroupPeer::addSelectColumns($c); + $startcol = (NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosEscalationPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContactgroup($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalationContactgroup objects pre-filled with their NagiosContactGroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactgroupPeer::addSelectColumns($c); + $startcol = (NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactGroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to $obj2 (NagiosContactGroup) + $obj2->addNagiosEscalationContactgroup($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosEscalationContactgroup objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosEscalationPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosEscalation rows + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to the collection in $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContactgroup($obj1); + } // if joined row not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosEscalationContactgroup($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosEscalation table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosEscalation(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalationContactgroup objects pre-filled with all related objects except NagiosEscalation. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosEscalation(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosContactGroup rows + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to the collection in $obj2 (NagiosContactGroup) + $obj2->addNagiosEscalationContactgroup($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalationContactgroup objects pre-filled with all related objects except NagiosContactGroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalationContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationContactgroupPeer::NUM_COLUMNS - NagiosEscalationContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosEscalationPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationContactgroupPeer::ESCALATION,), array(NagiosEscalationPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosEscalation rows + + $key2 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosEscalationPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosEscalationPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosEscalationPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalationContactgroup) to the collection in $obj2 (NagiosEscalation) + $obj2->addNagiosEscalationContactgroup($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosEscalationContactgroupPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosEscalationContactgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalationContactgroup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosEscalationContactgroup object + } + + if ($criteria->containsKey(NagiosEscalationContactgroupPeer::ID) && $criteria->keyContainsValue(NagiosEscalationContactgroupPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosEscalationContactgroupPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosEscalationContactgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalationContactgroup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosEscalationContactgroupPeer::ID); + $selectCriteria->add(NagiosEscalationContactgroupPeer::ID, $criteria->remove(NagiosEscalationContactgroupPeer::ID), $comparison); + + } else { // $values is NagiosEscalationContactgroup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_escalation_contactgroup 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(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosEscalationContactgroupPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosEscalationContactgroup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosEscalationContactgroup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosEscalationContactgroupPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosEscalationContactgroup) { + // invalidate the cache for this single object + NagiosEscalationContactgroupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosEscalationContactgroupPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosEscalationContactgroupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosEscalationContactgroup 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 NagiosEscalationContactgroup $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(NagiosEscalationContactgroup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosEscalationContactgroupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosEscalationContactgroupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosEscalationContactgroupPeer::DATABASE_NAME, NagiosEscalationContactgroupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosEscalationContactgroup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosEscalationContactgroupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosEscalationContactgroupPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationContactgroupPeer::ID, $pk); + + $v = NagiosEscalationContactgroupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosEscalationContactgroupPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationContactgroupPeer::ID, $pks, Criteria::IN); + $objs = NagiosEscalationContactgroupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosEscalationContactgroupPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosEscalationContactgroupPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosEscalationContactgroupPeer class: +// +// Propel::getDatabaseMap(NagiosEscalationContactgroupPeer::DATABASE_NAME)->addTableBuilder(NagiosEscalationContactgroupPeer::TABLE_NAME, NagiosEscalationContactgroupPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosEscalationContactgroupPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosEscalationContactgroupPeer::TABLE_NAME, BaseNagiosEscalationContactgroupPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosEscalationPeer.php b/classes/om/BaseNagiosEscalationPeer.php new file mode 100755 index 0000000..d8f194a --- /dev/null +++ b/classes/om/BaseNagiosEscalationPeer.php @@ -0,0 +1,3130 @@ + array ('Id', 'Description', 'HostTemplate', 'Host', 'Hostgroup', 'ServiceTemplate', 'Service', 'FirstNotification', 'LastNotification', 'NotificationInterval', 'EscalationPeriod', 'EscalationOptionsUp', 'EscalationOptionsDown', 'EscalationOptionsUnreachable', 'EscalationOptionsOk', 'EscalationOptionsWarning', 'EscalationOptionsUnknown', 'EscalationOptionsCritical', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'description', 'hostTemplate', 'host', 'hostgroup', 'serviceTemplate', 'service', 'firstNotification', 'lastNotification', 'notificationInterval', 'escalationPeriod', 'escalationOptionsUp', 'escalationOptionsDown', 'escalationOptionsUnreachable', 'escalationOptionsOk', 'escalationOptionsWarning', 'escalationOptionsUnknown', 'escalationOptionsCritical', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DESCRIPTION, self::HOST_TEMPLATE, self::HOST, self::HOSTGROUP, self::SERVICE_TEMPLATE, self::SERVICE, self::FIRST_NOTIFICATION, self::LAST_NOTIFICATION, self::NOTIFICATION_INTERVAL, self::ESCALATION_PERIOD, self::ESCALATION_OPTIONS_UP, self::ESCALATION_OPTIONS_DOWN, self::ESCALATION_OPTIONS_UNREACHABLE, self::ESCALATION_OPTIONS_OK, self::ESCALATION_OPTIONS_WARNING, self::ESCALATION_OPTIONS_UNKNOWN, self::ESCALATION_OPTIONS_CRITICAL, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'description', 'host_template', 'host', 'hostgroup', 'service_template', 'service', 'first_notification', 'last_notification', 'notification_interval', 'escalation_period', 'escalation_options_up', 'escalation_options_down', 'escalation_options_unreachable', 'escalation_options_ok', 'escalation_options_warning', 'escalation_options_unknown', 'escalation_options_critical', ), + 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, 'Description' => 1, 'HostTemplate' => 2, 'Host' => 3, 'Hostgroup' => 4, 'ServiceTemplate' => 5, 'Service' => 6, 'FirstNotification' => 7, 'LastNotification' => 8, 'NotificationInterval' => 9, 'EscalationPeriod' => 10, 'EscalationOptionsUp' => 11, 'EscalationOptionsDown' => 12, 'EscalationOptionsUnreachable' => 13, 'EscalationOptionsOk' => 14, 'EscalationOptionsWarning' => 15, 'EscalationOptionsUnknown' => 16, 'EscalationOptionsCritical' => 17, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'description' => 1, 'hostTemplate' => 2, 'host' => 3, 'hostgroup' => 4, 'serviceTemplate' => 5, 'service' => 6, 'firstNotification' => 7, 'lastNotification' => 8, 'notificationInterval' => 9, 'escalationPeriod' => 10, 'escalationOptionsUp' => 11, 'escalationOptionsDown' => 12, 'escalationOptionsUnreachable' => 13, 'escalationOptionsOk' => 14, 'escalationOptionsWarning' => 15, 'escalationOptionsUnknown' => 16, 'escalationOptionsCritical' => 17, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DESCRIPTION => 1, self::HOST_TEMPLATE => 2, self::HOST => 3, self::HOSTGROUP => 4, self::SERVICE_TEMPLATE => 5, self::SERVICE => 6, self::FIRST_NOTIFICATION => 7, self::LAST_NOTIFICATION => 8, self::NOTIFICATION_INTERVAL => 9, self::ESCALATION_PERIOD => 10, self::ESCALATION_OPTIONS_UP => 11, self::ESCALATION_OPTIONS_DOWN => 12, self::ESCALATION_OPTIONS_UNREACHABLE => 13, self::ESCALATION_OPTIONS_OK => 14, self::ESCALATION_OPTIONS_WARNING => 15, self::ESCALATION_OPTIONS_UNKNOWN => 16, self::ESCALATION_OPTIONS_CRITICAL => 17, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'description' => 1, 'host_template' => 2, 'host' => 3, 'hostgroup' => 4, 'service_template' => 5, 'service' => 6, 'first_notification' => 7, 'last_notification' => 8, 'notification_interval' => 9, 'escalation_period' => 10, 'escalation_options_up' => 11, 'escalation_options_down' => 12, 'escalation_options_unreachable' => 13, 'escalation_options_ok' => 14, 'escalation_options_warning' => 15, 'escalation_options_unknown' => 16, 'escalation_options_critical' => 17, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosEscalationMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosEscalationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosEscalationPeer::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) + { + + $criteria->addSelectColumn(NagiosEscalationPeer::ID); + + $criteria->addSelectColumn(NagiosEscalationPeer::DESCRIPTION); + + $criteria->addSelectColumn(NagiosEscalationPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosEscalationPeer::HOST); + + $criteria->addSelectColumn(NagiosEscalationPeer::HOSTGROUP); + + $criteria->addSelectColumn(NagiosEscalationPeer::SERVICE_TEMPLATE); + + $criteria->addSelectColumn(NagiosEscalationPeer::SERVICE); + + $criteria->addSelectColumn(NagiosEscalationPeer::FIRST_NOTIFICATION); + + $criteria->addSelectColumn(NagiosEscalationPeer::LAST_NOTIFICATION); + + $criteria->addSelectColumn(NagiosEscalationPeer::NOTIFICATION_INTERVAL); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_PERIOD); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_UP); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_DOWN); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_UNREACHABLE); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_OK); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_WARNING); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_UNKNOWN); + + $criteria->addSelectColumn(NagiosEscalationPeer::ESCALATION_OPTIONS_CRITICAL); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosEscalation + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosEscalationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosEscalationPeer::populateObjects(NagiosEscalationPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosEscalationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosEscalation $value A NagiosEscalation object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosEscalation $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosEscalation object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosEscalation) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosEscalation object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosEscalation Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosEscalationPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosEscalationPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosEscalationPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosHost) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosService) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosHostgroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostgroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostgroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostgroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosHostgroup) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosEscalation($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + } // if joined row not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosEscalation($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosEscalation($obj1); + } // if joined row not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosService) + $obj5->addNagiosEscalation($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostgroup rows + + $key6 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosHostgroupPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosHostgroupPeer::addInstanceToPool($obj6, $key6); + } // if obj6 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosHostgroup) + $obj6->addNagiosEscalation($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if obj7 loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosEscalation($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosEscalationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosEscalationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosService) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosService) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key4 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServicePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServicePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosService) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key5 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosHostgroupPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosHostgroupPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosHostgroup) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosHostgroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::ESCALATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosService) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosTimeperiod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosEscalation objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosEscalationPeer::addSelectColumns($c); + $startcol2 = (NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosEscalationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosEscalationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosEscalationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosService rows + + $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosServicePeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosServicePeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosService) + $obj5->addNagiosEscalation($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key6 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosHostgroupPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosHostgroupPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosHostgroup) + $obj6->addNagiosEscalation($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosEscalationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosEscalation or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalation object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosEscalation object + } + + if ($criteria->containsKey(NagiosEscalationPeer::ID) && $criteria->keyContainsValue(NagiosEscalationPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosEscalationPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosEscalation or Criteria object. + * + * @param mixed $values Criteria or NagiosEscalation object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosEscalationPeer::ID); + $selectCriteria->add(NagiosEscalationPeer::ID, $criteria->remove(NagiosEscalationPeer::ID), $comparison); + + } else { // $values is NagiosEscalation object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_escalation 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(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosEscalationPeer::doOnDeleteCascade(new Criteria(NagiosEscalationPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosEscalationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosEscalation or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosEscalation object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosEscalationPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosEscalation) { + // invalidate the cache for this single object + NagiosEscalationPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosEscalationPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosEscalationPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosEscalationPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosEscalationPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosEscalationPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosEscalationContactPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationContactPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationContactgroupPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationContactgroupPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosEscalationPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosEscalationContact objects + $c = new Criteria(NagiosEscalationContactPeer::DATABASE_NAME); + + $c->add(NagiosEscalationContactPeer::ESCALATION, $obj->getId()); + $affectedRows += NagiosEscalationContactPeer::doDelete($c, $con); + + // delete related NagiosEscalationContactgroup objects + $c = new Criteria(NagiosEscalationContactgroupPeer::DATABASE_NAME); + + $c->add(NagiosEscalationContactgroupPeer::ESCALATION, $obj->getId()); + $affectedRows += NagiosEscalationContactgroupPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosEscalation 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 NagiosEscalation $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(NagiosEscalation $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosEscalationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosEscalationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosEscalationPeer::DATABASE_NAME, NagiosEscalationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosEscalation + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosEscalationPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationPeer::ID, $pk); + + $v = NagiosEscalationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosEscalationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + $criteria->add(NagiosEscalationPeer::ID, $pks, Criteria::IN); + $objs = NagiosEscalationPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosEscalationPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosEscalationPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosEscalationPeer class: +// +// Propel::getDatabaseMap(NagiosEscalationPeer::DATABASE_NAME)->addTableBuilder(NagiosEscalationPeer::TABLE_NAME, NagiosEscalationPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosEscalationPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosEscalationPeer::TABLE_NAME, BaseNagiosEscalationPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHost.php b/classes/om/BaseNagiosHost.php new file mode 100755 index 0000000..b40889f --- /dev/null +++ b/classes/om/BaseNagiosHost.php @@ -0,0 +1,7149 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Get the [display_name] column value. + * + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Get the [initial_state] column value. + * + * @return string + */ + public function getInitialState() + { + return $this->initial_state; + } + + /** + * Get the [address] column value. + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Get the [check_command] column value. + * + * @return int + */ + public function getCheckCommand() + { + return $this->check_command; + } + + /** + * Get the [retry_interval] column value. + * + * @return int + */ + public function getRetryInterval() + { + return $this->retry_interval; + } + + /** + * Get the [first_notification_delay] column value. + * + * @return int + */ + public function getFirstNotificationDelay() + { + return $this->first_notification_delay; + } + + /** + * Get the [maximum_check_attempts] column value. + * + * @return int + */ + public function getMaximumCheckAttempts() + { + return $this->maximum_check_attempts; + } + + /** + * Get the [check_interval] column value. + * + * @return int + */ + public function getCheckInterval() + { + return $this->check_interval; + } + + /** + * Get the [passive_checks_enabled] column value. + * + * @return boolean + */ + public function getPassiveChecksEnabled() + { + return $this->passive_checks_enabled; + } + + /** + * Get the [check_period] column value. + * + * @return int + */ + public function getCheckPeriod() + { + return $this->check_period; + } + + /** + * Get the [obsess_over_host] column value. + * + * @return boolean + */ + public function getObsessOverHost() + { + return $this->obsess_over_host; + } + + /** + * Get the [check_freshness] column value. + * + * @return boolean + */ + public function getCheckFreshness() + { + return $this->check_freshness; + } + + /** + * Get the [freshness_threshold] column value. + * + * @return int + */ + public function getFreshnessThreshold() + { + return $this->freshness_threshold; + } + + /** + * Get the [active_checks_enabled] column value. + * + * @return boolean + */ + public function getActiveChecksEnabled() + { + return $this->active_checks_enabled; + } + + /** + * Get the [checks_enabled] column value. + * + * @return boolean + */ + public function getChecksEnabled() + { + return $this->checks_enabled; + } + + /** + * Get the [event_handler] column value. + * + * @return int + */ + public function getEventHandler() + { + return $this->event_handler; + } + + /** + * Get the [event_handler_enabled] column value. + * + * @return boolean + */ + public function getEventHandlerEnabled() + { + return $this->event_handler_enabled; + } + + /** + * Get the [low_flap_threshold] column value. + * + * @return int + */ + public function getLowFlapThreshold() + { + return $this->low_flap_threshold; + } + + /** + * Get the [high_flap_threshold] column value. + * + * @return int + */ + public function getHighFlapThreshold() + { + return $this->high_flap_threshold; + } + + /** + * Get the [flap_detection_enabled] column value. + * + * @return boolean + */ + public function getFlapDetectionEnabled() + { + return $this->flap_detection_enabled; + } + + /** + * Get the [process_perf_data] column value. + * + * @return boolean + */ + public function getProcessPerfData() + { + return $this->process_perf_data; + } + + /** + * Get the [retain_status_information] column value. + * + * @return boolean + */ + public function getRetainStatusInformation() + { + return $this->retain_status_information; + } + + /** + * Get the [retain_nonstatus_information] column value. + * + * @return boolean + */ + public function getRetainNonstatusInformation() + { + return $this->retain_nonstatus_information; + } + + /** + * Get the [notification_interval] column value. + * + * @return int + */ + public function getNotificationInterval() + { + return $this->notification_interval; + } + + /** + * Get the [notification_period] column value. + * + * @return int + */ + public function getNotificationPeriod() + { + return $this->notification_period; + } + + /** + * Get the [notifications_enabled] column value. + * + * @return boolean + */ + public function getNotificationsEnabled() + { + return $this->notifications_enabled; + } + + /** + * Get the [notification_on_down] column value. + * + * @return boolean + */ + public function getNotificationOnDown() + { + return $this->notification_on_down; + } + + /** + * Get the [notification_on_unreachable] column value. + * + * @return boolean + */ + public function getNotificationOnUnreachable() + { + return $this->notification_on_unreachable; + } + + /** + * Get the [notification_on_recovery] column value. + * + * @return boolean + */ + public function getNotificationOnRecovery() + { + return $this->notification_on_recovery; + } + + /** + * Get the [notification_on_flapping] column value. + * + * @return boolean + */ + public function getNotificationOnFlapping() + { + return $this->notification_on_flapping; + } + + /** + * Get the [notification_on_scheduled_downtime] column value. + * + * @return boolean + */ + public function getNotificationOnScheduledDowntime() + { + return $this->notification_on_scheduled_downtime; + } + + /** + * Get the [stalking_on_up] column value. + * + * @return boolean + */ + public function getStalkingOnUp() + { + return $this->stalking_on_up; + } + + /** + * Get the [stalking_on_down] column value. + * + * @return boolean + */ + public function getStalkingOnDown() + { + return $this->stalking_on_down; + } + + /** + * Get the [stalking_on_unreachable] column value. + * + * @return boolean + */ + public function getStalkingOnUnreachable() + { + return $this->stalking_on_unreachable; + } + + /** + * Get the [failure_prediction_enabled] column value. + * + * @return boolean + */ + public function getFailurePredictionEnabled() + { + return $this->failure_prediction_enabled; + } + + /** + * Get the [flap_detection_on_up] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUp() + { + return $this->flap_detection_on_up; + } + + /** + * Get the [flap_detection_on_down] column value. + * + * @return boolean + */ + public function getFlapDetectionOnDown() + { + return $this->flap_detection_on_down; + } + + /** + * Get the [flap_detection_on_unreachable] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUnreachable() + { + return $this->flap_detection_on_unreachable; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Get the [icon_image] column value. + * + * @return string + */ + public function getIconImage() + { + return $this->icon_image; + } + + /** + * Get the [icon_image_alt] column value. + * + * @return string + */ + public function getIconImageAlt() + { + return $this->icon_image_alt; + } + + /** + * Get the [vrml_image] column value. + * + * @return string + */ + public function getVrmlImage() + { + return $this->vrml_image; + } + + /** + * Get the [statusmap_image] column value. + * + * @return string + */ + public function getStatusmapImage() + { + return $this->statusmap_image; + } + + /** + * Get the [two_d_coords] column value. + * + * @return string + */ + public function getTwoDCoords() + { + return $this->two_d_coords; + } + + /** + * Get the [three_d_coords] column value. + * + * @return string + */ + public function getThreeDCoords() + { + return $this->three_d_coords; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosHostPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosHostPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Set the value of [display_name] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setDisplayName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->display_name !== $v) { + $this->display_name = $v; + $this->modifiedColumns[] = NagiosHostPeer::DISPLAY_NAME; + } + + return $this; + } // setDisplayName() + + /** + * Set the value of [initial_state] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setInitialState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->initial_state !== $v) { + $this->initial_state = $v; + $this->modifiedColumns[] = NagiosHostPeer::INITIAL_STATE; + } + + return $this; + } // setInitialState() + + /** + * Set the value of [address] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setAddress($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address !== $v) { + $this->address = $v; + $this->modifiedColumns[] = NagiosHostPeer::ADDRESS; + } + + return $this; + } // setAddress() + + /** + * Set the value of [check_command] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setCheckCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_command !== $v) { + $this->check_command = $v; + $this->modifiedColumns[] = NagiosHostPeer::CHECK_COMMAND; + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->aNagiosCommandRelatedByCheckCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + + return $this; + } // setCheckCommand() + + /** + * Set the value of [retry_interval] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setRetryInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retry_interval !== $v) { + $this->retry_interval = $v; + $this->modifiedColumns[] = NagiosHostPeer::RETRY_INTERVAL; + } + + return $this; + } // setRetryInterval() + + /** + * Set the value of [first_notification_delay] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFirstNotificationDelay($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->first_notification_delay !== $v) { + $this->first_notification_delay = $v; + $this->modifiedColumns[] = NagiosHostPeer::FIRST_NOTIFICATION_DELAY; + } + + return $this; + } // setFirstNotificationDelay() + + /** + * Set the value of [maximum_check_attempts] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setMaximumCheckAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->maximum_check_attempts !== $v) { + $this->maximum_check_attempts = $v; + $this->modifiedColumns[] = NagiosHostPeer::MAXIMUM_CHECK_ATTEMPTS; + } + + return $this; + } // setMaximumCheckAttempts() + + /** + * Set the value of [check_interval] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_interval !== $v) { + $this->check_interval = $v; + $this->modifiedColumns[] = NagiosHostPeer::CHECK_INTERVAL; + } + + return $this; + } // setCheckInterval() + + /** + * Set the value of [passive_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setPassiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->passive_checks_enabled !== $v) { + $this->passive_checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::PASSIVE_CHECKS_ENABLED; + } + + return $this; + } // setPassiveChecksEnabled() + + /** + * Set the value of [check_period] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setCheckPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_period !== $v) { + $this->check_period = $v; + $this->modifiedColumns[] = NagiosHostPeer::CHECK_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->aNagiosTimeperiodRelatedByCheckPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + + return $this; + } // setCheckPeriod() + + /** + * Set the value of [obsess_over_host] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setObsessOverHost($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_host !== $v) { + $this->obsess_over_host = $v; + $this->modifiedColumns[] = NagiosHostPeer::OBSESS_OVER_HOST; + } + + return $this; + } // setObsessOverHost() + + /** + * Set the value of [check_freshness] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setCheckFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_freshness !== $v) { + $this->check_freshness = $v; + $this->modifiedColumns[] = NagiosHostPeer::CHECK_FRESHNESS; + } + + return $this; + } // setCheckFreshness() + + /** + * Set the value of [freshness_threshold] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFreshnessThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->freshness_threshold !== $v) { + $this->freshness_threshold = $v; + $this->modifiedColumns[] = NagiosHostPeer::FRESHNESS_THRESHOLD; + } + + return $this; + } // setFreshnessThreshold() + + /** + * Set the value of [active_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setActiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->active_checks_enabled !== $v) { + $this->active_checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::ACTIVE_CHECKS_ENABLED; + } + + return $this; + } // setActiveChecksEnabled() + + /** + * Set the value of [checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->checks_enabled !== $v) { + $this->checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::CHECKS_ENABLED; + } + + return $this; + } // setChecksEnabled() + + /** + * Set the value of [event_handler] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->event_handler !== $v) { + $this->event_handler = $v; + $this->modifiedColumns[] = NagiosHostPeer::EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->aNagiosCommandRelatedByEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + + return $this; + } // setEventHandler() + + /** + * Set the value of [event_handler_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setEventHandlerEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->event_handler_enabled !== $v) { + $this->event_handler_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::EVENT_HANDLER_ENABLED; + } + + return $this; + } // setEventHandlerEnabled() + + /** + * Set the value of [low_flap_threshold] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setLowFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->low_flap_threshold !== $v) { + $this->low_flap_threshold = $v; + $this->modifiedColumns[] = NagiosHostPeer::LOW_FLAP_THRESHOLD; + } + + return $this; + } // setLowFlapThreshold() + + /** + * Set the value of [high_flap_threshold] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setHighFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->high_flap_threshold !== $v) { + $this->high_flap_threshold = $v; + $this->modifiedColumns[] = NagiosHostPeer::HIGH_FLAP_THRESHOLD; + } + + return $this; + } // setHighFlapThreshold() + + /** + * Set the value of [flap_detection_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFlapDetectionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_enabled !== $v) { + $this->flap_detection_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::FLAP_DETECTION_ENABLED; + } + + return $this; + } // setFlapDetectionEnabled() + + /** + * Set the value of [process_perf_data] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setProcessPerfData($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->process_perf_data !== $v) { + $this->process_perf_data = $v; + $this->modifiedColumns[] = NagiosHostPeer::PROCESS_PERF_DATA; + } + + return $this; + } // setProcessPerfData() + + /** + * Set the value of [retain_status_information] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setRetainStatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_status_information !== $v) { + $this->retain_status_information = $v; + $this->modifiedColumns[] = NagiosHostPeer::RETAIN_STATUS_INFORMATION; + } + + return $this; + } // setRetainStatusInformation() + + /** + * Set the value of [retain_nonstatus_information] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setRetainNonstatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_nonstatus_information !== $v) { + $this->retain_nonstatus_information = $v; + $this->modifiedColumns[] = NagiosHostPeer::RETAIN_NONSTATUS_INFORMATION; + } + + return $this; + } // setRetainNonstatusInformation() + + /** + * Set the value of [notification_interval] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_interval !== $v) { + $this->notification_interval = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_INTERVAL; + } + + return $this; + } // setNotificationInterval() + + /** + * Set the value of [notification_period] column. + * + * @param int $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_period !== $v) { + $this->notification_period = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + + return $this; + } // setNotificationPeriod() + + /** + * Set the value of [notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notifications_enabled !== $v) { + $this->notifications_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATIONS_ENABLED; + } + + return $this; + } // setNotificationsEnabled() + + /** + * Set the value of [notification_on_down] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_down !== $v) { + $this->notification_on_down = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_ON_DOWN; + } + + return $this; + } // setNotificationOnDown() + + /** + * Set the value of [notification_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_unreachable !== $v) { + $this->notification_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_ON_UNREACHABLE; + } + + return $this; + } // setNotificationOnUnreachable() + + /** + * Set the value of [notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_recovery !== $v) { + $this->notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setNotificationOnRecovery() + + /** + * Set the value of [notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_flapping !== $v) { + $this->notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setNotificationOnFlapping() + + /** + * Set the value of [notification_on_scheduled_downtime] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotificationOnScheduledDowntime($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_scheduled_downtime !== $v) { + $this->notification_on_scheduled_downtime = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME; + } + + return $this; + } // setNotificationOnScheduledDowntime() + + /** + * Set the value of [stalking_on_up] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setStalkingOnUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_up !== $v) { + $this->stalking_on_up = $v; + $this->modifiedColumns[] = NagiosHostPeer::STALKING_ON_UP; + } + + return $this; + } // setStalkingOnUp() + + /** + * Set the value of [stalking_on_down] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setStalkingOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_down !== $v) { + $this->stalking_on_down = $v; + $this->modifiedColumns[] = NagiosHostPeer::STALKING_ON_DOWN; + } + + return $this; + } // setStalkingOnDown() + + /** + * Set the value of [stalking_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setStalkingOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_unreachable !== $v) { + $this->stalking_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostPeer::STALKING_ON_UNREACHABLE; + } + + return $this; + } // setStalkingOnUnreachable() + + /** + * Set the value of [failure_prediction_enabled] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFailurePredictionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->failure_prediction_enabled !== $v) { + $this->failure_prediction_enabled = $v; + $this->modifiedColumns[] = NagiosHostPeer::FAILURE_PREDICTION_ENABLED; + } + + return $this; + } // setFailurePredictionEnabled() + + /** + * Set the value of [flap_detection_on_up] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFlapDetectionOnUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_up !== $v) { + $this->flap_detection_on_up = $v; + $this->modifiedColumns[] = NagiosHostPeer::FLAP_DETECTION_ON_UP; + } + + return $this; + } // setFlapDetectionOnUp() + + /** + * Set the value of [flap_detection_on_down] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFlapDetectionOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_down !== $v) { + $this->flap_detection_on_down = $v; + $this->modifiedColumns[] = NagiosHostPeer::FLAP_DETECTION_ON_DOWN; + } + + return $this; + } // setFlapDetectionOnDown() + + /** + * Set the value of [flap_detection_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setFlapDetectionOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_unreachable !== $v) { + $this->flap_detection_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostPeer::FLAP_DETECTION_ON_UNREACHABLE; + } + + return $this; + } // setFlapDetectionOnUnreachable() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosHostPeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosHostPeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Set the value of [icon_image] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setIconImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image !== $v) { + $this->icon_image = $v; + $this->modifiedColumns[] = NagiosHostPeer::ICON_IMAGE; + } + + return $this; + } // setIconImage() + + /** + * Set the value of [icon_image_alt] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setIconImageAlt($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image_alt !== $v) { + $this->icon_image_alt = $v; + $this->modifiedColumns[] = NagiosHostPeer::ICON_IMAGE_ALT; + } + + return $this; + } // setIconImageAlt() + + /** + * Set the value of [vrml_image] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setVrmlImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->vrml_image !== $v) { + $this->vrml_image = $v; + $this->modifiedColumns[] = NagiosHostPeer::VRML_IMAGE; + } + + return $this; + } // setVrmlImage() + + /** + * Set the value of [statusmap_image] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setStatusmapImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->statusmap_image !== $v) { + $this->statusmap_image = $v; + $this->modifiedColumns[] = NagiosHostPeer::STATUSMAP_IMAGE; + } + + return $this; + } // setStatusmapImage() + + /** + * Set the value of [two_d_coords] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setTwoDCoords($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->two_d_coords !== $v) { + $this->two_d_coords = $v; + $this->modifiedColumns[] = NagiosHostPeer::TWO_D_COORDS; + } + + return $this; + } // setTwoDCoords() + + /** + * Set the value of [three_d_coords] column. + * + * @param string $v new value + * @return NagiosHost The current object (for fluent API support) + */ + public function setThreeDCoords($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->three_d_coords !== $v) { + $this->three_d_coords = $v; + $this->modifiedColumns[] = NagiosHostPeer::THREE_D_COORDS; + } + + return $this; + } // setThreeDCoords() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->display_name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->initial_state = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->address = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->check_command = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->retry_interval = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->first_notification_delay = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->maximum_check_attempts = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->check_interval = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->passive_checks_enabled = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->check_period = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null; + $this->obsess_over_host = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->check_freshness = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->freshness_threshold = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null; + $this->active_checks_enabled = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null; + $this->checks_enabled = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->event_handler = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null; + $this->event_handler_enabled = ($row[$startcol + 19] !== null) ? (boolean) $row[$startcol + 19] : null; + $this->low_flap_threshold = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null; + $this->high_flap_threshold = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null; + $this->flap_detection_enabled = ($row[$startcol + 22] !== null) ? (boolean) $row[$startcol + 22] : null; + $this->process_perf_data = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; + $this->retain_status_information = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; + $this->retain_nonstatus_information = ($row[$startcol + 25] !== null) ? (boolean) $row[$startcol + 25] : null; + $this->notification_interval = ($row[$startcol + 26] !== null) ? (int) $row[$startcol + 26] : null; + $this->notification_period = ($row[$startcol + 27] !== null) ? (int) $row[$startcol + 27] : null; + $this->notifications_enabled = ($row[$startcol + 28] !== null) ? (boolean) $row[$startcol + 28] : null; + $this->notification_on_down = ($row[$startcol + 29] !== null) ? (boolean) $row[$startcol + 29] : null; + $this->notification_on_unreachable = ($row[$startcol + 30] !== null) ? (boolean) $row[$startcol + 30] : null; + $this->notification_on_recovery = ($row[$startcol + 31] !== null) ? (boolean) $row[$startcol + 31] : null; + $this->notification_on_flapping = ($row[$startcol + 32] !== null) ? (boolean) $row[$startcol + 32] : null; + $this->notification_on_scheduled_downtime = ($row[$startcol + 33] !== null) ? (boolean) $row[$startcol + 33] : null; + $this->stalking_on_up = ($row[$startcol + 34] !== null) ? (boolean) $row[$startcol + 34] : null; + $this->stalking_on_down = ($row[$startcol + 35] !== null) ? (boolean) $row[$startcol + 35] : null; + $this->stalking_on_unreachable = ($row[$startcol + 36] !== null) ? (boolean) $row[$startcol + 36] : null; + $this->failure_prediction_enabled = ($row[$startcol + 37] !== null) ? (boolean) $row[$startcol + 37] : null; + $this->flap_detection_on_up = ($row[$startcol + 38] !== null) ? (boolean) $row[$startcol + 38] : null; + $this->flap_detection_on_down = ($row[$startcol + 39] !== null) ? (boolean) $row[$startcol + 39] : null; + $this->flap_detection_on_unreachable = ($row[$startcol + 40] !== null) ? (boolean) $row[$startcol + 40] : null; + $this->notes = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null; + $this->notes_url = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null; + $this->action_url = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null; + $this->icon_image = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null; + $this->icon_image_alt = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null; + $this->vrml_image = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; + $this->statusmap_image = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; + $this->two_d_coords = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null; + $this->three_d_coords = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 50; // 50 = NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHost object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->check_command !== $this->aNagiosCommandRelatedByCheckCommand->getId()) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->check_period !== $this->aNagiosTimeperiodRelatedByCheckPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->event_handler !== $this->aNagiosCommandRelatedByEventHandler->getId()) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->notification_period !== $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + $this->collNagiosServices = null; + $this->lastNagiosServiceCriteria = null; + + $this->collNagiosHostContactMembers = null; + $this->lastNagiosHostContactMemberCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosDependencyTargets = null; + $this->lastNagiosDependencyTargetCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + $this->collNagiosHostContactgroups = null; + $this->lastNagiosHostContactgroupCriteria = null; + + $this->collNagiosHostgroupMemberships = null; + $this->lastNagiosHostgroupMembershipCriteria = null; + + $this->collNagiosHostCheckCommandParameters = null; + $this->lastNagiosHostCheckCommandParameterCriteria = null; + + $this->collNagiosHostParentsRelatedByChildHost = null; + $this->lastNagiosHostParentRelatedByChildHostCriteria = null; + + $this->collNagiosHostParentsRelatedByParentHost = null; + $this->lastNagiosHostParentRelatedByParentHostCriteria = null; + + $this->collNagiosHostTemplateInheritances = null; + $this->lastNagiosHostTemplateInheritanceCriteria = null; + + $this->collAutodiscoveryDevices = null; + $this->lastAutodiscoveryDeviceCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosCommandRelatedByCheckCommand !== null) { + if ($this->aNagiosCommandRelatedByCheckCommand->isModified() || $this->aNagiosCommandRelatedByCheckCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByCheckCommand->save($con); + } + $this->setNagiosCommandRelatedByCheckCommand($this->aNagiosCommandRelatedByCheckCommand); + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if ($this->aNagiosCommandRelatedByEventHandler->isModified() || $this->aNagiosCommandRelatedByEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByEventHandler->save($con); + } + $this->setNagiosCommandRelatedByEventHandler($this->aNagiosCommandRelatedByEventHandler); + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod->isModified() || $this->aNagiosTimeperiodRelatedByCheckPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByCheckPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByCheckPeriod($this->aNagiosTimeperiodRelatedByCheckPeriod); + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByNotificationPeriod($this->aNagiosTimeperiodRelatedByNotificationPeriod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostCheckCommandParameters !== null) { + foreach ($this->collNagiosHostCheckCommandParameters as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostParentsRelatedByChildHost !== null) { + foreach ($this->collNagiosHostParentsRelatedByChildHost as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostParentsRelatedByParentHost !== null) { + foreach ($this->collNagiosHostParentsRelatedByParentHost as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplateInheritances !== null) { + foreach ($this->collNagiosHostTemplateInheritances as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosCommandRelatedByCheckCommand !== null) { + if (!$this->aNagiosCommandRelatedByCheckCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByCheckCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByEventHandler->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByCheckPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByCheckPeriod->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByNotificationPeriod->getValidationFailures()); + } + } + + + if (($retval = NagiosHostPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostCheckCommandParameters !== null) { + foreach ($this->collNagiosHostCheckCommandParameters as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostParentsRelatedByChildHost !== null) { + foreach ($this->collNagiosHostParentsRelatedByChildHost as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostParentsRelatedByParentHost !== null) { + foreach ($this->collNagiosHostParentsRelatedByParentHost as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplateInheritances !== null) { + foreach ($this->collNagiosHostTemplateInheritances as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + case 3: + return $this->getDisplayName(); + break; + case 4: + return $this->getInitialState(); + break; + case 5: + return $this->getAddress(); + break; + case 6: + return $this->getCheckCommand(); + break; + case 7: + return $this->getRetryInterval(); + break; + case 8: + return $this->getFirstNotificationDelay(); + break; + case 9: + return $this->getMaximumCheckAttempts(); + break; + case 10: + return $this->getCheckInterval(); + break; + case 11: + return $this->getPassiveChecksEnabled(); + break; + case 12: + return $this->getCheckPeriod(); + break; + case 13: + return $this->getObsessOverHost(); + break; + case 14: + return $this->getCheckFreshness(); + break; + case 15: + return $this->getFreshnessThreshold(); + break; + case 16: + return $this->getActiveChecksEnabled(); + break; + case 17: + return $this->getChecksEnabled(); + break; + case 18: + return $this->getEventHandler(); + break; + case 19: + return $this->getEventHandlerEnabled(); + break; + case 20: + return $this->getLowFlapThreshold(); + break; + case 21: + return $this->getHighFlapThreshold(); + break; + case 22: + return $this->getFlapDetectionEnabled(); + break; + case 23: + return $this->getProcessPerfData(); + break; + case 24: + return $this->getRetainStatusInformation(); + break; + case 25: + return $this->getRetainNonstatusInformation(); + break; + case 26: + return $this->getNotificationInterval(); + break; + case 27: + return $this->getNotificationPeriod(); + break; + case 28: + return $this->getNotificationsEnabled(); + break; + case 29: + return $this->getNotificationOnDown(); + break; + case 30: + return $this->getNotificationOnUnreachable(); + break; + case 31: + return $this->getNotificationOnRecovery(); + break; + case 32: + return $this->getNotificationOnFlapping(); + break; + case 33: + return $this->getNotificationOnScheduledDowntime(); + break; + case 34: + return $this->getStalkingOnUp(); + break; + case 35: + return $this->getStalkingOnDown(); + break; + case 36: + return $this->getStalkingOnUnreachable(); + break; + case 37: + return $this->getFailurePredictionEnabled(); + break; + case 38: + return $this->getFlapDetectionOnUp(); + break; + case 39: + return $this->getFlapDetectionOnDown(); + break; + case 40: + return $this->getFlapDetectionOnUnreachable(); + break; + case 41: + return $this->getNotes(); + break; + case 42: + return $this->getNotesUrl(); + break; + case 43: + return $this->getActionUrl(); + break; + case 44: + return $this->getIconImage(); + break; + case 45: + return $this->getIconImageAlt(); + break; + case 46: + return $this->getVrmlImage(); + break; + case 47: + return $this->getStatusmapImage(); + break; + case 48: + return $this->getTwoDCoords(); + break; + case 49: + return $this->getThreeDCoords(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + $keys[3] => $this->getDisplayName(), + $keys[4] => $this->getInitialState(), + $keys[5] => $this->getAddress(), + $keys[6] => $this->getCheckCommand(), + $keys[7] => $this->getRetryInterval(), + $keys[8] => $this->getFirstNotificationDelay(), + $keys[9] => $this->getMaximumCheckAttempts(), + $keys[10] => $this->getCheckInterval(), + $keys[11] => $this->getPassiveChecksEnabled(), + $keys[12] => $this->getCheckPeriod(), + $keys[13] => $this->getObsessOverHost(), + $keys[14] => $this->getCheckFreshness(), + $keys[15] => $this->getFreshnessThreshold(), + $keys[16] => $this->getActiveChecksEnabled(), + $keys[17] => $this->getChecksEnabled(), + $keys[18] => $this->getEventHandler(), + $keys[19] => $this->getEventHandlerEnabled(), + $keys[20] => $this->getLowFlapThreshold(), + $keys[21] => $this->getHighFlapThreshold(), + $keys[22] => $this->getFlapDetectionEnabled(), + $keys[23] => $this->getProcessPerfData(), + $keys[24] => $this->getRetainStatusInformation(), + $keys[25] => $this->getRetainNonstatusInformation(), + $keys[26] => $this->getNotificationInterval(), + $keys[27] => $this->getNotificationPeriod(), + $keys[28] => $this->getNotificationsEnabled(), + $keys[29] => $this->getNotificationOnDown(), + $keys[30] => $this->getNotificationOnUnreachable(), + $keys[31] => $this->getNotificationOnRecovery(), + $keys[32] => $this->getNotificationOnFlapping(), + $keys[33] => $this->getNotificationOnScheduledDowntime(), + $keys[34] => $this->getStalkingOnUp(), + $keys[35] => $this->getStalkingOnDown(), + $keys[36] => $this->getStalkingOnUnreachable(), + $keys[37] => $this->getFailurePredictionEnabled(), + $keys[38] => $this->getFlapDetectionOnUp(), + $keys[39] => $this->getFlapDetectionOnDown(), + $keys[40] => $this->getFlapDetectionOnUnreachable(), + $keys[41] => $this->getNotes(), + $keys[42] => $this->getNotesUrl(), + $keys[43] => $this->getActionUrl(), + $keys[44] => $this->getIconImage(), + $keys[45] => $this->getIconImageAlt(), + $keys[46] => $this->getVrmlImage(), + $keys[47] => $this->getStatusmapImage(), + $keys[48] => $this->getTwoDCoords(), + $keys[49] => $this->getThreeDCoords(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($value); + break; + case 3: + $this->setDisplayName($value); + break; + case 4: + $this->setInitialState($value); + break; + case 5: + $this->setAddress($value); + break; + case 6: + $this->setCheckCommand($value); + break; + case 7: + $this->setRetryInterval($value); + break; + case 8: + $this->setFirstNotificationDelay($value); + break; + case 9: + $this->setMaximumCheckAttempts($value); + break; + case 10: + $this->setCheckInterval($value); + break; + case 11: + $this->setPassiveChecksEnabled($value); + break; + case 12: + $this->setCheckPeriod($value); + break; + case 13: + $this->setObsessOverHost($value); + break; + case 14: + $this->setCheckFreshness($value); + break; + case 15: + $this->setFreshnessThreshold($value); + break; + case 16: + $this->setActiveChecksEnabled($value); + break; + case 17: + $this->setChecksEnabled($value); + break; + case 18: + $this->setEventHandler($value); + break; + case 19: + $this->setEventHandlerEnabled($value); + break; + case 20: + $this->setLowFlapThreshold($value); + break; + case 21: + $this->setHighFlapThreshold($value); + break; + case 22: + $this->setFlapDetectionEnabled($value); + break; + case 23: + $this->setProcessPerfData($value); + break; + case 24: + $this->setRetainStatusInformation($value); + break; + case 25: + $this->setRetainNonstatusInformation($value); + break; + case 26: + $this->setNotificationInterval($value); + break; + case 27: + $this->setNotificationPeriod($value); + break; + case 28: + $this->setNotificationsEnabled($value); + break; + case 29: + $this->setNotificationOnDown($value); + break; + case 30: + $this->setNotificationOnUnreachable($value); + break; + case 31: + $this->setNotificationOnRecovery($value); + break; + case 32: + $this->setNotificationOnFlapping($value); + break; + case 33: + $this->setNotificationOnScheduledDowntime($value); + break; + case 34: + $this->setStalkingOnUp($value); + break; + case 35: + $this->setStalkingOnDown($value); + break; + case 36: + $this->setStalkingOnUnreachable($value); + break; + case 37: + $this->setFailurePredictionEnabled($value); + break; + case 38: + $this->setFlapDetectionOnUp($value); + break; + case 39: + $this->setFlapDetectionOnDown($value); + break; + case 40: + $this->setFlapDetectionOnUnreachable($value); + break; + case 41: + $this->setNotes($value); + break; + case 42: + $this->setNotesUrl($value); + break; + case 43: + $this->setActionUrl($value); + break; + case 44: + $this->setIconImage($value); + break; + case 45: + $this->setIconImageAlt($value); + break; + case 46: + $this->setVrmlImage($value); + break; + case 47: + $this->setStatusmapImage($value); + break; + case 48: + $this->setTwoDCoords($value); + break; + case 49: + $this->setThreeDCoords($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDisplayName($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setInitialState($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setAddress($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setCheckCommand($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setRetryInterval($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setFirstNotificationDelay($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setMaximumCheckAttempts($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCheckInterval($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setPassiveChecksEnabled($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCheckPeriod($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setObsessOverHost($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setCheckFreshness($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setFreshnessThreshold($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setActiveChecksEnabled($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setChecksEnabled($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setEventHandler($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setEventHandlerEnabled($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setLowFlapThreshold($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setHighFlapThreshold($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setFlapDetectionEnabled($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setProcessPerfData($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setRetainStatusInformation($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setRetainNonstatusInformation($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setNotificationInterval($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setNotificationPeriod($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setNotificationsEnabled($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setNotificationOnDown($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setNotificationOnUnreachable($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setNotificationOnRecovery($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setNotificationOnFlapping($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setNotificationOnScheduledDowntime($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setStalkingOnUp($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setStalkingOnDown($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setStalkingOnUnreachable($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setFailurePredictionEnabled($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setFlapDetectionOnUp($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setFlapDetectionOnDown($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setFlapDetectionOnUnreachable($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setNotes($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setNotesUrl($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setActionUrl($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setIconImage($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setIconImageAlt($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setVrmlImage($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setStatusmapImage($arr[$keys[47]]); + if (array_key_exists($keys[48], $arr)) $this->setTwoDCoords($arr[$keys[48]]); + if (array_key_exists($keys[49], $arr)) $this->setThreeDCoords($arr[$keys[49]]); + } + + /** + * 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(NagiosHostPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostPeer::ID)) $criteria->add(NagiosHostPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostPeer::NAME)) $criteria->add(NagiosHostPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosHostPeer::ALIAS)) $criteria->add(NagiosHostPeer::ALIAS, $this->alias); + if ($this->isColumnModified(NagiosHostPeer::DISPLAY_NAME)) $criteria->add(NagiosHostPeer::DISPLAY_NAME, $this->display_name); + if ($this->isColumnModified(NagiosHostPeer::INITIAL_STATE)) $criteria->add(NagiosHostPeer::INITIAL_STATE, $this->initial_state); + if ($this->isColumnModified(NagiosHostPeer::ADDRESS)) $criteria->add(NagiosHostPeer::ADDRESS, $this->address); + if ($this->isColumnModified(NagiosHostPeer::CHECK_COMMAND)) $criteria->add(NagiosHostPeer::CHECK_COMMAND, $this->check_command); + if ($this->isColumnModified(NagiosHostPeer::RETRY_INTERVAL)) $criteria->add(NagiosHostPeer::RETRY_INTERVAL, $this->retry_interval); + if ($this->isColumnModified(NagiosHostPeer::FIRST_NOTIFICATION_DELAY)) $criteria->add(NagiosHostPeer::FIRST_NOTIFICATION_DELAY, $this->first_notification_delay); + if ($this->isColumnModified(NagiosHostPeer::MAXIMUM_CHECK_ATTEMPTS)) $criteria->add(NagiosHostPeer::MAXIMUM_CHECK_ATTEMPTS, $this->maximum_check_attempts); + if ($this->isColumnModified(NagiosHostPeer::CHECK_INTERVAL)) $criteria->add(NagiosHostPeer::CHECK_INTERVAL, $this->check_interval); + if ($this->isColumnModified(NagiosHostPeer::PASSIVE_CHECKS_ENABLED)) $criteria->add(NagiosHostPeer::PASSIVE_CHECKS_ENABLED, $this->passive_checks_enabled); + if ($this->isColumnModified(NagiosHostPeer::CHECK_PERIOD)) $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->check_period); + if ($this->isColumnModified(NagiosHostPeer::OBSESS_OVER_HOST)) $criteria->add(NagiosHostPeer::OBSESS_OVER_HOST, $this->obsess_over_host); + if ($this->isColumnModified(NagiosHostPeer::CHECK_FRESHNESS)) $criteria->add(NagiosHostPeer::CHECK_FRESHNESS, $this->check_freshness); + if ($this->isColumnModified(NagiosHostPeer::FRESHNESS_THRESHOLD)) $criteria->add(NagiosHostPeer::FRESHNESS_THRESHOLD, $this->freshness_threshold); + if ($this->isColumnModified(NagiosHostPeer::ACTIVE_CHECKS_ENABLED)) $criteria->add(NagiosHostPeer::ACTIVE_CHECKS_ENABLED, $this->active_checks_enabled); + if ($this->isColumnModified(NagiosHostPeer::CHECKS_ENABLED)) $criteria->add(NagiosHostPeer::CHECKS_ENABLED, $this->checks_enabled); + if ($this->isColumnModified(NagiosHostPeer::EVENT_HANDLER)) $criteria->add(NagiosHostPeer::EVENT_HANDLER, $this->event_handler); + if ($this->isColumnModified(NagiosHostPeer::EVENT_HANDLER_ENABLED)) $criteria->add(NagiosHostPeer::EVENT_HANDLER_ENABLED, $this->event_handler_enabled); + if ($this->isColumnModified(NagiosHostPeer::LOW_FLAP_THRESHOLD)) $criteria->add(NagiosHostPeer::LOW_FLAP_THRESHOLD, $this->low_flap_threshold); + if ($this->isColumnModified(NagiosHostPeer::HIGH_FLAP_THRESHOLD)) $criteria->add(NagiosHostPeer::HIGH_FLAP_THRESHOLD, $this->high_flap_threshold); + if ($this->isColumnModified(NagiosHostPeer::FLAP_DETECTION_ENABLED)) $criteria->add(NagiosHostPeer::FLAP_DETECTION_ENABLED, $this->flap_detection_enabled); + if ($this->isColumnModified(NagiosHostPeer::PROCESS_PERF_DATA)) $criteria->add(NagiosHostPeer::PROCESS_PERF_DATA, $this->process_perf_data); + if ($this->isColumnModified(NagiosHostPeer::RETAIN_STATUS_INFORMATION)) $criteria->add(NagiosHostPeer::RETAIN_STATUS_INFORMATION, $this->retain_status_information); + if ($this->isColumnModified(NagiosHostPeer::RETAIN_NONSTATUS_INFORMATION)) $criteria->add(NagiosHostPeer::RETAIN_NONSTATUS_INFORMATION, $this->retain_nonstatus_information); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_INTERVAL)) $criteria->add(NagiosHostPeer::NOTIFICATION_INTERVAL, $this->notification_interval); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_PERIOD)) $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->notification_period); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATIONS_ENABLED)) $criteria->add(NagiosHostPeer::NOTIFICATIONS_ENABLED, $this->notifications_enabled); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_ON_DOWN)) $criteria->add(NagiosHostPeer::NOTIFICATION_ON_DOWN, $this->notification_on_down); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_ON_UNREACHABLE)) $criteria->add(NagiosHostPeer::NOTIFICATION_ON_UNREACHABLE, $this->notification_on_unreachable); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosHostPeer::NOTIFICATION_ON_RECOVERY, $this->notification_on_recovery); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosHostPeer::NOTIFICATION_ON_FLAPPING, $this->notification_on_flapping); + if ($this->isColumnModified(NagiosHostPeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME)) $criteria->add(NagiosHostPeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME, $this->notification_on_scheduled_downtime); + if ($this->isColumnModified(NagiosHostPeer::STALKING_ON_UP)) $criteria->add(NagiosHostPeer::STALKING_ON_UP, $this->stalking_on_up); + if ($this->isColumnModified(NagiosHostPeer::STALKING_ON_DOWN)) $criteria->add(NagiosHostPeer::STALKING_ON_DOWN, $this->stalking_on_down); + if ($this->isColumnModified(NagiosHostPeer::STALKING_ON_UNREACHABLE)) $criteria->add(NagiosHostPeer::STALKING_ON_UNREACHABLE, $this->stalking_on_unreachable); + if ($this->isColumnModified(NagiosHostPeer::FAILURE_PREDICTION_ENABLED)) $criteria->add(NagiosHostPeer::FAILURE_PREDICTION_ENABLED, $this->failure_prediction_enabled); + if ($this->isColumnModified(NagiosHostPeer::FLAP_DETECTION_ON_UP)) $criteria->add(NagiosHostPeer::FLAP_DETECTION_ON_UP, $this->flap_detection_on_up); + if ($this->isColumnModified(NagiosHostPeer::FLAP_DETECTION_ON_DOWN)) $criteria->add(NagiosHostPeer::FLAP_DETECTION_ON_DOWN, $this->flap_detection_on_down); + if ($this->isColumnModified(NagiosHostPeer::FLAP_DETECTION_ON_UNREACHABLE)) $criteria->add(NagiosHostPeer::FLAP_DETECTION_ON_UNREACHABLE, $this->flap_detection_on_unreachable); + if ($this->isColumnModified(NagiosHostPeer::NOTES)) $criteria->add(NagiosHostPeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosHostPeer::NOTES_URL)) $criteria->add(NagiosHostPeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosHostPeer::ACTION_URL)) $criteria->add(NagiosHostPeer::ACTION_URL, $this->action_url); + if ($this->isColumnModified(NagiosHostPeer::ICON_IMAGE)) $criteria->add(NagiosHostPeer::ICON_IMAGE, $this->icon_image); + if ($this->isColumnModified(NagiosHostPeer::ICON_IMAGE_ALT)) $criteria->add(NagiosHostPeer::ICON_IMAGE_ALT, $this->icon_image_alt); + if ($this->isColumnModified(NagiosHostPeer::VRML_IMAGE)) $criteria->add(NagiosHostPeer::VRML_IMAGE, $this->vrml_image); + if ($this->isColumnModified(NagiosHostPeer::STATUSMAP_IMAGE)) $criteria->add(NagiosHostPeer::STATUSMAP_IMAGE, $this->statusmap_image); + if ($this->isColumnModified(NagiosHostPeer::TWO_D_COORDS)) $criteria->add(NagiosHostPeer::TWO_D_COORDS, $this->two_d_coords); + if ($this->isColumnModified(NagiosHostPeer::THREE_D_COORDS)) $criteria->add(NagiosHostPeer::THREE_D_COORDS, $this->three_d_coords); + + 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(NagiosHostPeer::DATABASE_NAME); + + $criteria->add(NagiosHostPeer::ID, $this->id); + + 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 NagiosHost (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + $copyObj->setDisplayName($this->display_name); + + $copyObj->setInitialState($this->initial_state); + + $copyObj->setAddress($this->address); + + $copyObj->setCheckCommand($this->check_command); + + $copyObj->setRetryInterval($this->retry_interval); + + $copyObj->setFirstNotificationDelay($this->first_notification_delay); + + $copyObj->setMaximumCheckAttempts($this->maximum_check_attempts); + + $copyObj->setCheckInterval($this->check_interval); + + $copyObj->setPassiveChecksEnabled($this->passive_checks_enabled); + + $copyObj->setCheckPeriod($this->check_period); + + $copyObj->setObsessOverHost($this->obsess_over_host); + + $copyObj->setCheckFreshness($this->check_freshness); + + $copyObj->setFreshnessThreshold($this->freshness_threshold); + + $copyObj->setActiveChecksEnabled($this->active_checks_enabled); + + $copyObj->setChecksEnabled($this->checks_enabled); + + $copyObj->setEventHandler($this->event_handler); + + $copyObj->setEventHandlerEnabled($this->event_handler_enabled); + + $copyObj->setLowFlapThreshold($this->low_flap_threshold); + + $copyObj->setHighFlapThreshold($this->high_flap_threshold); + + $copyObj->setFlapDetectionEnabled($this->flap_detection_enabled); + + $copyObj->setProcessPerfData($this->process_perf_data); + + $copyObj->setRetainStatusInformation($this->retain_status_information); + + $copyObj->setRetainNonstatusInformation($this->retain_nonstatus_information); + + $copyObj->setNotificationInterval($this->notification_interval); + + $copyObj->setNotificationPeriod($this->notification_period); + + $copyObj->setNotificationsEnabled($this->notifications_enabled); + + $copyObj->setNotificationOnDown($this->notification_on_down); + + $copyObj->setNotificationOnUnreachable($this->notification_on_unreachable); + + $copyObj->setNotificationOnRecovery($this->notification_on_recovery); + + $copyObj->setNotificationOnFlapping($this->notification_on_flapping); + + $copyObj->setNotificationOnScheduledDowntime($this->notification_on_scheduled_downtime); + + $copyObj->setStalkingOnUp($this->stalking_on_up); + + $copyObj->setStalkingOnDown($this->stalking_on_down); + + $copyObj->setStalkingOnUnreachable($this->stalking_on_unreachable); + + $copyObj->setFailurePredictionEnabled($this->failure_prediction_enabled); + + $copyObj->setFlapDetectionOnUp($this->flap_detection_on_up); + + $copyObj->setFlapDetectionOnDown($this->flap_detection_on_down); + + $copyObj->setFlapDetectionOnUnreachable($this->flap_detection_on_unreachable); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + $copyObj->setIconImage($this->icon_image); + + $copyObj->setIconImageAlt($this->icon_image_alt); + + $copyObj->setVrmlImage($this->vrml_image); + + $copyObj->setStatusmapImage($this->statusmap_image); + + $copyObj->setTwoDCoords($this->two_d_coords); + + $copyObj->setThreeDCoords($this->three_d_coords); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosServices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosService($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencyTargets() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependencyTarget($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactgroups() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactgroup($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostgroupMemberships() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostgroupMembership($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostCheckCommandParameters() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostCheckCommandParameter($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostParentsRelatedByChildHost() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostParentRelatedByChildHost($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostParentsRelatedByParentHost() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostParentRelatedByParentHost($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplateInheritances() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateInheritance($relObj->copy($deepCopy)); + } + } + + foreach ($this->getAutodiscoveryDevices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDevice($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHost 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); + $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 NagiosHostPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosHost The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByCheckCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setCheckCommand(NULL); + } else { + $this->setCheckCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByCheckCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostRelatedByCheckCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByCheckCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByCheckCommand === null && ($this->check_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->check_command); + $this->aNagiosCommandRelatedByCheckCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByCheckCommand->addNagiosHostsRelatedByCheckCommand($this); + */ + } + return $this->aNagiosCommandRelatedByCheckCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosHost The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setEventHandler(NULL); + } else { + $this->setEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostRelatedByEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByEventHandler === null && ($this->event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->event_handler); + $this->aNagiosCommandRelatedByEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByEventHandler->addNagiosHostsRelatedByEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByEventHandler; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosHost The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByCheckPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setCheckPeriod(NULL); + } else { + $this->setCheckPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByCheckPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostRelatedByCheckPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByCheckPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod === null && ($this->check_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->check_period); + $this->aNagiosTimeperiodRelatedByCheckPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByCheckPeriod->addNagiosHostsRelatedByCheckPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByCheckPeriod; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosHost The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setNotificationPeriod(NULL); + } else { + $this->setNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostRelatedByNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod === null && ($this->notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->notification_period); + $this->aNagiosTimeperiodRelatedByNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByNotificationPeriod->addNagiosHostsRelatedByNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosServices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServices() + */ + public function clearNagiosServices() + { + $this->collNagiosServices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServices collection (array). + * + * By default this just sets the collNagiosServices collection to an empty array (like clearcollNagiosServices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServices() + { + $this->collNagiosServices = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosServices from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServices = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceCriteria = $criteria; + return $this->collNagiosServices; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServices); + } + } else { + $count = count($this->collNagiosServices); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosService(NagiosService $l) + { + if ($this->collNagiosServices === null) { + $this->initNagiosServices(); + } + if (!in_array($l, $this->collNagiosServices, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServices, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHost. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + /** + * Clears out the collNagiosHostContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactMembers() + */ + public function clearNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactMembers collection (array). + * + * By default this just sets the collNagiosHostContactMembers collection to an empty array (like clearcollNagiosHostContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = array(); + } + + /** + * Gets an array of NagiosHostContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostContactMembers from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactMember[] + * @throws PropelException + */ + public function getNagiosHostContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::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. + + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + return $this->collNagiosHostContactMembers; + } + + /** + * Returns the number of related NagiosHostContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactMember objects. + * @throws PropelException + */ + public function countNagiosHostContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + $count = NagiosHostContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $count = NagiosHostContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactMembers); + } + } else { + $count = count($this->collNagiosHostContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactMember object to this object + * through the NagiosHostContactMember foreign key attribute. + * + * @param NagiosHostContactMember $l NagiosHostContactMember + * @return void + * @throws PropelException + */ + public function addNagiosHostContactMember(NagiosHostContactMember $l) + { + if ($this->collNagiosHostContactMembers === null) { + $this->initNagiosHostContactMembers(); + } + if (!in_array($l, $this->collNagiosHostContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactMembers, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosHost. + */ + public function getNagiosHostContactMembersJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosHost. + */ + public function getNagiosHostContactMembersJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::HOST, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHost. + */ + public function getNagiosDependencysJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHost. + */ + public function getNagiosDependencysJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHost. + */ + public function getNagiosDependencysJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHost. + */ + public function getNagiosDependencysJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHost. + */ + public function getNagiosDependencysJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosDependencyTargets collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencyTargets() + */ + public function clearNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencyTargets collection (array). + * + * By default this just sets the collNagiosDependencyTargets collection to an empty array (like clearcollNagiosDependencyTargets()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = array(); + } + + /** + * Gets an array of NagiosDependencyTarget objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosDependencyTargets from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependencyTarget[] + * @throws PropelException + */ + public function getNagiosDependencyTargets($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::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. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + return $this->collNagiosDependencyTargets; + } + + /** + * Returns the number of related NagiosDependencyTarget objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependencyTarget objects. + * @throws PropelException + */ + public function countNagiosDependencyTargets(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + $count = NagiosDependencyTargetPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $count = NagiosDependencyTargetPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencyTargets); + } + } else { + $count = count($this->collNagiosDependencyTargets); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependencyTarget object to this object + * through the NagiosDependencyTarget foreign key attribute. + * + * @param NagiosDependencyTarget $l NagiosDependencyTarget + * @return void + * @throws PropelException + */ + public function addNagiosDependencyTarget(NagiosDependencyTarget $l) + { + if ($this->collNagiosDependencyTargets === null) { + $this->initNagiosDependencyTargets(); + } + if (!in_array($l, $this->collNagiosDependencyTargets, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencyTargets, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHost. + */ + public function getNagiosDependencyTargetsJoinNagiosDependency($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHost. + */ + public function getNagiosDependencyTargetsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHost. + */ + public function getNagiosDependencyTargetsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOST, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHost. + */ + public function getNagiosEscalationsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHost. + */ + public function getNagiosEscalationsJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHost. + */ + public function getNagiosEscalationsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHost. + */ + public function getNagiosEscalationsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHost. + */ + public function getNagiosEscalationsJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Clears out the collNagiosHostContactgroups collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactgroups() + */ + public function clearNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactgroups collection (array). + * + * By default this just sets the collNagiosHostContactgroups collection to an empty array (like clearcollNagiosHostContactgroups()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = array(); + } + + /** + * Gets an array of NagiosHostContactgroup objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostContactgroups from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactgroup[] + * @throws PropelException + */ + public function getNagiosHostContactgroups($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::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. + + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + return $this->collNagiosHostContactgroups; + } + + /** + * Returns the number of related NagiosHostContactgroup objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactgroup objects. + * @throws PropelException + */ + public function countNagiosHostContactgroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + $count = NagiosHostContactgroupPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $count = NagiosHostContactgroupPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactgroups); + } + } else { + $count = count($this->collNagiosHostContactgroups); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactgroup object to this object + * through the NagiosHostContactgroup foreign key attribute. + * + * @param NagiosHostContactgroup $l NagiosHostContactgroup + * @return void + * @throws PropelException + */ + public function addNagiosHostContactgroup(NagiosHostContactgroup $l) + { + if ($this->collNagiosHostContactgroups === null) { + $this->initNagiosHostContactgroups(); + } + if (!in_array($l, $this->collNagiosHostContactgroups, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactgroups, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosHost. + */ + public function getNagiosHostContactgroupsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosHost. + */ + public function getNagiosHostContactgroupsJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + /** + * Clears out the collNagiosHostgroupMemberships collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostgroupMemberships() + */ + public function clearNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostgroupMemberships collection (array). + * + * By default this just sets the collNagiosHostgroupMemberships collection to an empty array (like clearcollNagiosHostgroupMemberships()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = array(); + } + + /** + * Gets an array of NagiosHostgroupMembership objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostgroupMemberships from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostgroupMembership[] + * @throws PropelException + */ + public function getNagiosHostgroupMemberships($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::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. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + return $this->collNagiosHostgroupMemberships; + } + + /** + * Returns the number of related NagiosHostgroupMembership objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostgroupMembership objects. + * @throws PropelException + */ + public function countNagiosHostgroupMemberships(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + $count = NagiosHostgroupMembershipPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $count = NagiosHostgroupMembershipPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostgroupMembership object to this object + * through the NagiosHostgroupMembership foreign key attribute. + * + * @param NagiosHostgroupMembership $l NagiosHostgroupMembership + * @return void + * @throws PropelException + */ + public function addNagiosHostgroupMembership(NagiosHostgroupMembership $l) + { + if ($this->collNagiosHostgroupMemberships === null) { + $this->initNagiosHostgroupMemberships(); + } + if (!in_array($l, $this->collNagiosHostgroupMemberships, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostgroupMemberships, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHost. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHost. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + /** + * Clears out the collNagiosHostCheckCommandParameters collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostCheckCommandParameters() + */ + public function clearNagiosHostCheckCommandParameters() + { + $this->collNagiosHostCheckCommandParameters = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostCheckCommandParameters collection (array). + * + * By default this just sets the collNagiosHostCheckCommandParameters collection to an empty array (like clearcollNagiosHostCheckCommandParameters()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostCheckCommandParameters() + { + $this->collNagiosHostCheckCommandParameters = array(); + } + + /** + * Gets an array of NagiosHostCheckCommandParameter objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostCheckCommandParameters from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostCheckCommandParameter[] + * @throws PropelException + */ + public function getNagiosHostCheckCommandParameters($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosHostCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::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. + + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostCheckCommandParameterCriteria = $criteria; + return $this->collNagiosHostCheckCommandParameters; + } + + /** + * Returns the number of related NagiosHostCheckCommandParameter objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostCheckCommandParameter objects. + * @throws PropelException + */ + public function countNagiosHostCheckCommandParameters(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + $count = NagiosHostCheckCommandParameterPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $count = NagiosHostCheckCommandParameterPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostCheckCommandParameters); + } + } else { + $count = count($this->collNagiosHostCheckCommandParameters); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostCheckCommandParameter object to this object + * through the NagiosHostCheckCommandParameter foreign key attribute. + * + * @param NagiosHostCheckCommandParameter $l NagiosHostCheckCommandParameter + * @return void + * @throws PropelException + */ + public function addNagiosHostCheckCommandParameter(NagiosHostCheckCommandParameter $l) + { + if ($this->collNagiosHostCheckCommandParameters === null) { + $this->initNagiosHostCheckCommandParameters(); + } + if (!in_array($l, $this->collNagiosHostCheckCommandParameters, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostCheckCommandParameters, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostCheckCommandParameters 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 NagiosHost. + */ + public function getNagiosHostCheckCommandParametersJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosHostCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostCheckCommandParameterPeer::HOST, $this->id); + + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostCheckCommandParameterCriteria = $criteria; + + return $this->collNagiosHostCheckCommandParameters; + } + + /** + * Clears out the collNagiosHostParentsRelatedByChildHost collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostParentsRelatedByChildHost() + */ + public function clearNagiosHostParentsRelatedByChildHost() + { + $this->collNagiosHostParentsRelatedByChildHost = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostParentsRelatedByChildHost collection (array). + * + * By default this just sets the collNagiosHostParentsRelatedByChildHost collection to an empty array (like clearcollNagiosHostParentsRelatedByChildHost()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostParentsRelatedByChildHost() + { + $this->collNagiosHostParentsRelatedByChildHost = array(); + } + + /** + * Gets an array of NagiosHostParent objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostParentsRelatedByChildHost from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostParent[] + * @throws PropelException + */ + public function getNagiosHostParentsRelatedByChildHost($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParentsRelatedByChildHost === null) { + if ($this->isNew()) { + $this->collNagiosHostParentsRelatedByChildHost = array(); + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + $this->collNagiosHostParentsRelatedByChildHost = NagiosHostParentPeer::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. + + + $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostParentRelatedByChildHostCriteria) || !$this->lastNagiosHostParentRelatedByChildHostCriteria->equals($criteria)) { + $this->collNagiosHostParentsRelatedByChildHost = NagiosHostParentPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostParentRelatedByChildHostCriteria = $criteria; + return $this->collNagiosHostParentsRelatedByChildHost; + } + + /** + * Returns the number of related NagiosHostParent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostParent objects. + * @throws PropelException + */ + public function countNagiosHostParentsRelatedByChildHost(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostParentsRelatedByChildHost === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->id); + + $count = NagiosHostParentPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->id); + + if (!isset($this->lastNagiosHostParentRelatedByChildHostCriteria) || !$this->lastNagiosHostParentRelatedByChildHostCriteria->equals($criteria)) { + $count = NagiosHostParentPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostParentsRelatedByChildHost); + } + } else { + $count = count($this->collNagiosHostParentsRelatedByChildHost); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostParent object to this object + * through the NagiosHostParent foreign key attribute. + * + * @param NagiosHostParent $l NagiosHostParent + * @return void + * @throws PropelException + */ + public function addNagiosHostParentRelatedByChildHost(NagiosHostParent $l) + { + if ($this->collNagiosHostParentsRelatedByChildHost === null) { + $this->initNagiosHostParentsRelatedByChildHost(); + } + if (!in_array($l, $this->collNagiosHostParentsRelatedByChildHost, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostParentsRelatedByChildHost, $l); + $l->setNagiosHostRelatedByChildHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostParentsRelatedByChildHost 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 NagiosHost. + */ + public function getNagiosHostParentsRelatedByChildHostJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParentsRelatedByChildHost === null) { + if ($this->isNew()) { + $this->collNagiosHostParentsRelatedByChildHost = array(); + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->id); + + $this->collNagiosHostParentsRelatedByChildHost = NagiosHostParentPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostParentPeer::CHILD_HOST, $this->id); + + if (!isset($this->lastNagiosHostParentRelatedByChildHostCriteria) || !$this->lastNagiosHostParentRelatedByChildHostCriteria->equals($criteria)) { + $this->collNagiosHostParentsRelatedByChildHost = NagiosHostParentPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostParentRelatedByChildHostCriteria = $criteria; + + return $this->collNagiosHostParentsRelatedByChildHost; + } + + /** + * Clears out the collNagiosHostParentsRelatedByParentHost collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostParentsRelatedByParentHost() + */ + public function clearNagiosHostParentsRelatedByParentHost() + { + $this->collNagiosHostParentsRelatedByParentHost = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostParentsRelatedByParentHost collection (array). + * + * By default this just sets the collNagiosHostParentsRelatedByParentHost collection to an empty array (like clearcollNagiosHostParentsRelatedByParentHost()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostParentsRelatedByParentHost() + { + $this->collNagiosHostParentsRelatedByParentHost = array(); + } + + /** + * Gets an array of NagiosHostParent objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostParentsRelatedByParentHost from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostParent[] + * @throws PropelException + */ + public function getNagiosHostParentsRelatedByParentHost($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParentsRelatedByParentHost === null) { + if ($this->isNew()) { + $this->collNagiosHostParentsRelatedByParentHost = array(); + } else { + + $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + $this->collNagiosHostParentsRelatedByParentHost = NagiosHostParentPeer::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. + + + $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostParentRelatedByParentHostCriteria) || !$this->lastNagiosHostParentRelatedByParentHostCriteria->equals($criteria)) { + $this->collNagiosHostParentsRelatedByParentHost = NagiosHostParentPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostParentRelatedByParentHostCriteria = $criteria; + return $this->collNagiosHostParentsRelatedByParentHost; + } + + /** + * Returns the number of related NagiosHostParent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostParent objects. + * @throws PropelException + */ + public function countNagiosHostParentsRelatedByParentHost(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostParentsRelatedByParentHost === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->id); + + $count = NagiosHostParentPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->id); + + if (!isset($this->lastNagiosHostParentRelatedByParentHostCriteria) || !$this->lastNagiosHostParentRelatedByParentHostCriteria->equals($criteria)) { + $count = NagiosHostParentPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostParentsRelatedByParentHost); + } + } else { + $count = count($this->collNagiosHostParentsRelatedByParentHost); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostParent object to this object + * through the NagiosHostParent foreign key attribute. + * + * @param NagiosHostParent $l NagiosHostParent + * @return void + * @throws PropelException + */ + public function addNagiosHostParentRelatedByParentHost(NagiosHostParent $l) + { + if ($this->collNagiosHostParentsRelatedByParentHost === null) { + $this->initNagiosHostParentsRelatedByParentHost(); + } + if (!in_array($l, $this->collNagiosHostParentsRelatedByParentHost, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostParentsRelatedByParentHost, $l); + $l->setNagiosHostRelatedByParentHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostParentsRelatedByParentHost 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 NagiosHost. + */ + public function getNagiosHostParentsRelatedByParentHostJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParentsRelatedByParentHost === null) { + if ($this->isNew()) { + $this->collNagiosHostParentsRelatedByParentHost = array(); + } else { + + $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->id); + + $this->collNagiosHostParentsRelatedByParentHost = NagiosHostParentPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostParentPeer::PARENT_HOST, $this->id); + + if (!isset($this->lastNagiosHostParentRelatedByParentHostCriteria) || !$this->lastNagiosHostParentRelatedByParentHostCriteria->equals($criteria)) { + $this->collNagiosHostParentsRelatedByParentHost = NagiosHostParentPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostParentRelatedByParentHostCriteria = $criteria; + + return $this->collNagiosHostParentsRelatedByParentHost; + } + + /** + * Clears out the collNagiosHostTemplateInheritances collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplateInheritances() + */ + public function clearNagiosHostTemplateInheritances() + { + $this->collNagiosHostTemplateInheritances = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplateInheritances collection (array). + * + * By default this just sets the collNagiosHostTemplateInheritances collection to an empty array (like clearcollNagiosHostTemplateInheritances()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplateInheritances() + { + $this->collNagiosHostTemplateInheritances = array(); + } + + /** + * Gets an array of NagiosHostTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related NagiosHostTemplateInheritances from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosHostTemplateInheritances($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritances = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::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. + + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateInheritanceCriteria) || !$this->lastNagiosHostTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateInheritanceCriteria = $criteria; + return $this->collNagiosHostTemplateInheritances; + } + + /** + * Returns the number of related NagiosHostTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosHostTemplateInheritances(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplateInheritances === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + $count = NagiosHostTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceCriteria) || !$this->lastNagiosHostTemplateInheritanceCriteria->equals($criteria)) { + $count = NagiosHostTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplateInheritances); + } + } else { + $count = count($this->collNagiosHostTemplateInheritances); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplateInheritance object to this object + * through the NagiosHostTemplateInheritance foreign key attribute. + * + * @param NagiosHostTemplateInheritance $l NagiosHostTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateInheritance(NagiosHostTemplateInheritance $l) + { + if ($this->collNagiosHostTemplateInheritances === null) { + $this->initNagiosHostTemplateInheritances(); + } + if (!in_array($l, $this->collNagiosHostTemplateInheritances, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplateInheritances, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostTemplateInheritances 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 NagiosHost. + */ + public function getNagiosHostTemplateInheritancesJoinNagiosHostTemplateRelatedBySourceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritances = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHostTemplateRelatedBySourceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceCriteria) || !$this->lastNagiosHostTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHostTemplateRelatedBySourceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateInheritanceCriteria = $criteria; + + return $this->collNagiosHostTemplateInheritances; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related NagiosHostTemplateInheritances 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 NagiosHost. + */ + public function getNagiosHostTemplateInheritancesJoinNagiosHostTemplateRelatedByTargetTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritances = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHostTemplateRelatedByTargetTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceCriteria) || !$this->lastNagiosHostTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritances = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHostTemplateRelatedByTargetTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateInheritanceCriteria = $criteria; + + return $this->collNagiosHostTemplateInheritances; + } + + /** + * Clears out the collAutodiscoveryDevices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDevices() + */ + public function clearAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDevices collection (array). + * + * By default this just sets the collAutodiscoveryDevices collection to an empty array (like clearcollAutodiscoveryDevices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = array(); + } + + /** + * Gets an array of AutodiscoveryDevice objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHost has previously been saved, it will retrieve + * related AutodiscoveryDevices from storage. If this NagiosHost is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDevice[] + * @throws PropelException + */ + public function getAutodiscoveryDevices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::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. + + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + return $this->collAutodiscoveryDevices; + } + + /** + * Returns the number of related AutodiscoveryDevice objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDevice objects. + * @throws PropelException + */ + public function countAutodiscoveryDevices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + $count = AutodiscoveryDevicePeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $count = AutodiscoveryDevicePeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDevices); + } + } else { + $count = count($this->collAutodiscoveryDevices); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDevice object to this object + * through the AutodiscoveryDevice foreign key attribute. + * + * @param AutodiscoveryDevice $l AutodiscoveryDevice + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDevice(AutodiscoveryDevice $l) + { + if ($this->collAutodiscoveryDevices === null) { + $this->initAutodiscoveryDevices(); + } + if (!in_array($l, $this->collAutodiscoveryDevices, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDevices, $l); + $l->setNagiosHost($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 NagiosHost. + */ + public function getAutodiscoveryDevicesJoinAutodiscoveryJob($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinAutodiscoveryJob($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinAutodiscoveryJob($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHost is new, it will return + * an empty collection; or if this NagiosHost has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 NagiosHost. + */ + public function getAutodiscoveryDevicesJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::PROPOSED_PARENT, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosServices) { + foreach ((array) $this->collNagiosServices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactMembers) { + foreach ((array) $this->collNagiosHostContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencyTargets) { + foreach ((array) $this->collNagiosDependencyTargets as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactgroups) { + foreach ((array) $this->collNagiosHostContactgroups as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostgroupMemberships) { + foreach ((array) $this->collNagiosHostgroupMemberships as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostCheckCommandParameters) { + foreach ((array) $this->collNagiosHostCheckCommandParameters as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostParentsRelatedByChildHost) { + foreach ((array) $this->collNagiosHostParentsRelatedByChildHost as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostParentsRelatedByParentHost) { + foreach ((array) $this->collNagiosHostParentsRelatedByParentHost as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplateInheritances) { + foreach ((array) $this->collNagiosHostTemplateInheritances as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collAutodiscoveryDevices) { + foreach ((array) $this->collAutodiscoveryDevices as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosServices = null; + $this->collNagiosHostContactMembers = null; + $this->collNagiosDependencys = null; + $this->collNagiosDependencyTargets = null; + $this->collNagiosEscalations = null; + $this->collNagiosHostContactgroups = null; + $this->collNagiosHostgroupMemberships = null; + $this->collNagiosHostCheckCommandParameters = null; + $this->collNagiosHostParentsRelatedByChildHost = null; + $this->collNagiosHostParentsRelatedByParentHost = null; + $this->collNagiosHostTemplateInheritances = null; + $this->collAutodiscoveryDevices = null; + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + +} // BaseNagiosHost diff --git a/classes/om/BaseNagiosHostCheckCommandParameter.php b/classes/om/BaseNagiosHostCheckCommandParameter.php new file mode 100755 index 0000000..1c9a835 --- /dev/null +++ b/classes/om/BaseNagiosHostCheckCommandParameter.php @@ -0,0 +1,933 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [parameter] column value. + * + * @return string + */ + public function getParameter() + { + return $this->parameter; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostCheckCommandParameterPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosHostCheckCommandParameterPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [parameter] column. + * + * @param string $v new value + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + */ + public function setParameter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->parameter !== $v) { + $this->parameter = $v; + $this->modifiedColumns[] = NagiosHostCheckCommandParameterPeer::PARAMETER; + } + + return $this; + } // setParameter() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->parameter = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostCheckCommandParameter object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostCheckCommandParameterPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostCheckCommandParameterPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostCheckCommandParameterPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostCheckCommandParameterPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostCheckCommandParameterPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosHostCheckCommandParameterPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostCheckCommandParameterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHost(); + break; + case 2: + return $this->getHostTemplate(); + break; + case 3: + return $this->getParameter(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostCheckCommandParameterPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHost(), + $keys[2] => $this->getHostTemplate(), + $keys[3] => $this->getParameter(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostCheckCommandParameterPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHost($value); + break; + case 2: + $this->setHostTemplate($value); + break; + case 3: + $this->setParameter($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostCheckCommandParameterPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setParameter($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(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostCheckCommandParameterPeer::ID)) $criteria->add(NagiosHostCheckCommandParameterPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostCheckCommandParameterPeer::HOST)) $criteria->add(NagiosHostCheckCommandParameterPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE)) $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosHostCheckCommandParameterPeer::PARAMETER)) $criteria->add(NagiosHostCheckCommandParameterPeer::PARAMETER, $this->parameter); + + 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(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + + $criteria->add(NagiosHostCheckCommandParameterPeer::ID, $this->id); + + 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 NagiosHostCheckCommandParameter (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) + { + + $copyObj->setHost($this->host); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setParameter($this->parameter); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostCheckCommandParameter 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); + $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 NagiosHostCheckCommandParameterPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostCheckCommandParameterPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostCheckCommandParameter($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosHostCheckCommandParameters($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostCheckCommandParameter The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostCheckCommandParameter($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostCheckCommandParameters($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + } + +} // BaseNagiosHostCheckCommandParameter diff --git a/classes/om/BaseNagiosHostCheckCommandParameterPeer.php b/classes/om/BaseNagiosHostCheckCommandParameterPeer.php new file mode 100755 index 0000000..454ec15 --- /dev/null +++ b/classes/om/BaseNagiosHostCheckCommandParameterPeer.php @@ -0,0 +1,1321 @@ + array ('Id', 'Host', 'HostTemplate', 'Parameter', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'host', 'hostTemplate', 'parameter', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST, self::HOST_TEMPLATE, self::PARAMETER, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host', 'host_template', 'parameter', ), + 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, 'Host' => 1, 'HostTemplate' => 2, 'Parameter' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'host' => 1, 'hostTemplate' => 2, 'parameter' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST => 1, self::HOST_TEMPLATE => 2, self::PARAMETER => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host' => 1, 'host_template' => 2, 'parameter' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostCheckCommandParameterMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostCheckCommandParameterPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostCheckCommandParameterPeer::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) + { + + $criteria->addSelectColumn(NagiosHostCheckCommandParameterPeer::ID); + + $criteria->addSelectColumn(NagiosHostCheckCommandParameterPeer::HOST); + + $criteria->addSelectColumn(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostCheckCommandParameterPeer::PARAMETER); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostCheckCommandParameter + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostCheckCommandParameterPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostCheckCommandParameterPeer::populateObjects(NagiosHostCheckCommandParameterPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostCheckCommandParameter $value A NagiosHostCheckCommandParameter object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostCheckCommandParameter $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostCheckCommandParameter object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostCheckCommandParameter) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostCheckCommandParameter object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostCheckCommandParameter Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostCheckCommandParameterPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostCheckCommandParameter objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostCheckCommandParameterPeer::addSelectColumns($c); + $startcol = (NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to $obj2 (NagiosHost) + $obj2->addNagiosHostCheckCommandParameter($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostCheckCommandParameter objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostCheckCommandParameterPeer::addSelectColumns($c); + $startcol = (NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostCheckCommandParameter($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostCheckCommandParameter objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostCheckCommandParameter($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostCheckCommandParameter($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostCheckCommandParameter objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostCheckCommandParameter($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostCheckCommandParameter objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosHostCheckCommandParameterPeer::NUM_COLUMNS - NagiosHostCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostCheckCommandParameterPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostCheckCommandParameter) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostCheckCommandParameter($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostCheckCommandParameterPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostCheckCommandParameter or Criteria object. + * + * @param mixed $values Criteria or NagiosHostCheckCommandParameter object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostCheckCommandParameter object + } + + if ($criteria->containsKey(NagiosHostCheckCommandParameterPeer::ID) && $criteria->keyContainsValue(NagiosHostCheckCommandParameterPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostCheckCommandParameterPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostCheckCommandParameter or Criteria object. + * + * @param mixed $values Criteria or NagiosHostCheckCommandParameter object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostCheckCommandParameterPeer::ID); + $selectCriteria->add(NagiosHostCheckCommandParameterPeer::ID, $criteria->remove(NagiosHostCheckCommandParameterPeer::ID), $comparison); + + } else { // $values is NagiosHostCheckCommandParameter object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_check_command_parameter 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(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostCheckCommandParameterPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostCheckCommandParameter or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostCheckCommandParameter object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostCheckCommandParameterPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostCheckCommandParameter) { + // invalidate the cache for this single object + NagiosHostCheckCommandParameterPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostCheckCommandParameterPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostCheckCommandParameterPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostCheckCommandParameter 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 NagiosHostCheckCommandParameter $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(NagiosHostCheckCommandParameter $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostCheckCommandParameterPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, NagiosHostCheckCommandParameterPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostCheckCommandParameter + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostCheckCommandParameterPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + $criteria->add(NagiosHostCheckCommandParameterPeer::ID, $pk); + + $v = NagiosHostCheckCommandParameterPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + $criteria->add(NagiosHostCheckCommandParameterPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostCheckCommandParameterPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostCheckCommandParameterPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostCheckCommandParameterPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostCheckCommandParameterPeer class: +// +// Propel::getDatabaseMap(NagiosHostCheckCommandParameterPeer::DATABASE_NAME)->addTableBuilder(NagiosHostCheckCommandParameterPeer::TABLE_NAME, NagiosHostCheckCommandParameterPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostCheckCommandParameterPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostCheckCommandParameterPeer::TABLE_NAME, BaseNagiosHostCheckCommandParameterPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostContactMember.php b/classes/om/BaseNagiosHostContactMember.php new file mode 100755 index 0000000..84bc47c --- /dev/null +++ b/classes/om/BaseNagiosHostContactMember.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [template] column value. + * + * @return int + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Get the [contact] column value. + * + * @return int + */ + public function getContact() + { + return $this->contact; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostContactMember The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostContactMemberPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosHostContactMember The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosHostContactMemberPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [template] column. + * + * @param int $v new value + * @return NagiosHostContactMember The current object (for fluent API support) + */ + public function setTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->template !== $v) { + $this->template = $v; + $this->modifiedColumns[] = NagiosHostContactMemberPeer::TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setTemplate() + + /** + * Set the value of [contact] column. + * + * @param int $v new value + * @return NagiosHostContactMember The current object (for fluent API support) + */ + public function setContact($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact !== $v) { + $this->contact = $v; + $this->modifiedColumns[] = NagiosHostContactMemberPeer::CONTACT; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContact() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->contact = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostContactMember object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosContact !== null && $this->contact !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostContactMemberPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosContact = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostContactMemberPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostContactMemberPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostContactMemberPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostContactMemberPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostContactMemberPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + + if (($retval = NagiosHostContactMemberPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostContactMemberPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHost(); + break; + case 2: + return $this->getTemplate(); + break; + case 3: + return $this->getContact(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostContactMemberPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHost(), + $keys[2] => $this->getTemplate(), + $keys[3] => $this->getContact(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostContactMemberPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHost($value); + break; + case 2: + $this->setTemplate($value); + break; + case 3: + $this->setContact($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostContactMemberPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setContact($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(NagiosHostContactMemberPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostContactMemberPeer::ID)) $criteria->add(NagiosHostContactMemberPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostContactMemberPeer::HOST)) $criteria->add(NagiosHostContactMemberPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosHostContactMemberPeer::TEMPLATE)) $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->template); + if ($this->isColumnModified(NagiosHostContactMemberPeer::CONTACT)) $criteria->add(NagiosHostContactMemberPeer::CONTACT, $this->contact); + + 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(NagiosHostContactMemberPeer::DATABASE_NAME); + + $criteria->add(NagiosHostContactMemberPeer::ID, $this->id); + + 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 NagiosHostContactMember (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) + { + + $copyObj->setHost($this->host); + + $copyObj->setTemplate($this->template); + + $copyObj->setContact($this->contact); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostContactMember 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); + $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 NagiosHostContactMemberPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostContactMemberPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosHostContactMembers($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setTemplate(NULL); + } else { + $this->setTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostContactMembers($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosHostContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContact(NULL); + } else { + $this->setContact($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosHostContactMembers($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosContact = null; + } + +} // BaseNagiosHostContactMember diff --git a/classes/om/BaseNagiosHostContactMemberPeer.php b/classes/om/BaseNagiosHostContactMemberPeer.php new file mode 100755 index 0000000..ceb8835 --- /dev/null +++ b/classes/om/BaseNagiosHostContactMemberPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Host', 'Template', 'Contact', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'host', 'template', 'contact', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST, self::TEMPLATE, self::CONTACT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host', 'template', 'contact', ), + 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, 'Host' => 1, 'Template' => 2, 'Contact' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'host' => 1, 'template' => 2, 'contact' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST => 1, self::TEMPLATE => 2, self::CONTACT => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host' => 1, 'template' => 2, 'contact' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostContactMemberMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostContactMemberPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostContactMemberPeer::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) + { + + $criteria->addSelectColumn(NagiosHostContactMemberPeer::ID); + + $criteria->addSelectColumn(NagiosHostContactMemberPeer::HOST); + + $criteria->addSelectColumn(NagiosHostContactMemberPeer::TEMPLATE); + + $criteria->addSelectColumn(NagiosHostContactMemberPeer::CONTACT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostContactMember + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostContactMemberPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostContactMemberPeer::populateObjects(NagiosHostContactMemberPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostContactMember $value A NagiosHostContactMember object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostContactMember $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostContactMember object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostContactMember) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostContactMember object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostContactMember Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostContactMemberPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostContactMemberPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostContactMemberPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to $obj2 (NagiosHost) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to $obj2 (NagiosContact) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostContactMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosContact rows + + $key4 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosContactPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosContactPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj4 (NagiosContact) + $obj4->addNagiosHostContactMember($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContact rows + + $key3 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj3 (NagiosContact) + $obj3->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContact rows + + $key3 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj3 (NagiosContact) + $obj3->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactMember objects pre-filled with all related objects except NagiosContact. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactMemberPeer::NUM_COLUMNS - NagiosHostContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactMemberPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactMemberPeer::TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactMember) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostContactMemberPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostContactMember or Criteria object. + * + * @param mixed $values Criteria or NagiosHostContactMember object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostContactMember object + } + + if ($criteria->containsKey(NagiosHostContactMemberPeer::ID) && $criteria->keyContainsValue(NagiosHostContactMemberPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostContactMemberPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostContactMember or Criteria object. + * + * @param mixed $values Criteria or NagiosHostContactMember object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostContactMemberPeer::ID); + $selectCriteria->add(NagiosHostContactMemberPeer::ID, $criteria->remove(NagiosHostContactMemberPeer::ID), $comparison); + + } else { // $values is NagiosHostContactMember object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_contact_member 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(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostContactMemberPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostContactMember or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostContactMember object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostContactMemberPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostContactMember) { + // invalidate the cache for this single object + NagiosHostContactMemberPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostContactMemberPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostContactMemberPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostContactMember 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 NagiosHostContactMember $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(NagiosHostContactMember $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostContactMemberPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostContactMemberPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostContactMemberPeer::DATABASE_NAME, NagiosHostContactMemberPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostContactMember + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostContactMemberPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostContactMemberPeer::DATABASE_NAME); + $criteria->add(NagiosHostContactMemberPeer::ID, $pk); + + $v = NagiosHostContactMemberPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostContactMemberPeer::DATABASE_NAME); + $criteria->add(NagiosHostContactMemberPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostContactMemberPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostContactMemberPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostContactMemberPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostContactMemberPeer class: +// +// Propel::getDatabaseMap(NagiosHostContactMemberPeer::DATABASE_NAME)->addTableBuilder(NagiosHostContactMemberPeer::TABLE_NAME, NagiosHostContactMemberPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostContactMemberPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostContactMemberPeer::TABLE_NAME, BaseNagiosHostContactMemberPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostContactgroup.php b/classes/om/BaseNagiosHostContactgroup.php new file mode 100755 index 0000000..7ff7749 --- /dev/null +++ b/classes/om/BaseNagiosHostContactgroup.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [contactgroup] column value. + * + * @return int + */ + public function getContactgroup() + { + return $this->contactgroup; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostContactgroup The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostContactgroupPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosHostContactgroup The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosHostContactgroupPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosHostContactgroup The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosHostContactgroupPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [contactgroup] column. + * + * @param int $v new value + * @return NagiosHostContactgroup The current object (for fluent API support) + */ + public function setContactgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contactgroup !== $v) { + $this->contactgroup = $v; + $this->modifiedColumns[] = NagiosHostContactgroupPeer::CONTACTGROUP; + } + + if ($this->aNagiosContactGroup !== null && $this->aNagiosContactGroup->getId() !== $v) { + $this->aNagiosContactGroup = null; + } + + return $this; + } // setContactgroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->contactgroup = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostContactgroup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosContactGroup !== null && $this->contactgroup !== $this->aNagiosContactGroup->getId()) { + $this->aNagiosContactGroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostContactgroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosContactGroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostContactgroupPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostContactgroupPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosContactGroup !== null) { + if ($this->aNagiosContactGroup->isModified() || $this->aNagiosContactGroup->isNew()) { + $affectedRows += $this->aNagiosContactGroup->save($con); + } + $this->setNagiosContactGroup($this->aNagiosContactGroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostContactgroupPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostContactgroupPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostContactgroupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosContactGroup !== null) { + if (!$this->aNagiosContactGroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContactGroup->getValidationFailures()); + } + } + + + if (($retval = NagiosHostContactgroupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostContactgroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHost(); + break; + case 2: + return $this->getHostTemplate(); + break; + case 3: + return $this->getContactgroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostContactgroupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHost(), + $keys[2] => $this->getHostTemplate(), + $keys[3] => $this->getContactgroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostContactgroupPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHost($value); + break; + case 2: + $this->setHostTemplate($value); + break; + case 3: + $this->setContactgroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostContactgroupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setContactgroup($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(NagiosHostContactgroupPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostContactgroupPeer::ID)) $criteria->add(NagiosHostContactgroupPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostContactgroupPeer::HOST)) $criteria->add(NagiosHostContactgroupPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosHostContactgroupPeer::HOST_TEMPLATE)) $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosHostContactgroupPeer::CONTACTGROUP)) $criteria->add(NagiosHostContactgroupPeer::CONTACTGROUP, $this->contactgroup); + + 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(NagiosHostContactgroupPeer::DATABASE_NAME); + + $criteria->add(NagiosHostContactgroupPeer::ID, $this->id); + + 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 NagiosHostContactgroup (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) + { + + $copyObj->setHost($this->host); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setContactgroup($this->contactgroup); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostContactgroup 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); + $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 NagiosHostContactgroupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostContactgroupPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostContactgroup The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactgroup($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosHostContactgroups($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostContactgroup The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactgroup($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostContactgroups($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosContactGroup object. + * + * @param NagiosContactGroup $v + * @return NagiosHostContactgroup The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContactGroup(NagiosContactGroup $v = null) + { + if ($v === null) { + $this->setContactgroup(NULL); + } else { + $this->setContactgroup($v->getId()); + } + + $this->aNagiosContactGroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContactGroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostContactgroup($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContactGroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContactGroup The associated NagiosContactGroup object. + * @throws PropelException + */ + public function getNagiosContactGroup(PropelPDO $con = null) + { + if ($this->aNagiosContactGroup === null && ($this->contactgroup !== null)) { + $c = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $c->add(NagiosContactGroupPeer::ID, $this->contactgroup); + $this->aNagiosContactGroup = NagiosContactGroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContactGroup->addNagiosHostContactgroups($this); + */ + } + return $this->aNagiosContactGroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosContactGroup = null; + } + +} // BaseNagiosHostContactgroup diff --git a/classes/om/BaseNagiosHostContactgroupPeer.php b/classes/om/BaseNagiosHostContactgroupPeer.php new file mode 100755 index 0000000..b2cffca --- /dev/null +++ b/classes/om/BaseNagiosHostContactgroupPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Host', 'HostTemplate', 'Contactgroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'host', 'hostTemplate', 'contactgroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST, self::HOST_TEMPLATE, self::CONTACTGROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host', 'host_template', 'contactgroup', ), + 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, 'Host' => 1, 'HostTemplate' => 2, 'Contactgroup' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'host' => 1, 'hostTemplate' => 2, 'contactgroup' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST => 1, self::HOST_TEMPLATE => 2, self::CONTACTGROUP => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host' => 1, 'host_template' => 2, 'contactgroup' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostContactgroupMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostContactgroupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostContactgroupPeer::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) + { + + $criteria->addSelectColumn(NagiosHostContactgroupPeer::ID); + + $criteria->addSelectColumn(NagiosHostContactgroupPeer::HOST); + + $criteria->addSelectColumn(NagiosHostContactgroupPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostContactgroupPeer::CONTACTGROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostContactgroup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostContactgroupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostContactgroupPeer::populateObjects(NagiosHostContactgroupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostContactgroup $value A NagiosHostContactgroup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostContactgroup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostContactgroup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostContactgroup) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostContactgroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostContactgroup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostContactgroupPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostContactgroupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostContactgroupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to $obj2 (NagiosHost) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with their NagiosContactGroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactGroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to $obj2 (NagiosContactGroup) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactgroup($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostContactgroup($obj1); + } // if joined row not null + + // Add objects for joined NagiosContactGroup rows + + $key4 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosContactGroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosContactGroupPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj4 (NagiosContactGroup) + $obj4->addNagiosHostContactgroup($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostContactgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostContactgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactgroupPeer::CONTACTGROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostContactgroup objects pre-filled with all related objects except NagiosContactGroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostContactgroup objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostContactgroupPeer::addSelectColumns($c); + $startcol2 = (NagiosHostContactgroupPeer::NUM_COLUMNS - NagiosHostContactgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostContactgroupPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostContactgroupPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostContactgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostContactgroupPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostContactgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostContactgroupPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostContactgroup) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostContactgroup($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostContactgroupPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostContactgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosHostContactgroup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostContactgroup object + } + + if ($criteria->containsKey(NagiosHostContactgroupPeer::ID) && $criteria->keyContainsValue(NagiosHostContactgroupPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostContactgroupPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostContactgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosHostContactgroup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostContactgroupPeer::ID); + $selectCriteria->add(NagiosHostContactgroupPeer::ID, $criteria->remove(NagiosHostContactgroupPeer::ID), $comparison); + + } else { // $values is NagiosHostContactgroup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_contactgroup 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(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostContactgroupPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostContactgroup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostContactgroup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostContactgroupPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostContactgroup) { + // invalidate the cache for this single object + NagiosHostContactgroupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostContactgroupPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostContactgroupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostContactgroup 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 NagiosHostContactgroup $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(NagiosHostContactgroup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostContactgroupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostContactgroupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostContactgroupPeer::DATABASE_NAME, NagiosHostContactgroupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostContactgroup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostContactgroupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostContactgroupPeer::DATABASE_NAME); + $criteria->add(NagiosHostContactgroupPeer::ID, $pk); + + $v = NagiosHostContactgroupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostContactgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostContactgroupPeer::DATABASE_NAME); + $criteria->add(NagiosHostContactgroupPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostContactgroupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostContactgroupPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostContactgroupPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostContactgroupPeer class: +// +// Propel::getDatabaseMap(NagiosHostContactgroupPeer::DATABASE_NAME)->addTableBuilder(NagiosHostContactgroupPeer::TABLE_NAME, NagiosHostContactgroupPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostContactgroupPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostContactgroupPeer::TABLE_NAME, BaseNagiosHostContactgroupPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostParent.php b/classes/om/BaseNagiosHostParent.php new file mode 100755 index 0000000..ff22bac --- /dev/null +++ b/classes/om/BaseNagiosHostParent.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [child_host] column value. + * + * @return int + */ + public function getChildHost() + { + return $this->child_host; + } + + /** + * Get the [child_host_template] column value. + * + * @return int + */ + public function getChildHostTemplate() + { + return $this->child_host_template; + } + + /** + * Get the [parent_host] column value. + * + * @return int + */ + public function getParentHost() + { + return $this->parent_host; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostParent The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostParentPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [child_host] column. + * + * @param int $v new value + * @return NagiosHostParent The current object (for fluent API support) + */ + public function setChildHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->child_host !== $v) { + $this->child_host = $v; + $this->modifiedColumns[] = NagiosHostParentPeer::CHILD_HOST; + } + + if ($this->aNagiosHostRelatedByChildHost !== null && $this->aNagiosHostRelatedByChildHost->getId() !== $v) { + $this->aNagiosHostRelatedByChildHost = null; + } + + return $this; + } // setChildHost() + + /** + * Set the value of [child_host_template] column. + * + * @param int $v new value + * @return NagiosHostParent The current object (for fluent API support) + */ + public function setChildHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->child_host_template !== $v) { + $this->child_host_template = $v; + $this->modifiedColumns[] = NagiosHostParentPeer::CHILD_HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setChildHostTemplate() + + /** + * Set the value of [parent_host] column. + * + * @param int $v new value + * @return NagiosHostParent The current object (for fluent API support) + */ + public function setParentHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->parent_host !== $v) { + $this->parent_host = $v; + $this->modifiedColumns[] = NagiosHostParentPeer::PARENT_HOST; + } + + if ($this->aNagiosHostRelatedByParentHost !== null && $this->aNagiosHostRelatedByParentHost->getId() !== $v) { + $this->aNagiosHostRelatedByParentHost = null; + } + + return $this; + } // setParentHost() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->child_host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->child_host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->parent_host = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostParent object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHostRelatedByChildHost !== null && $this->child_host !== $this->aNagiosHostRelatedByChildHost->getId()) { + $this->aNagiosHostRelatedByChildHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->child_host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHostRelatedByParentHost !== null && $this->parent_host !== $this->aNagiosHostRelatedByParentHost->getId()) { + $this->aNagiosHostRelatedByParentHost = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostParentPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHostRelatedByChildHost = null; + $this->aNagiosHostRelatedByParentHost = null; + $this->aNagiosHostTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostParentPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostParentPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHostRelatedByChildHost !== null) { + if ($this->aNagiosHostRelatedByChildHost->isModified() || $this->aNagiosHostRelatedByChildHost->isNew()) { + $affectedRows += $this->aNagiosHostRelatedByChildHost->save($con); + } + $this->setNagiosHostRelatedByChildHost($this->aNagiosHostRelatedByChildHost); + } + + if ($this->aNagiosHostRelatedByParentHost !== null) { + if ($this->aNagiosHostRelatedByParentHost->isModified() || $this->aNagiosHostRelatedByParentHost->isNew()) { + $affectedRows += $this->aNagiosHostRelatedByParentHost->save($con); + } + $this->setNagiosHostRelatedByParentHost($this->aNagiosHostRelatedByParentHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostParentPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostParentPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostParentPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHostRelatedByChildHost !== null) { + if (!$this->aNagiosHostRelatedByChildHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostRelatedByChildHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostRelatedByParentHost !== null) { + if (!$this->aNagiosHostRelatedByParentHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostRelatedByParentHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosHostParentPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostParentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getChildHost(); + break; + case 2: + return $this->getChildHostTemplate(); + break; + case 3: + return $this->getParentHost(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostParentPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getChildHost(), + $keys[2] => $this->getChildHostTemplate(), + $keys[3] => $this->getParentHost(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostParentPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setChildHost($value); + break; + case 2: + $this->setChildHostTemplate($value); + break; + case 3: + $this->setParentHost($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostParentPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setChildHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setChildHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setParentHost($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(NagiosHostParentPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostParentPeer::ID)) $criteria->add(NagiosHostParentPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostParentPeer::CHILD_HOST)) $criteria->add(NagiosHostParentPeer::CHILD_HOST, $this->child_host); + if ($this->isColumnModified(NagiosHostParentPeer::CHILD_HOST_TEMPLATE)) $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->child_host_template); + if ($this->isColumnModified(NagiosHostParentPeer::PARENT_HOST)) $criteria->add(NagiosHostParentPeer::PARENT_HOST, $this->parent_host); + + 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(NagiosHostParentPeer::DATABASE_NAME); + + $criteria->add(NagiosHostParentPeer::ID, $this->id); + + 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 NagiosHostParent (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) + { + + $copyObj->setChildHost($this->child_host); + + $copyObj->setChildHostTemplate($this->child_host_template); + + $copyObj->setParentHost($this->parent_host); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostParent 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); + $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 NagiosHostParentPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostParentPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostParent The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostRelatedByChildHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setChildHost(NULL); + } else { + $this->setChildHost($v->getId()); + } + + $this->aNagiosHostRelatedByChildHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostParentRelatedByChildHost($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHostRelatedByChildHost(PropelPDO $con = null) + { + if ($this->aNagiosHostRelatedByChildHost === null && ($this->child_host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->child_host); + $this->aNagiosHostRelatedByChildHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostRelatedByChildHost->addNagiosHostParentsRelatedByChildHost($this); + */ + } + return $this->aNagiosHostRelatedByChildHost; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostParent The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostRelatedByParentHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setParentHost(NULL); + } else { + $this->setParentHost($v->getId()); + } + + $this->aNagiosHostRelatedByParentHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostParentRelatedByParentHost($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHostRelatedByParentHost(PropelPDO $con = null) + { + if ($this->aNagiosHostRelatedByParentHost === null && ($this->parent_host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->parent_host); + $this->aNagiosHostRelatedByParentHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostRelatedByParentHost->addNagiosHostParentsRelatedByParentHost($this); + */ + } + return $this->aNagiosHostRelatedByParentHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostParent The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setChildHostTemplate(NULL); + } else { + $this->setChildHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostParent($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->child_host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->child_host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostParents($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHostRelatedByChildHost = null; + $this->aNagiosHostRelatedByParentHost = null; + $this->aNagiosHostTemplate = null; + } + +} // BaseNagiosHostParent diff --git a/classes/om/BaseNagiosHostParentPeer.php b/classes/om/BaseNagiosHostParentPeer.php new file mode 100755 index 0000000..47f4b23 --- /dev/null +++ b/classes/om/BaseNagiosHostParentPeer.php @@ -0,0 +1,1612 @@ + array ('Id', 'ChildHost', 'ChildHostTemplate', 'ParentHost', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'childHost', 'childHostTemplate', 'parentHost', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::CHILD_HOST, self::CHILD_HOST_TEMPLATE, self::PARENT_HOST, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'child_host', 'child_host_template', 'parent_host', ), + 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, 'ChildHost' => 1, 'ChildHostTemplate' => 2, 'ParentHost' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'childHost' => 1, 'childHostTemplate' => 2, 'parentHost' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CHILD_HOST => 1, self::CHILD_HOST_TEMPLATE => 2, self::PARENT_HOST => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'child_host' => 1, 'child_host_template' => 2, 'parent_host' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostParentMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostParentPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostParentPeer::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) + { + + $criteria->addSelectColumn(NagiosHostParentPeer::ID); + + $criteria->addSelectColumn(NagiosHostParentPeer::CHILD_HOST); + + $criteria->addSelectColumn(NagiosHostParentPeer::CHILD_HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostParentPeer::PARENT_HOST); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostParent + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostParentPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostParentPeer::populateObjects(NagiosHostParentPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostParentPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostParent $value A NagiosHostParent object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostParent $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostParent object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostParent) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostParent object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostParent Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostParentPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostParentPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostParentPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostRelatedByChildHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostRelatedByChildHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostRelatedByParentHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostRelatedByParentHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostRelatedByChildHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to $obj2 (NagiosHost) + $obj2->addNagiosHostParentRelatedByChildHost($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostRelatedByParentHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to $obj2 (NagiosHost) + $obj2->addNagiosHostParentRelatedByParentHost($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostParent($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostParent objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol2 = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostParentRelatedByChildHost($obj1); + } // if joined row not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosHostParentRelatedByParentHost($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key4 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostTemplatePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj4 (NagiosHostTemplate) + $obj4->addNagiosHostParent($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostRelatedByChildHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostRelatedByChildHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostRelatedByParentHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostRelatedByParentHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostParentPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostParentPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with all related objects except NagiosHostRelatedByChildHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostRelatedByChildHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol2 = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostParent($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with all related objects except NagiosHostRelatedByParentHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostRelatedByParentHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol2 = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostParent($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostParent objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostParent objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostParentPeer::addSelectColumns($c); + $startcol2 = (NagiosHostParentPeer::NUM_COLUMNS - NagiosHostParentPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostParentPeer::CHILD_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostParentPeer::PARENT_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostParentPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostParentPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostParentPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostParentPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostParentRelatedByChildHost($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHost rows + + $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostParent) to the collection in $obj3 (NagiosHost) + $obj3->addNagiosHostParentRelatedByParentHost($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostParentPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostParent or Criteria object. + * + * @param mixed $values Criteria or NagiosHostParent object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostParent object + } + + if ($criteria->containsKey(NagiosHostParentPeer::ID) && $criteria->keyContainsValue(NagiosHostParentPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostParentPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostParent or Criteria object. + * + * @param mixed $values Criteria or NagiosHostParent object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostParentPeer::ID); + $selectCriteria->add(NagiosHostParentPeer::ID, $criteria->remove(NagiosHostParentPeer::ID), $comparison); + + } else { // $values is NagiosHostParent object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_parent 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(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostParentPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostParent or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostParent object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostParentPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostParent) { + // invalidate the cache for this single object + NagiosHostParentPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostParentPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostParentPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostParent 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 NagiosHostParent $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(NagiosHostParent $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostParentPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostParentPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostParentPeer::DATABASE_NAME, NagiosHostParentPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostParent + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostParentPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostParentPeer::DATABASE_NAME); + $criteria->add(NagiosHostParentPeer::ID, $pk); + + $v = NagiosHostParentPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostParentPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostParentPeer::DATABASE_NAME); + $criteria->add(NagiosHostParentPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostParentPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostParentPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostParentPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostParentPeer class: +// +// Propel::getDatabaseMap(NagiosHostParentPeer::DATABASE_NAME)->addTableBuilder(NagiosHostParentPeer::TABLE_NAME, NagiosHostParentPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostParentPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostParentPeer::TABLE_NAME, BaseNagiosHostParentPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostPeer.php b/classes/om/BaseNagiosHostPeer.php new file mode 100755 index 0000000..75acc35 --- /dev/null +++ b/classes/om/BaseNagiosHostPeer.php @@ -0,0 +1,2357 @@ + array ('Id', 'Name', 'Alias', 'DisplayName', 'InitialState', 'Address', 'CheckCommand', 'RetryInterval', 'FirstNotificationDelay', 'MaximumCheckAttempts', 'CheckInterval', 'PassiveChecksEnabled', 'CheckPeriod', 'ObsessOverHost', 'CheckFreshness', 'FreshnessThreshold', 'ActiveChecksEnabled', 'ChecksEnabled', 'EventHandler', 'EventHandlerEnabled', 'LowFlapThreshold', 'HighFlapThreshold', 'FlapDetectionEnabled', 'ProcessPerfData', 'RetainStatusInformation', 'RetainNonstatusInformation', 'NotificationInterval', 'NotificationPeriod', 'NotificationsEnabled', 'NotificationOnDown', 'NotificationOnUnreachable', 'NotificationOnRecovery', 'NotificationOnFlapping', 'NotificationOnScheduledDowntime', 'StalkingOnUp', 'StalkingOnDown', 'StalkingOnUnreachable', 'FailurePredictionEnabled', 'FlapDetectionOnUp', 'FlapDetectionOnDown', 'FlapDetectionOnUnreachable', 'Notes', 'NotesUrl', 'ActionUrl', 'IconImage', 'IconImageAlt', 'VrmlImage', 'StatusmapImage', 'TwoDCoords', 'ThreeDCoords', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', 'displayName', 'initialState', 'address', 'checkCommand', 'retryInterval', 'firstNotificationDelay', 'maximumCheckAttempts', 'checkInterval', 'passiveChecksEnabled', 'checkPeriod', 'obsessOverHost', 'checkFreshness', 'freshnessThreshold', 'activeChecksEnabled', 'checksEnabled', 'eventHandler', 'eventHandlerEnabled', 'lowFlapThreshold', 'highFlapThreshold', 'flapDetectionEnabled', 'processPerfData', 'retainStatusInformation', 'retainNonstatusInformation', 'notificationInterval', 'notificationPeriod', 'notificationsEnabled', 'notificationOnDown', 'notificationOnUnreachable', 'notificationOnRecovery', 'notificationOnFlapping', 'notificationOnScheduledDowntime', 'stalkingOnUp', 'stalkingOnDown', 'stalkingOnUnreachable', 'failurePredictionEnabled', 'flapDetectionOnUp', 'flapDetectionOnDown', 'flapDetectionOnUnreachable', 'notes', 'notesUrl', 'actionUrl', 'iconImage', 'iconImageAlt', 'vrmlImage', 'statusmapImage', 'twoDCoords', 'threeDCoords', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, self::DISPLAY_NAME, self::INITIAL_STATE, self::ADDRESS, self::CHECK_COMMAND, self::RETRY_INTERVAL, self::FIRST_NOTIFICATION_DELAY, self::MAXIMUM_CHECK_ATTEMPTS, self::CHECK_INTERVAL, self::PASSIVE_CHECKS_ENABLED, self::CHECK_PERIOD, self::OBSESS_OVER_HOST, self::CHECK_FRESHNESS, self::FRESHNESS_THRESHOLD, self::ACTIVE_CHECKS_ENABLED, self::CHECKS_ENABLED, self::EVENT_HANDLER, self::EVENT_HANDLER_ENABLED, self::LOW_FLAP_THRESHOLD, self::HIGH_FLAP_THRESHOLD, self::FLAP_DETECTION_ENABLED, self::PROCESS_PERF_DATA, self::RETAIN_STATUS_INFORMATION, self::RETAIN_NONSTATUS_INFORMATION, self::NOTIFICATION_INTERVAL, self::NOTIFICATION_PERIOD, self::NOTIFICATIONS_ENABLED, self::NOTIFICATION_ON_DOWN, self::NOTIFICATION_ON_UNREACHABLE, self::NOTIFICATION_ON_RECOVERY, self::NOTIFICATION_ON_FLAPPING, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME, self::STALKING_ON_UP, self::STALKING_ON_DOWN, self::STALKING_ON_UNREACHABLE, self::FAILURE_PREDICTION_ENABLED, self::FLAP_DETECTION_ON_UP, self::FLAP_DETECTION_ON_DOWN, self::FLAP_DETECTION_ON_UNREACHABLE, self::NOTES, self::NOTES_URL, self::ACTION_URL, self::ICON_IMAGE, self::ICON_IMAGE_ALT, self::VRML_IMAGE, self::STATUSMAP_IMAGE, self::TWO_D_COORDS, self::THREE_D_COORDS, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', 'display_name', 'initial_state', 'address', 'check_command', 'retry_interval', 'first_notification_delay', 'maximum_check_attempts', 'check_interval', 'passive_checks_enabled', 'check_period', 'obsess_over_host', 'check_freshness', 'freshness_threshold', 'active_checks_enabled', 'checks_enabled', 'event_handler', 'event_handler_enabled', 'low_flap_threshold', 'high_flap_threshold', 'flap_detection_enabled', 'process_perf_data', 'retain_status_information', 'retain_nonstatus_information', 'notification_interval', 'notification_period', 'notifications_enabled', 'notification_on_down', 'notification_on_unreachable', 'notification_on_recovery', 'notification_on_flapping', 'notification_on_scheduled_downtime', 'stalking_on_up', 'stalking_on_down', 'stalking_on_unreachable', 'failure_prediction_enabled', 'flap_detection_on_up', 'flap_detection_on_down', 'flap_detection_on_unreachable', 'notes', 'notes_url', 'action_url', 'icon_image', 'icon_image_alt', 'vrml_image', 'statusmap_image', 'two_d_coords', 'three_d_coords', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ) + ); + + /** + * 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, 'Name' => 1, 'Alias' => 2, 'DisplayName' => 3, 'InitialState' => 4, 'Address' => 5, 'CheckCommand' => 6, 'RetryInterval' => 7, 'FirstNotificationDelay' => 8, 'MaximumCheckAttempts' => 9, 'CheckInterval' => 10, 'PassiveChecksEnabled' => 11, 'CheckPeriod' => 12, 'ObsessOverHost' => 13, 'CheckFreshness' => 14, 'FreshnessThreshold' => 15, 'ActiveChecksEnabled' => 16, 'ChecksEnabled' => 17, 'EventHandler' => 18, 'EventHandlerEnabled' => 19, 'LowFlapThreshold' => 20, 'HighFlapThreshold' => 21, 'FlapDetectionEnabled' => 22, 'ProcessPerfData' => 23, 'RetainStatusInformation' => 24, 'RetainNonstatusInformation' => 25, 'NotificationInterval' => 26, 'NotificationPeriod' => 27, 'NotificationsEnabled' => 28, 'NotificationOnDown' => 29, 'NotificationOnUnreachable' => 30, 'NotificationOnRecovery' => 31, 'NotificationOnFlapping' => 32, 'NotificationOnScheduledDowntime' => 33, 'StalkingOnUp' => 34, 'StalkingOnDown' => 35, 'StalkingOnUnreachable' => 36, 'FailurePredictionEnabled' => 37, 'FlapDetectionOnUp' => 38, 'FlapDetectionOnDown' => 39, 'FlapDetectionOnUnreachable' => 40, 'Notes' => 41, 'NotesUrl' => 42, 'ActionUrl' => 43, 'IconImage' => 44, 'IconImageAlt' => 45, 'VrmlImage' => 46, 'StatusmapImage' => 47, 'TwoDCoords' => 48, 'ThreeDCoords' => 49, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'displayName' => 3, 'initialState' => 4, 'address' => 5, 'checkCommand' => 6, 'retryInterval' => 7, 'firstNotificationDelay' => 8, 'maximumCheckAttempts' => 9, 'checkInterval' => 10, 'passiveChecksEnabled' => 11, 'checkPeriod' => 12, 'obsessOverHost' => 13, 'checkFreshness' => 14, 'freshnessThreshold' => 15, 'activeChecksEnabled' => 16, 'checksEnabled' => 17, 'eventHandler' => 18, 'eventHandlerEnabled' => 19, 'lowFlapThreshold' => 20, 'highFlapThreshold' => 21, 'flapDetectionEnabled' => 22, 'processPerfData' => 23, 'retainStatusInformation' => 24, 'retainNonstatusInformation' => 25, 'notificationInterval' => 26, 'notificationPeriod' => 27, 'notificationsEnabled' => 28, 'notificationOnDown' => 29, 'notificationOnUnreachable' => 30, 'notificationOnRecovery' => 31, 'notificationOnFlapping' => 32, 'notificationOnScheduledDowntime' => 33, 'stalkingOnUp' => 34, 'stalkingOnDown' => 35, 'stalkingOnUnreachable' => 36, 'failurePredictionEnabled' => 37, 'flapDetectionOnUp' => 38, 'flapDetectionOnDown' => 39, 'flapDetectionOnUnreachable' => 40, 'notes' => 41, 'notesUrl' => 42, 'actionUrl' => 43, 'iconImage' => 44, 'iconImageAlt' => 45, 'vrmlImage' => 46, 'statusmapImage' => 47, 'twoDCoords' => 48, 'threeDCoords' => 49, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, self::DISPLAY_NAME => 3, self::INITIAL_STATE => 4, self::ADDRESS => 5, self::CHECK_COMMAND => 6, self::RETRY_INTERVAL => 7, self::FIRST_NOTIFICATION_DELAY => 8, self::MAXIMUM_CHECK_ATTEMPTS => 9, self::CHECK_INTERVAL => 10, self::PASSIVE_CHECKS_ENABLED => 11, self::CHECK_PERIOD => 12, self::OBSESS_OVER_HOST => 13, self::CHECK_FRESHNESS => 14, self::FRESHNESS_THRESHOLD => 15, self::ACTIVE_CHECKS_ENABLED => 16, self::CHECKS_ENABLED => 17, self::EVENT_HANDLER => 18, self::EVENT_HANDLER_ENABLED => 19, self::LOW_FLAP_THRESHOLD => 20, self::HIGH_FLAP_THRESHOLD => 21, self::FLAP_DETECTION_ENABLED => 22, self::PROCESS_PERF_DATA => 23, self::RETAIN_STATUS_INFORMATION => 24, self::RETAIN_NONSTATUS_INFORMATION => 25, self::NOTIFICATION_INTERVAL => 26, self::NOTIFICATION_PERIOD => 27, self::NOTIFICATIONS_ENABLED => 28, self::NOTIFICATION_ON_DOWN => 29, self::NOTIFICATION_ON_UNREACHABLE => 30, self::NOTIFICATION_ON_RECOVERY => 31, self::NOTIFICATION_ON_FLAPPING => 32, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME => 33, self::STALKING_ON_UP => 34, self::STALKING_ON_DOWN => 35, self::STALKING_ON_UNREACHABLE => 36, self::FAILURE_PREDICTION_ENABLED => 37, self::FLAP_DETECTION_ON_UP => 38, self::FLAP_DETECTION_ON_DOWN => 39, self::FLAP_DETECTION_ON_UNREACHABLE => 40, self::NOTES => 41, self::NOTES_URL => 42, self::ACTION_URL => 43, self::ICON_IMAGE => 44, self::ICON_IMAGE_ALT => 45, self::VRML_IMAGE => 46, self::STATUSMAP_IMAGE => 47, self::TWO_D_COORDS => 48, self::THREE_D_COORDS => 49, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'display_name' => 3, 'initial_state' => 4, 'address' => 5, 'check_command' => 6, 'retry_interval' => 7, 'first_notification_delay' => 8, 'maximum_check_attempts' => 9, 'check_interval' => 10, 'passive_checks_enabled' => 11, 'check_period' => 12, 'obsess_over_host' => 13, 'check_freshness' => 14, 'freshness_threshold' => 15, 'active_checks_enabled' => 16, 'checks_enabled' => 17, 'event_handler' => 18, 'event_handler_enabled' => 19, 'low_flap_threshold' => 20, 'high_flap_threshold' => 21, 'flap_detection_enabled' => 22, 'process_perf_data' => 23, 'retain_status_information' => 24, 'retain_nonstatus_information' => 25, 'notification_interval' => 26, 'notification_period' => 27, 'notifications_enabled' => 28, 'notification_on_down' => 29, 'notification_on_unreachable' => 30, 'notification_on_recovery' => 31, 'notification_on_flapping' => 32, 'notification_on_scheduled_downtime' => 33, 'stalking_on_up' => 34, 'stalking_on_down' => 35, 'stalking_on_unreachable' => 36, 'failure_prediction_enabled' => 37, 'flap_detection_on_up' => 38, 'flap_detection_on_down' => 39, 'flap_detection_on_unreachable' => 40, 'notes' => 41, 'notes_url' => 42, 'action_url' => 43, 'icon_image' => 44, 'icon_image_alt' => 45, 'vrml_image' => 46, 'statusmap_image' => 47, 'two_d_coords' => 48, 'three_d_coords' => 49, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostPeer::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) + { + + $criteria->addSelectColumn(NagiosHostPeer::ID); + + $criteria->addSelectColumn(NagiosHostPeer::NAME); + + $criteria->addSelectColumn(NagiosHostPeer::ALIAS); + + $criteria->addSelectColumn(NagiosHostPeer::DISPLAY_NAME); + + $criteria->addSelectColumn(NagiosHostPeer::INITIAL_STATE); + + $criteria->addSelectColumn(NagiosHostPeer::ADDRESS); + + $criteria->addSelectColumn(NagiosHostPeer::CHECK_COMMAND); + + $criteria->addSelectColumn(NagiosHostPeer::RETRY_INTERVAL); + + $criteria->addSelectColumn(NagiosHostPeer::FIRST_NOTIFICATION_DELAY); + + $criteria->addSelectColumn(NagiosHostPeer::MAXIMUM_CHECK_ATTEMPTS); + + $criteria->addSelectColumn(NagiosHostPeer::CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosHostPeer::PASSIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::CHECK_PERIOD); + + $criteria->addSelectColumn(NagiosHostPeer::OBSESS_OVER_HOST); + + $criteria->addSelectColumn(NagiosHostPeer::CHECK_FRESHNESS); + + $criteria->addSelectColumn(NagiosHostPeer::FRESHNESS_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostPeer::ACTIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosHostPeer::EVENT_HANDLER_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::LOW_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostPeer::HIGH_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostPeer::FLAP_DETECTION_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::PROCESS_PERF_DATA); + + $criteria->addSelectColumn(NagiosHostPeer::RETAIN_STATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosHostPeer::RETAIN_NONSTATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_INTERVAL); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosHostPeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME); + + $criteria->addSelectColumn(NagiosHostPeer::STALKING_ON_UP); + + $criteria->addSelectColumn(NagiosHostPeer::STALKING_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostPeer::STALKING_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostPeer::FAILURE_PREDICTION_ENABLED); + + $criteria->addSelectColumn(NagiosHostPeer::FLAP_DETECTION_ON_UP); + + $criteria->addSelectColumn(NagiosHostPeer::FLAP_DETECTION_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostPeer::FLAP_DETECTION_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostPeer::NOTES); + + $criteria->addSelectColumn(NagiosHostPeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosHostPeer::ACTION_URL); + + $criteria->addSelectColumn(NagiosHostPeer::ICON_IMAGE); + + $criteria->addSelectColumn(NagiosHostPeer::ICON_IMAGE_ALT); + + $criteria->addSelectColumn(NagiosHostPeer::VRML_IMAGE); + + $criteria->addSelectColumn(NagiosHostPeer::STATUSMAP_IMAGE); + + $criteria->addSelectColumn(NagiosHostPeer::TWO_D_COORDS); + + $criteria->addSelectColumn(NagiosHostPeer::THREE_D_COORDS); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHost + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostPeer::populateObjects(NagiosHostPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHost $value A NagiosHost object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHost $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHost object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHost) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHost object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHost Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHost) to $obj2 (NagiosCommand) + $obj2->addNagiosHostRelatedByCheckCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHost) to $obj2 (NagiosCommand) + $obj2->addNagiosHostRelatedByEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHost) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostRelatedByCheckPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHost) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostRelatedByNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHost objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol2 = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostRelatedByCheckCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostRelatedByEventHandler($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key4 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosTimeperiodPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosTimeperiodPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj4 (NagiosTimeperiod) + $obj4->addNagiosHostRelatedByCheckPeriod($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key5 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosTimeperiodPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosTimeperiodPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj5 (NagiosTimeperiod) + $obj5->addNagiosHostRelatedByNotificationPeriod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with all related objects except NagiosCommandRelatedByCheckCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol2 = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosHostRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with all related objects except NagiosCommandRelatedByEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol2 = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostPeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosHostRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with all related objects except NagiosTimeperiodRelatedByCheckPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol2 = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHost objects pre-filled with all related objects except NagiosTimeperiodRelatedByNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHost objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostPeer::addSelectColumns($c); + $startcol2 = (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostPeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostPeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHost) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHost or Criteria object. + * + * @param mixed $values Criteria or NagiosHost object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHost object + } + + if ($criteria->containsKey(NagiosHostPeer::ID) && $criteria->keyContainsValue(NagiosHostPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHost or Criteria object. + * + * @param mixed $values Criteria or NagiosHost object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostPeer::ID); + $selectCriteria->add(NagiosHostPeer::ID, $criteria->remove(NagiosHostPeer::ID), $comparison); + + } else { // $values is NagiosHost object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host 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(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosHostPeer::doOnDeleteCascade(new Criteria(NagiosHostPeer::DATABASE_NAME), $con); + NagiosHostPeer::doOnDeleteSetNull(new Criteria(NagiosHostPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosHostPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHost or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHost object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHost) { + // invalidate the cache for this single object + NagiosHostPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosHostPeer::doOnDeleteCascade($criteria, $con); + NagiosHostPeer::doOnDeleteSetNull($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosHostPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosHostPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyTargetPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyTargetPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactgroupPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactgroupPeer::clearInstancePool(); + + // invalidate objects in NagiosHostgroupMembershipPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostgroupMembershipPeer::clearInstancePool(); + + // invalidate objects in NagiosHostCheckCommandParameterPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostCheckCommandParameterPeer::clearInstancePool(); + + // invalidate objects in NagiosHostParentPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostParentPeer::clearInstancePool(); + + // invalidate objects in NagiosHostParentPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostParentPeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplateInheritancePeer::clearInstancePool(); + + // invalidate objects in AutodiscoveryDevicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDevicePeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosHostPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosService objects + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + + $c->add(NagiosServicePeer::HOST, $obj->getId()); + $affectedRows += NagiosServicePeer::doDelete($c, $con); + + // delete related NagiosHostContactMember objects + $c = new Criteria(NagiosHostContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosHostContactMemberPeer::HOST, $obj->getId()); + $affectedRows += NagiosHostContactMemberPeer::doDelete($c, $con); + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::HOST, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + + // delete related NagiosDependencyTarget objects + $c = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + + $c->add(NagiosDependencyTargetPeer::TARGET_HOST, $obj->getId()); + $affectedRows += NagiosDependencyTargetPeer::doDelete($c, $con); + + // delete related NagiosEscalation objects + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + + $c->add(NagiosEscalationPeer::HOST, $obj->getId()); + $affectedRows += NagiosEscalationPeer::doDelete($c, $con); + + // delete related NagiosHostContactgroup objects + $c = new Criteria(NagiosHostContactgroupPeer::DATABASE_NAME); + + $c->add(NagiosHostContactgroupPeer::HOST, $obj->getId()); + $affectedRows += NagiosHostContactgroupPeer::doDelete($c, $con); + + // delete related NagiosHostgroupMembership objects + $c = new Criteria(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + $c->add(NagiosHostgroupMembershipPeer::HOST, $obj->getId()); + $affectedRows += NagiosHostgroupMembershipPeer::doDelete($c, $con); + + // delete related NagiosHostCheckCommandParameter objects + $c = new Criteria(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + + $c->add(NagiosHostCheckCommandParameterPeer::HOST, $obj->getId()); + $affectedRows += NagiosHostCheckCommandParameterPeer::doDelete($c, $con); + + // delete related NagiosHostParent objects + $c = new Criteria(NagiosHostParentPeer::DATABASE_NAME); + + $c->add(NagiosHostParentPeer::CHILD_HOST, $obj->getId()); + $affectedRows += NagiosHostParentPeer::doDelete($c, $con); + + // delete related NagiosHostParent objects + $c = new Criteria(NagiosHostParentPeer::DATABASE_NAME); + + $c->add(NagiosHostParentPeer::PARENT_HOST, $obj->getId()); + $affectedRows += NagiosHostParentPeer::doDelete($c, $con); + + // delete related NagiosHostTemplateInheritance objects + $c = new Criteria(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $obj->getId()); + $affectedRows += NagiosHostTemplateInheritancePeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * This is a method for emulating ON DELETE SET NULL DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return void + */ + protected static function doOnDeleteSetNull(Criteria $criteria, PropelPDO $con) + { + + // first find the objects that are implicated by the $criteria + $objects = NagiosHostPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + // set fkey col in related AutodiscoveryDevice rows to NULL + $selectCriteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosHostPeer::DATABASE_NAME); + $selectCriteria->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, $obj->getId()); + $updateValues->add(AutodiscoveryDevicePeer::PROPOSED_PARENT, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + } + } + + /** + * Validates all modified columns of given NagiosHost 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 NagiosHost $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(NagiosHost $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostPeer::DATABASE_NAME, NagiosHostPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHost + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + $criteria->add(NagiosHostPeer::ID, $pk); + + $v = NagiosHostPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostPeer::DATABASE_NAME); + $criteria->add(NagiosHostPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostPeer class: +// +// Propel::getDatabaseMap(NagiosHostPeer::DATABASE_NAME)->addTableBuilder(NagiosHostPeer::TABLE_NAME, NagiosHostPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostPeer::TABLE_NAME, BaseNagiosHostPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostTemplate.php b/classes/om/BaseNagiosHostTemplate.php new file mode 100755 index 0000000..ca72caa --- /dev/null +++ b/classes/om/BaseNagiosHostTemplate.php @@ -0,0 +1,7394 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [initial_state] column value. + * + * @return string + */ + public function getInitialState() + { + return $this->initial_state; + } + + /** + * Get the [check_command] column value. + * + * @return int + */ + public function getCheckCommand() + { + return $this->check_command; + } + + /** + * Get the [retry_interval] column value. + * + * @return int + */ + public function getRetryInterval() + { + return $this->retry_interval; + } + + /** + * Get the [first_notification_delay] column value. + * + * @return int + */ + public function getFirstNotificationDelay() + { + return $this->first_notification_delay; + } + + /** + * Get the [maximum_check_attempts] column value. + * + * @return int + */ + public function getMaximumCheckAttempts() + { + return $this->maximum_check_attempts; + } + + /** + * Get the [check_interval] column value. + * + * @return int + */ + public function getCheckInterval() + { + return $this->check_interval; + } + + /** + * Get the [passive_checks_enabled] column value. + * + * @return boolean + */ + public function getPassiveChecksEnabled() + { + return $this->passive_checks_enabled; + } + + /** + * Get the [check_period] column value. + * + * @return int + */ + public function getCheckPeriod() + { + return $this->check_period; + } + + /** + * Get the [obsess_over_host] column value. + * + * @return boolean + */ + public function getObsessOverHost() + { + return $this->obsess_over_host; + } + + /** + * Get the [check_freshness] column value. + * + * @return boolean + */ + public function getCheckFreshness() + { + return $this->check_freshness; + } + + /** + * Get the [freshness_threshold] column value. + * + * @return int + */ + public function getFreshnessThreshold() + { + return $this->freshness_threshold; + } + + /** + * Get the [active_checks_enabled] column value. + * + * @return boolean + */ + public function getActiveChecksEnabled() + { + return $this->active_checks_enabled; + } + + /** + * Get the [checks_enabled] column value. + * + * @return boolean + */ + public function getChecksEnabled() + { + return $this->checks_enabled; + } + + /** + * Get the [event_handler] column value. + * + * @return int + */ + public function getEventHandler() + { + return $this->event_handler; + } + + /** + * Get the [event_handler_enabled] column value. + * + * @return boolean + */ + public function getEventHandlerEnabled() + { + return $this->event_handler_enabled; + } + + /** + * Get the [low_flap_threshold] column value. + * + * @return int + */ + public function getLowFlapThreshold() + { + return $this->low_flap_threshold; + } + + /** + * Get the [high_flap_threshold] column value. + * + * @return int + */ + public function getHighFlapThreshold() + { + return $this->high_flap_threshold; + } + + /** + * Get the [flap_detection_enabled] column value. + * + * @return boolean + */ + public function getFlapDetectionEnabled() + { + return $this->flap_detection_enabled; + } + + /** + * Get the [process_perf_data] column value. + * + * @return boolean + */ + public function getProcessPerfData() + { + return $this->process_perf_data; + } + + /** + * Get the [retain_status_information] column value. + * + * @return boolean + */ + public function getRetainStatusInformation() + { + return $this->retain_status_information; + } + + /** + * Get the [retain_nonstatus_information] column value. + * + * @return boolean + */ + public function getRetainNonstatusInformation() + { + return $this->retain_nonstatus_information; + } + + /** + * Get the [notification_interval] column value. + * + * @return int + */ + public function getNotificationInterval() + { + return $this->notification_interval; + } + + /** + * Get the [notification_period] column value. + * + * @return int + */ + public function getNotificationPeriod() + { + return $this->notification_period; + } + + /** + * Get the [notifications_enabled] column value. + * + * @return boolean + */ + public function getNotificationsEnabled() + { + return $this->notifications_enabled; + } + + /** + * Get the [notification_on_down] column value. + * + * @return boolean + */ + public function getNotificationOnDown() + { + return $this->notification_on_down; + } + + /** + * Get the [notification_on_unreachable] column value. + * + * @return boolean + */ + public function getNotificationOnUnreachable() + { + return $this->notification_on_unreachable; + } + + /** + * Get the [notification_on_recovery] column value. + * + * @return boolean + */ + public function getNotificationOnRecovery() + { + return $this->notification_on_recovery; + } + + /** + * Get the [notification_on_flapping] column value. + * + * @return boolean + */ + public function getNotificationOnFlapping() + { + return $this->notification_on_flapping; + } + + /** + * Get the [notification_on_scheduled_downtime] column value. + * + * @return boolean + */ + public function getNotificationOnScheduledDowntime() + { + return $this->notification_on_scheduled_downtime; + } + + /** + * Get the [stalking_on_up] column value. + * + * @return boolean + */ + public function getStalkingOnUp() + { + return $this->stalking_on_up; + } + + /** + * Get the [stalking_on_down] column value. + * + * @return boolean + */ + public function getStalkingOnDown() + { + return $this->stalking_on_down; + } + + /** + * Get the [stalking_on_unreachable] column value. + * + * @return boolean + */ + public function getStalkingOnUnreachable() + { + return $this->stalking_on_unreachable; + } + + /** + * Get the [failure_prediction_enabled] column value. + * + * @return boolean + */ + public function getFailurePredictionEnabled() + { + return $this->failure_prediction_enabled; + } + + /** + * Get the [flap_detection_on_up] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUp() + { + return $this->flap_detection_on_up; + } + + /** + * Get the [flap_detection_on_down] column value. + * + * @return boolean + */ + public function getFlapDetectionOnDown() + { + return $this->flap_detection_on_down; + } + + /** + * Get the [flap_detection_on_unreachable] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUnreachable() + { + return $this->flap_detection_on_unreachable; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Get the [icon_image] column value. + * + * @return string + */ + public function getIconImage() + { + return $this->icon_image; + } + + /** + * Get the [icon_image_alt] column value. + * + * @return string + */ + public function getIconImageAlt() + { + return $this->icon_image_alt; + } + + /** + * Get the [vrml_image] column value. + * + * @return string + */ + public function getVrmlImage() + { + return $this->vrml_image; + } + + /** + * Get the [statusmap_image] column value. + * + * @return string + */ + public function getStatusmapImage() + { + return $this->statusmap_image; + } + + /** + * Get the [two_d_coords] column value. + * + * @return string + */ + public function getTwoDCoords() + { + return $this->two_d_coords; + } + + /** + * Get the [three_d_coords] column value. + * + * @return string + */ + public function getThreeDCoords() + { + return $this->three_d_coords; + } + + /** + * Get the [autodiscovery_address_filter] column value. + * + * @return string + */ + public function getAutodiscoveryAddressFilter() + { + return $this->autodiscovery_address_filter; + } + + /** + * Get the [autodiscovery_hostname_filter] column value. + * + * @return string + */ + public function getAutodiscoveryHostnameFilter() + { + return $this->autodiscovery_hostname_filter; + } + + /** + * Get the [autodiscovery_os_family_filter] column value. + * + * @return string + */ + public function getAutodiscoveryOsFamilyFilter() + { + return $this->autodiscovery_os_family_filter; + } + + /** + * Get the [autodiscovery_os_generation_filter] column value. + * + * @return string + */ + public function getAutodiscoveryOsGenerationFilter() + { + return $this->autodiscovery_os_generation_filter; + } + + /** + * Get the [autodiscovery_os_vendor_filter] column value. + * + * @return string + */ + public function getAutodiscoveryOsVendorFilter() + { + return $this->autodiscovery_os_vendor_filter; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [initial_state] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setInitialState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->initial_state !== $v) { + $this->initial_state = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::INITIAL_STATE; + } + + return $this; + } // setInitialState() + + /** + * Set the value of [check_command] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setCheckCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_command !== $v) { + $this->check_command = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::CHECK_COMMAND; + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->aNagiosCommandRelatedByCheckCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + + return $this; + } // setCheckCommand() + + /** + * Set the value of [retry_interval] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setRetryInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retry_interval !== $v) { + $this->retry_interval = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::RETRY_INTERVAL; + } + + return $this; + } // setRetryInterval() + + /** + * Set the value of [first_notification_delay] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFirstNotificationDelay($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->first_notification_delay !== $v) { + $this->first_notification_delay = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FIRST_NOTIFICATION_DELAY; + } + + return $this; + } // setFirstNotificationDelay() + + /** + * Set the value of [maximum_check_attempts] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setMaximumCheckAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->maximum_check_attempts !== $v) { + $this->maximum_check_attempts = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::MAXIMUM_CHECK_ATTEMPTS; + } + + return $this; + } // setMaximumCheckAttempts() + + /** + * Set the value of [check_interval] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_interval !== $v) { + $this->check_interval = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::CHECK_INTERVAL; + } + + return $this; + } // setCheckInterval() + + /** + * Set the value of [passive_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setPassiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->passive_checks_enabled !== $v) { + $this->passive_checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::PASSIVE_CHECKS_ENABLED; + } + + return $this; + } // setPassiveChecksEnabled() + + /** + * Set the value of [check_period] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setCheckPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_period !== $v) { + $this->check_period = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::CHECK_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->aNagiosTimeperiodRelatedByCheckPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + + return $this; + } // setCheckPeriod() + + /** + * Set the value of [obsess_over_host] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setObsessOverHost($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_host !== $v) { + $this->obsess_over_host = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::OBSESS_OVER_HOST; + } + + return $this; + } // setObsessOverHost() + + /** + * Set the value of [check_freshness] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setCheckFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_freshness !== $v) { + $this->check_freshness = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::CHECK_FRESHNESS; + } + + return $this; + } // setCheckFreshness() + + /** + * Set the value of [freshness_threshold] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFreshnessThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->freshness_threshold !== $v) { + $this->freshness_threshold = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FRESHNESS_THRESHOLD; + } + + return $this; + } // setFreshnessThreshold() + + /** + * Set the value of [active_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setActiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->active_checks_enabled !== $v) { + $this->active_checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::ACTIVE_CHECKS_ENABLED; + } + + return $this; + } // setActiveChecksEnabled() + + /** + * Set the value of [checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->checks_enabled !== $v) { + $this->checks_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::CHECKS_ENABLED; + } + + return $this; + } // setChecksEnabled() + + /** + * Set the value of [event_handler] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->event_handler !== $v) { + $this->event_handler = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->aNagiosCommandRelatedByEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + + return $this; + } // setEventHandler() + + /** + * Set the value of [event_handler_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setEventHandlerEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->event_handler_enabled !== $v) { + $this->event_handler_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::EVENT_HANDLER_ENABLED; + } + + return $this; + } // setEventHandlerEnabled() + + /** + * Set the value of [low_flap_threshold] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setLowFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->low_flap_threshold !== $v) { + $this->low_flap_threshold = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::LOW_FLAP_THRESHOLD; + } + + return $this; + } // setLowFlapThreshold() + + /** + * Set the value of [high_flap_threshold] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setHighFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->high_flap_threshold !== $v) { + $this->high_flap_threshold = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::HIGH_FLAP_THRESHOLD; + } + + return $this; + } // setHighFlapThreshold() + + /** + * Set the value of [flap_detection_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFlapDetectionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_enabled !== $v) { + $this->flap_detection_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FLAP_DETECTION_ENABLED; + } + + return $this; + } // setFlapDetectionEnabled() + + /** + * Set the value of [process_perf_data] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setProcessPerfData($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->process_perf_data !== $v) { + $this->process_perf_data = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::PROCESS_PERF_DATA; + } + + return $this; + } // setProcessPerfData() + + /** + * Set the value of [retain_status_information] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setRetainStatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_status_information !== $v) { + $this->retain_status_information = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::RETAIN_STATUS_INFORMATION; + } + + return $this; + } // setRetainStatusInformation() + + /** + * Set the value of [retain_nonstatus_information] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setRetainNonstatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_nonstatus_information !== $v) { + $this->retain_nonstatus_information = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::RETAIN_NONSTATUS_INFORMATION; + } + + return $this; + } // setRetainNonstatusInformation() + + /** + * Set the value of [notification_interval] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_interval !== $v) { + $this->notification_interval = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_INTERVAL; + } + + return $this; + } // setNotificationInterval() + + /** + * Set the value of [notification_period] column. + * + * @param int $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_period !== $v) { + $this->notification_period = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + + return $this; + } // setNotificationPeriod() + + /** + * Set the value of [notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notifications_enabled !== $v) { + $this->notifications_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATIONS_ENABLED; + } + + return $this; + } // setNotificationsEnabled() + + /** + * Set the value of [notification_on_down] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_down !== $v) { + $this->notification_on_down = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_ON_DOWN; + } + + return $this; + } // setNotificationOnDown() + + /** + * Set the value of [notification_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_unreachable !== $v) { + $this->notification_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_ON_UNREACHABLE; + } + + return $this; + } // setNotificationOnUnreachable() + + /** + * Set the value of [notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_recovery !== $v) { + $this->notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setNotificationOnRecovery() + + /** + * Set the value of [notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_flapping !== $v) { + $this->notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setNotificationOnFlapping() + + /** + * Set the value of [notification_on_scheduled_downtime] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotificationOnScheduledDowntime($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_scheduled_downtime !== $v) { + $this->notification_on_scheduled_downtime = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME; + } + + return $this; + } // setNotificationOnScheduledDowntime() + + /** + * Set the value of [stalking_on_up] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setStalkingOnUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_up !== $v) { + $this->stalking_on_up = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::STALKING_ON_UP; + } + + return $this; + } // setStalkingOnUp() + + /** + * Set the value of [stalking_on_down] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setStalkingOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_down !== $v) { + $this->stalking_on_down = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::STALKING_ON_DOWN; + } + + return $this; + } // setStalkingOnDown() + + /** + * Set the value of [stalking_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setStalkingOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_unreachable !== $v) { + $this->stalking_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::STALKING_ON_UNREACHABLE; + } + + return $this; + } // setStalkingOnUnreachable() + + /** + * Set the value of [failure_prediction_enabled] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFailurePredictionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->failure_prediction_enabled !== $v) { + $this->failure_prediction_enabled = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FAILURE_PREDICTION_ENABLED; + } + + return $this; + } // setFailurePredictionEnabled() + + /** + * Set the value of [flap_detection_on_up] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnUp($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_up !== $v) { + $this->flap_detection_on_up = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FLAP_DETECTION_ON_UP; + } + + return $this; + } // setFlapDetectionOnUp() + + /** + * Set the value of [flap_detection_on_down] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnDown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_down !== $v) { + $this->flap_detection_on_down = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FLAP_DETECTION_ON_DOWN; + } + + return $this; + } // setFlapDetectionOnDown() + + /** + * Set the value of [flap_detection_on_unreachable] column. + * + * @param boolean $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnUnreachable($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_unreachable !== $v) { + $this->flap_detection_on_unreachable = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::FLAP_DETECTION_ON_UNREACHABLE; + } + + return $this; + } // setFlapDetectionOnUnreachable() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Set the value of [icon_image] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setIconImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image !== $v) { + $this->icon_image = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::ICON_IMAGE; + } + + return $this; + } // setIconImage() + + /** + * Set the value of [icon_image_alt] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setIconImageAlt($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image_alt !== $v) { + $this->icon_image_alt = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::ICON_IMAGE_ALT; + } + + return $this; + } // setIconImageAlt() + + /** + * Set the value of [vrml_image] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setVrmlImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->vrml_image !== $v) { + $this->vrml_image = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::VRML_IMAGE; + } + + return $this; + } // setVrmlImage() + + /** + * Set the value of [statusmap_image] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setStatusmapImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->statusmap_image !== $v) { + $this->statusmap_image = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::STATUSMAP_IMAGE; + } + + return $this; + } // setStatusmapImage() + + /** + * Set the value of [two_d_coords] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setTwoDCoords($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->two_d_coords !== $v) { + $this->two_d_coords = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::TWO_D_COORDS; + } + + return $this; + } // setTwoDCoords() + + /** + * Set the value of [three_d_coords] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setThreeDCoords($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->three_d_coords !== $v) { + $this->three_d_coords = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::THREE_D_COORDS; + } + + return $this; + } // setThreeDCoords() + + /** + * Set the value of [autodiscovery_address_filter] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setAutodiscoveryAddressFilter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->autodiscovery_address_filter !== $v) { + $this->autodiscovery_address_filter = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::AUTODISCOVERY_ADDRESS_FILTER; + } + + return $this; + } // setAutodiscoveryAddressFilter() + + /** + * Set the value of [autodiscovery_hostname_filter] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setAutodiscoveryHostnameFilter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->autodiscovery_hostname_filter !== $v) { + $this->autodiscovery_hostname_filter = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::AUTODISCOVERY_HOSTNAME_FILTER; + } + + return $this; + } // setAutodiscoveryHostnameFilter() + + /** + * Set the value of [autodiscovery_os_family_filter] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setAutodiscoveryOsFamilyFilter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->autodiscovery_os_family_filter !== $v) { + $this->autodiscovery_os_family_filter = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::AUTODISCOVERY_OS_FAMILY_FILTER; + } + + return $this; + } // setAutodiscoveryOsFamilyFilter() + + /** + * Set the value of [autodiscovery_os_generation_filter] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setAutodiscoveryOsGenerationFilter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->autodiscovery_os_generation_filter !== $v) { + $this->autodiscovery_os_generation_filter = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::AUTODISCOVERY_OS_GENERATION_FILTER; + } + + return $this; + } // setAutodiscoveryOsGenerationFilter() + + /** + * Set the value of [autodiscovery_os_vendor_filter] column. + * + * @param string $v new value + * @return NagiosHostTemplate The current object (for fluent API support) + */ + public function setAutodiscoveryOsVendorFilter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->autodiscovery_os_vendor_filter !== $v) { + $this->autodiscovery_os_vendor_filter = $v; + $this->modifiedColumns[] = NagiosHostTemplatePeer::AUTODISCOVERY_OS_VENDOR_FILTER; + } + + return $this; + } // setAutodiscoveryOsVendorFilter() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->initial_state = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->check_command = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->retry_interval = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->first_notification_delay = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->maximum_check_attempts = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->check_interval = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->passive_checks_enabled = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->check_period = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->obsess_over_host = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->check_freshness = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->freshness_threshold = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; + $this->active_checks_enabled = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->checks_enabled = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; + $this->event_handler = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null; + $this->event_handler_enabled = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->low_flap_threshold = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null; + $this->high_flap_threshold = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null; + $this->flap_detection_enabled = ($row[$startcol + 20] !== null) ? (boolean) $row[$startcol + 20] : null; + $this->process_perf_data = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->retain_status_information = ($row[$startcol + 22] !== null) ? (boolean) $row[$startcol + 22] : null; + $this->retain_nonstatus_information = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; + $this->notification_interval = ($row[$startcol + 24] !== null) ? (int) $row[$startcol + 24] : null; + $this->notification_period = ($row[$startcol + 25] !== null) ? (int) $row[$startcol + 25] : null; + $this->notifications_enabled = ($row[$startcol + 26] !== null) ? (boolean) $row[$startcol + 26] : null; + $this->notification_on_down = ($row[$startcol + 27] !== null) ? (boolean) $row[$startcol + 27] : null; + $this->notification_on_unreachable = ($row[$startcol + 28] !== null) ? (boolean) $row[$startcol + 28] : null; + $this->notification_on_recovery = ($row[$startcol + 29] !== null) ? (boolean) $row[$startcol + 29] : null; + $this->notification_on_flapping = ($row[$startcol + 30] !== null) ? (boolean) $row[$startcol + 30] : null; + $this->notification_on_scheduled_downtime = ($row[$startcol + 31] !== null) ? (boolean) $row[$startcol + 31] : null; + $this->stalking_on_up = ($row[$startcol + 32] !== null) ? (boolean) $row[$startcol + 32] : null; + $this->stalking_on_down = ($row[$startcol + 33] !== null) ? (boolean) $row[$startcol + 33] : null; + $this->stalking_on_unreachable = ($row[$startcol + 34] !== null) ? (boolean) $row[$startcol + 34] : null; + $this->failure_prediction_enabled = ($row[$startcol + 35] !== null) ? (boolean) $row[$startcol + 35] : null; + $this->flap_detection_on_up = ($row[$startcol + 36] !== null) ? (boolean) $row[$startcol + 36] : null; + $this->flap_detection_on_down = ($row[$startcol + 37] !== null) ? (boolean) $row[$startcol + 37] : null; + $this->flap_detection_on_unreachable = ($row[$startcol + 38] !== null) ? (boolean) $row[$startcol + 38] : null; + $this->notes = ($row[$startcol + 39] !== null) ? (string) $row[$startcol + 39] : null; + $this->notes_url = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null; + $this->action_url = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null; + $this->icon_image = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null; + $this->icon_image_alt = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null; + $this->vrml_image = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null; + $this->statusmap_image = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null; + $this->two_d_coords = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; + $this->three_d_coords = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; + $this->autodiscovery_address_filter = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null; + $this->autodiscovery_hostname_filter = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null; + $this->autodiscovery_os_family_filter = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null; + $this->autodiscovery_os_generation_filter = ($row[$startcol + 51] !== null) ? (string) $row[$startcol + 51] : null; + $this->autodiscovery_os_vendor_filter = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 53; // 53 = NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostTemplate object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->check_command !== $this->aNagiosCommandRelatedByCheckCommand->getId()) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->check_period !== $this->aNagiosTimeperiodRelatedByCheckPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->event_handler !== $this->aNagiosCommandRelatedByEventHandler->getId()) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->notification_period !== $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostTemplatePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + $this->collNagiosHostTemplateAutodiscoveryServices = null; + $this->lastNagiosHostTemplateAutodiscoveryServiceCriteria = null; + + $this->collNagiosServices = null; + $this->lastNagiosServiceCriteria = null; + + $this->collNagiosHostContactMembers = null; + $this->lastNagiosHostContactMemberCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + $this->collNagiosHostContactgroups = null; + $this->lastNagiosHostContactgroupCriteria = null; + + $this->collNagiosHostgroupMemberships = null; + $this->lastNagiosHostgroupMembershipCriteria = null; + + $this->collNagiosHostCheckCommandParameters = null; + $this->lastNagiosHostCheckCommandParameterCriteria = null; + + $this->collNagiosHostParents = null; + $this->lastNagiosHostParentCriteria = null; + + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = null; + $this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria = null; + + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = null; + $this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria = null; + + $this->collAutodiscoveryDevices = null; + $this->lastAutodiscoveryDeviceCriteria = null; + + $this->collAutodiscoveryDeviceTemplateMatchs = null; + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostTemplatePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostTemplatePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosCommandRelatedByCheckCommand !== null) { + if ($this->aNagiosCommandRelatedByCheckCommand->isModified() || $this->aNagiosCommandRelatedByCheckCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByCheckCommand->save($con); + } + $this->setNagiosCommandRelatedByCheckCommand($this->aNagiosCommandRelatedByCheckCommand); + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if ($this->aNagiosCommandRelatedByEventHandler->isModified() || $this->aNagiosCommandRelatedByEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByEventHandler->save($con); + } + $this->setNagiosCommandRelatedByEventHandler($this->aNagiosCommandRelatedByEventHandler); + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod->isModified() || $this->aNagiosTimeperiodRelatedByCheckPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByCheckPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByCheckPeriod($this->aNagiosTimeperiodRelatedByCheckPeriod); + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByNotificationPeriod($this->aNagiosTimeperiodRelatedByNotificationPeriod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostTemplatePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostTemplatePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostTemplatePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosHostTemplateAutodiscoveryServices !== null) { + foreach ($this->collNagiosHostTemplateAutodiscoveryServices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostCheckCommandParameters !== null) { + foreach ($this->collNagiosHostCheckCommandParameters as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostParents !== null) { + foreach ($this->collNagiosHostParents as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate !== null) { + foreach ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate !== null) { + foreach ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs !== null) { + foreach ($this->collAutodiscoveryDeviceTemplateMatchs as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosCommandRelatedByCheckCommand !== null) { + if (!$this->aNagiosCommandRelatedByCheckCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByCheckCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByEventHandler->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByCheckPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByCheckPeriod->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByNotificationPeriod->getValidationFailures()); + } + } + + + if (($retval = NagiosHostTemplatePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosHostTemplateAutodiscoveryServices !== null) { + foreach ($this->collNagiosHostTemplateAutodiscoveryServices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactMembers !== null) { + foreach ($this->collNagiosHostContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostContactgroups !== null) { + foreach ($this->collNagiosHostContactgroups as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostCheckCommandParameters !== null) { + foreach ($this->collNagiosHostCheckCommandParameters as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostParents !== null) { + foreach ($this->collNagiosHostParents as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate !== null) { + foreach ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate !== null) { + foreach ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collAutodiscoveryDevices !== null) { + foreach ($this->collAutodiscoveryDevices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs !== null) { + foreach ($this->collAutodiscoveryDeviceTemplateMatchs as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplatePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getDescription(); + break; + case 3: + return $this->getInitialState(); + break; + case 4: + return $this->getCheckCommand(); + break; + case 5: + return $this->getRetryInterval(); + break; + case 6: + return $this->getFirstNotificationDelay(); + break; + case 7: + return $this->getMaximumCheckAttempts(); + break; + case 8: + return $this->getCheckInterval(); + break; + case 9: + return $this->getPassiveChecksEnabled(); + break; + case 10: + return $this->getCheckPeriod(); + break; + case 11: + return $this->getObsessOverHost(); + break; + case 12: + return $this->getCheckFreshness(); + break; + case 13: + return $this->getFreshnessThreshold(); + break; + case 14: + return $this->getActiveChecksEnabled(); + break; + case 15: + return $this->getChecksEnabled(); + break; + case 16: + return $this->getEventHandler(); + break; + case 17: + return $this->getEventHandlerEnabled(); + break; + case 18: + return $this->getLowFlapThreshold(); + break; + case 19: + return $this->getHighFlapThreshold(); + break; + case 20: + return $this->getFlapDetectionEnabled(); + break; + case 21: + return $this->getProcessPerfData(); + break; + case 22: + return $this->getRetainStatusInformation(); + break; + case 23: + return $this->getRetainNonstatusInformation(); + break; + case 24: + return $this->getNotificationInterval(); + break; + case 25: + return $this->getNotificationPeriod(); + break; + case 26: + return $this->getNotificationsEnabled(); + break; + case 27: + return $this->getNotificationOnDown(); + break; + case 28: + return $this->getNotificationOnUnreachable(); + break; + case 29: + return $this->getNotificationOnRecovery(); + break; + case 30: + return $this->getNotificationOnFlapping(); + break; + case 31: + return $this->getNotificationOnScheduledDowntime(); + break; + case 32: + return $this->getStalkingOnUp(); + break; + case 33: + return $this->getStalkingOnDown(); + break; + case 34: + return $this->getStalkingOnUnreachable(); + break; + case 35: + return $this->getFailurePredictionEnabled(); + break; + case 36: + return $this->getFlapDetectionOnUp(); + break; + case 37: + return $this->getFlapDetectionOnDown(); + break; + case 38: + return $this->getFlapDetectionOnUnreachable(); + break; + case 39: + return $this->getNotes(); + break; + case 40: + return $this->getNotesUrl(); + break; + case 41: + return $this->getActionUrl(); + break; + case 42: + return $this->getIconImage(); + break; + case 43: + return $this->getIconImageAlt(); + break; + case 44: + return $this->getVrmlImage(); + break; + case 45: + return $this->getStatusmapImage(); + break; + case 46: + return $this->getTwoDCoords(); + break; + case 47: + return $this->getThreeDCoords(); + break; + case 48: + return $this->getAutodiscoveryAddressFilter(); + break; + case 49: + return $this->getAutodiscoveryHostnameFilter(); + break; + case 50: + return $this->getAutodiscoveryOsFamilyFilter(); + break; + case 51: + return $this->getAutodiscoveryOsGenerationFilter(); + break; + case 52: + return $this->getAutodiscoveryOsVendorFilter(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostTemplatePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getDescription(), + $keys[3] => $this->getInitialState(), + $keys[4] => $this->getCheckCommand(), + $keys[5] => $this->getRetryInterval(), + $keys[6] => $this->getFirstNotificationDelay(), + $keys[7] => $this->getMaximumCheckAttempts(), + $keys[8] => $this->getCheckInterval(), + $keys[9] => $this->getPassiveChecksEnabled(), + $keys[10] => $this->getCheckPeriod(), + $keys[11] => $this->getObsessOverHost(), + $keys[12] => $this->getCheckFreshness(), + $keys[13] => $this->getFreshnessThreshold(), + $keys[14] => $this->getActiveChecksEnabled(), + $keys[15] => $this->getChecksEnabled(), + $keys[16] => $this->getEventHandler(), + $keys[17] => $this->getEventHandlerEnabled(), + $keys[18] => $this->getLowFlapThreshold(), + $keys[19] => $this->getHighFlapThreshold(), + $keys[20] => $this->getFlapDetectionEnabled(), + $keys[21] => $this->getProcessPerfData(), + $keys[22] => $this->getRetainStatusInformation(), + $keys[23] => $this->getRetainNonstatusInformation(), + $keys[24] => $this->getNotificationInterval(), + $keys[25] => $this->getNotificationPeriod(), + $keys[26] => $this->getNotificationsEnabled(), + $keys[27] => $this->getNotificationOnDown(), + $keys[28] => $this->getNotificationOnUnreachable(), + $keys[29] => $this->getNotificationOnRecovery(), + $keys[30] => $this->getNotificationOnFlapping(), + $keys[31] => $this->getNotificationOnScheduledDowntime(), + $keys[32] => $this->getStalkingOnUp(), + $keys[33] => $this->getStalkingOnDown(), + $keys[34] => $this->getStalkingOnUnreachable(), + $keys[35] => $this->getFailurePredictionEnabled(), + $keys[36] => $this->getFlapDetectionOnUp(), + $keys[37] => $this->getFlapDetectionOnDown(), + $keys[38] => $this->getFlapDetectionOnUnreachable(), + $keys[39] => $this->getNotes(), + $keys[40] => $this->getNotesUrl(), + $keys[41] => $this->getActionUrl(), + $keys[42] => $this->getIconImage(), + $keys[43] => $this->getIconImageAlt(), + $keys[44] => $this->getVrmlImage(), + $keys[45] => $this->getStatusmapImage(), + $keys[46] => $this->getTwoDCoords(), + $keys[47] => $this->getThreeDCoords(), + $keys[48] => $this->getAutodiscoveryAddressFilter(), + $keys[49] => $this->getAutodiscoveryHostnameFilter(), + $keys[50] => $this->getAutodiscoveryOsFamilyFilter(), + $keys[51] => $this->getAutodiscoveryOsGenerationFilter(), + $keys[52] => $this->getAutodiscoveryOsVendorFilter(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplatePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setDescription($value); + break; + case 3: + $this->setInitialState($value); + break; + case 4: + $this->setCheckCommand($value); + break; + case 5: + $this->setRetryInterval($value); + break; + case 6: + $this->setFirstNotificationDelay($value); + break; + case 7: + $this->setMaximumCheckAttempts($value); + break; + case 8: + $this->setCheckInterval($value); + break; + case 9: + $this->setPassiveChecksEnabled($value); + break; + case 10: + $this->setCheckPeriod($value); + break; + case 11: + $this->setObsessOverHost($value); + break; + case 12: + $this->setCheckFreshness($value); + break; + case 13: + $this->setFreshnessThreshold($value); + break; + case 14: + $this->setActiveChecksEnabled($value); + break; + case 15: + $this->setChecksEnabled($value); + break; + case 16: + $this->setEventHandler($value); + break; + case 17: + $this->setEventHandlerEnabled($value); + break; + case 18: + $this->setLowFlapThreshold($value); + break; + case 19: + $this->setHighFlapThreshold($value); + break; + case 20: + $this->setFlapDetectionEnabled($value); + break; + case 21: + $this->setProcessPerfData($value); + break; + case 22: + $this->setRetainStatusInformation($value); + break; + case 23: + $this->setRetainNonstatusInformation($value); + break; + case 24: + $this->setNotificationInterval($value); + break; + case 25: + $this->setNotificationPeriod($value); + break; + case 26: + $this->setNotificationsEnabled($value); + break; + case 27: + $this->setNotificationOnDown($value); + break; + case 28: + $this->setNotificationOnUnreachable($value); + break; + case 29: + $this->setNotificationOnRecovery($value); + break; + case 30: + $this->setNotificationOnFlapping($value); + break; + case 31: + $this->setNotificationOnScheduledDowntime($value); + break; + case 32: + $this->setStalkingOnUp($value); + break; + case 33: + $this->setStalkingOnDown($value); + break; + case 34: + $this->setStalkingOnUnreachable($value); + break; + case 35: + $this->setFailurePredictionEnabled($value); + break; + case 36: + $this->setFlapDetectionOnUp($value); + break; + case 37: + $this->setFlapDetectionOnDown($value); + break; + case 38: + $this->setFlapDetectionOnUnreachable($value); + break; + case 39: + $this->setNotes($value); + break; + case 40: + $this->setNotesUrl($value); + break; + case 41: + $this->setActionUrl($value); + break; + case 42: + $this->setIconImage($value); + break; + case 43: + $this->setIconImageAlt($value); + break; + case 44: + $this->setVrmlImage($value); + break; + case 45: + $this->setStatusmapImage($value); + break; + case 46: + $this->setTwoDCoords($value); + break; + case 47: + $this->setThreeDCoords($value); + break; + case 48: + $this->setAutodiscoveryAddressFilter($value); + break; + case 49: + $this->setAutodiscoveryHostnameFilter($value); + break; + case 50: + $this->setAutodiscoveryOsFamilyFilter($value); + break; + case 51: + $this->setAutodiscoveryOsGenerationFilter($value); + break; + case 52: + $this->setAutodiscoveryOsVendorFilter($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostTemplatePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setInitialState($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCheckCommand($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setRetryInterval($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setFirstNotificationDelay($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setMaximumCheckAttempts($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setCheckInterval($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setPassiveChecksEnabled($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCheckPeriod($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setObsessOverHost($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCheckFreshness($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setFreshnessThreshold($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setActiveChecksEnabled($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setChecksEnabled($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setEventHandler($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setEventHandlerEnabled($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setLowFlapThreshold($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setHighFlapThreshold($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setFlapDetectionEnabled($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setProcessPerfData($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setRetainStatusInformation($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setRetainNonstatusInformation($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setNotificationInterval($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setNotificationPeriod($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setNotificationsEnabled($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setNotificationOnDown($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setNotificationOnUnreachable($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setNotificationOnRecovery($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setNotificationOnFlapping($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setNotificationOnScheduledDowntime($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setStalkingOnUp($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setStalkingOnDown($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setStalkingOnUnreachable($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setFailurePredictionEnabled($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setFlapDetectionOnUp($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setFlapDetectionOnDown($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setFlapDetectionOnUnreachable($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setNotes($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setNotesUrl($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setActionUrl($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setIconImage($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setIconImageAlt($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setVrmlImage($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setStatusmapImage($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setTwoDCoords($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setThreeDCoords($arr[$keys[47]]); + if (array_key_exists($keys[48], $arr)) $this->setAutodiscoveryAddressFilter($arr[$keys[48]]); + if (array_key_exists($keys[49], $arr)) $this->setAutodiscoveryHostnameFilter($arr[$keys[49]]); + if (array_key_exists($keys[50], $arr)) $this->setAutodiscoveryOsFamilyFilter($arr[$keys[50]]); + if (array_key_exists($keys[51], $arr)) $this->setAutodiscoveryOsGenerationFilter($arr[$keys[51]]); + if (array_key_exists($keys[52], $arr)) $this->setAutodiscoveryOsVendorFilter($arr[$keys[52]]); + } + + /** + * 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(NagiosHostTemplatePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostTemplatePeer::ID)) $criteria->add(NagiosHostTemplatePeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostTemplatePeer::NAME)) $criteria->add(NagiosHostTemplatePeer::NAME, $this->name); + if ($this->isColumnModified(NagiosHostTemplatePeer::DESCRIPTION)) $criteria->add(NagiosHostTemplatePeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(NagiosHostTemplatePeer::INITIAL_STATE)) $criteria->add(NagiosHostTemplatePeer::INITIAL_STATE, $this->initial_state); + if ($this->isColumnModified(NagiosHostTemplatePeer::CHECK_COMMAND)) $criteria->add(NagiosHostTemplatePeer::CHECK_COMMAND, $this->check_command); + if ($this->isColumnModified(NagiosHostTemplatePeer::RETRY_INTERVAL)) $criteria->add(NagiosHostTemplatePeer::RETRY_INTERVAL, $this->retry_interval); + if ($this->isColumnModified(NagiosHostTemplatePeer::FIRST_NOTIFICATION_DELAY)) $criteria->add(NagiosHostTemplatePeer::FIRST_NOTIFICATION_DELAY, $this->first_notification_delay); + if ($this->isColumnModified(NagiosHostTemplatePeer::MAXIMUM_CHECK_ATTEMPTS)) $criteria->add(NagiosHostTemplatePeer::MAXIMUM_CHECK_ATTEMPTS, $this->maximum_check_attempts); + if ($this->isColumnModified(NagiosHostTemplatePeer::CHECK_INTERVAL)) $criteria->add(NagiosHostTemplatePeer::CHECK_INTERVAL, $this->check_interval); + if ($this->isColumnModified(NagiosHostTemplatePeer::PASSIVE_CHECKS_ENABLED)) $criteria->add(NagiosHostTemplatePeer::PASSIVE_CHECKS_ENABLED, $this->passive_checks_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::CHECK_PERIOD)) $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->check_period); + if ($this->isColumnModified(NagiosHostTemplatePeer::OBSESS_OVER_HOST)) $criteria->add(NagiosHostTemplatePeer::OBSESS_OVER_HOST, $this->obsess_over_host); + if ($this->isColumnModified(NagiosHostTemplatePeer::CHECK_FRESHNESS)) $criteria->add(NagiosHostTemplatePeer::CHECK_FRESHNESS, $this->check_freshness); + if ($this->isColumnModified(NagiosHostTemplatePeer::FRESHNESS_THRESHOLD)) $criteria->add(NagiosHostTemplatePeer::FRESHNESS_THRESHOLD, $this->freshness_threshold); + if ($this->isColumnModified(NagiosHostTemplatePeer::ACTIVE_CHECKS_ENABLED)) $criteria->add(NagiosHostTemplatePeer::ACTIVE_CHECKS_ENABLED, $this->active_checks_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::CHECKS_ENABLED)) $criteria->add(NagiosHostTemplatePeer::CHECKS_ENABLED, $this->checks_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::EVENT_HANDLER)) $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER, $this->event_handler); + if ($this->isColumnModified(NagiosHostTemplatePeer::EVENT_HANDLER_ENABLED)) $criteria->add(NagiosHostTemplatePeer::EVENT_HANDLER_ENABLED, $this->event_handler_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::LOW_FLAP_THRESHOLD)) $criteria->add(NagiosHostTemplatePeer::LOW_FLAP_THRESHOLD, $this->low_flap_threshold); + if ($this->isColumnModified(NagiosHostTemplatePeer::HIGH_FLAP_THRESHOLD)) $criteria->add(NagiosHostTemplatePeer::HIGH_FLAP_THRESHOLD, $this->high_flap_threshold); + if ($this->isColumnModified(NagiosHostTemplatePeer::FLAP_DETECTION_ENABLED)) $criteria->add(NagiosHostTemplatePeer::FLAP_DETECTION_ENABLED, $this->flap_detection_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::PROCESS_PERF_DATA)) $criteria->add(NagiosHostTemplatePeer::PROCESS_PERF_DATA, $this->process_perf_data); + if ($this->isColumnModified(NagiosHostTemplatePeer::RETAIN_STATUS_INFORMATION)) $criteria->add(NagiosHostTemplatePeer::RETAIN_STATUS_INFORMATION, $this->retain_status_information); + if ($this->isColumnModified(NagiosHostTemplatePeer::RETAIN_NONSTATUS_INFORMATION)) $criteria->add(NagiosHostTemplatePeer::RETAIN_NONSTATUS_INFORMATION, $this->retain_nonstatus_information); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_INTERVAL)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_INTERVAL, $this->notification_interval); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_PERIOD)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->notification_period); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATIONS_ENABLED)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATIONS_ENABLED, $this->notifications_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_ON_DOWN)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_ON_DOWN, $this->notification_on_down); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_ON_UNREACHABLE)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_ON_UNREACHABLE, $this->notification_on_unreachable); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_ON_RECOVERY, $this->notification_on_recovery); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_ON_FLAPPING, $this->notification_on_flapping); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME)) $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME, $this->notification_on_scheduled_downtime); + if ($this->isColumnModified(NagiosHostTemplatePeer::STALKING_ON_UP)) $criteria->add(NagiosHostTemplatePeer::STALKING_ON_UP, $this->stalking_on_up); + if ($this->isColumnModified(NagiosHostTemplatePeer::STALKING_ON_DOWN)) $criteria->add(NagiosHostTemplatePeer::STALKING_ON_DOWN, $this->stalking_on_down); + if ($this->isColumnModified(NagiosHostTemplatePeer::STALKING_ON_UNREACHABLE)) $criteria->add(NagiosHostTemplatePeer::STALKING_ON_UNREACHABLE, $this->stalking_on_unreachable); + if ($this->isColumnModified(NagiosHostTemplatePeer::FAILURE_PREDICTION_ENABLED)) $criteria->add(NagiosHostTemplatePeer::FAILURE_PREDICTION_ENABLED, $this->failure_prediction_enabled); + if ($this->isColumnModified(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UP)) $criteria->add(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UP, $this->flap_detection_on_up); + if ($this->isColumnModified(NagiosHostTemplatePeer::FLAP_DETECTION_ON_DOWN)) $criteria->add(NagiosHostTemplatePeer::FLAP_DETECTION_ON_DOWN, $this->flap_detection_on_down); + if ($this->isColumnModified(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UNREACHABLE)) $criteria->add(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UNREACHABLE, $this->flap_detection_on_unreachable); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTES)) $criteria->add(NagiosHostTemplatePeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosHostTemplatePeer::NOTES_URL)) $criteria->add(NagiosHostTemplatePeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosHostTemplatePeer::ACTION_URL)) $criteria->add(NagiosHostTemplatePeer::ACTION_URL, $this->action_url); + if ($this->isColumnModified(NagiosHostTemplatePeer::ICON_IMAGE)) $criteria->add(NagiosHostTemplatePeer::ICON_IMAGE, $this->icon_image); + if ($this->isColumnModified(NagiosHostTemplatePeer::ICON_IMAGE_ALT)) $criteria->add(NagiosHostTemplatePeer::ICON_IMAGE_ALT, $this->icon_image_alt); + if ($this->isColumnModified(NagiosHostTemplatePeer::VRML_IMAGE)) $criteria->add(NagiosHostTemplatePeer::VRML_IMAGE, $this->vrml_image); + if ($this->isColumnModified(NagiosHostTemplatePeer::STATUSMAP_IMAGE)) $criteria->add(NagiosHostTemplatePeer::STATUSMAP_IMAGE, $this->statusmap_image); + if ($this->isColumnModified(NagiosHostTemplatePeer::TWO_D_COORDS)) $criteria->add(NagiosHostTemplatePeer::TWO_D_COORDS, $this->two_d_coords); + if ($this->isColumnModified(NagiosHostTemplatePeer::THREE_D_COORDS)) $criteria->add(NagiosHostTemplatePeer::THREE_D_COORDS, $this->three_d_coords); + if ($this->isColumnModified(NagiosHostTemplatePeer::AUTODISCOVERY_ADDRESS_FILTER)) $criteria->add(NagiosHostTemplatePeer::AUTODISCOVERY_ADDRESS_FILTER, $this->autodiscovery_address_filter); + if ($this->isColumnModified(NagiosHostTemplatePeer::AUTODISCOVERY_HOSTNAME_FILTER)) $criteria->add(NagiosHostTemplatePeer::AUTODISCOVERY_HOSTNAME_FILTER, $this->autodiscovery_hostname_filter); + if ($this->isColumnModified(NagiosHostTemplatePeer::AUTODISCOVERY_OS_FAMILY_FILTER)) $criteria->add(NagiosHostTemplatePeer::AUTODISCOVERY_OS_FAMILY_FILTER, $this->autodiscovery_os_family_filter); + if ($this->isColumnModified(NagiosHostTemplatePeer::AUTODISCOVERY_OS_GENERATION_FILTER)) $criteria->add(NagiosHostTemplatePeer::AUTODISCOVERY_OS_GENERATION_FILTER, $this->autodiscovery_os_generation_filter); + if ($this->isColumnModified(NagiosHostTemplatePeer::AUTODISCOVERY_OS_VENDOR_FILTER)) $criteria->add(NagiosHostTemplatePeer::AUTODISCOVERY_OS_VENDOR_FILTER, $this->autodiscovery_os_vendor_filter); + + 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(NagiosHostTemplatePeer::DATABASE_NAME); + + $criteria->add(NagiosHostTemplatePeer::ID, $this->id); + + 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 NagiosHostTemplate (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) + { + + $copyObj->setName($this->name); + + $copyObj->setDescription($this->description); + + $copyObj->setInitialState($this->initial_state); + + $copyObj->setCheckCommand($this->check_command); + + $copyObj->setRetryInterval($this->retry_interval); + + $copyObj->setFirstNotificationDelay($this->first_notification_delay); + + $copyObj->setMaximumCheckAttempts($this->maximum_check_attempts); + + $copyObj->setCheckInterval($this->check_interval); + + $copyObj->setPassiveChecksEnabled($this->passive_checks_enabled); + + $copyObj->setCheckPeriod($this->check_period); + + $copyObj->setObsessOverHost($this->obsess_over_host); + + $copyObj->setCheckFreshness($this->check_freshness); + + $copyObj->setFreshnessThreshold($this->freshness_threshold); + + $copyObj->setActiveChecksEnabled($this->active_checks_enabled); + + $copyObj->setChecksEnabled($this->checks_enabled); + + $copyObj->setEventHandler($this->event_handler); + + $copyObj->setEventHandlerEnabled($this->event_handler_enabled); + + $copyObj->setLowFlapThreshold($this->low_flap_threshold); + + $copyObj->setHighFlapThreshold($this->high_flap_threshold); + + $copyObj->setFlapDetectionEnabled($this->flap_detection_enabled); + + $copyObj->setProcessPerfData($this->process_perf_data); + + $copyObj->setRetainStatusInformation($this->retain_status_information); + + $copyObj->setRetainNonstatusInformation($this->retain_nonstatus_information); + + $copyObj->setNotificationInterval($this->notification_interval); + + $copyObj->setNotificationPeriod($this->notification_period); + + $copyObj->setNotificationsEnabled($this->notifications_enabled); + + $copyObj->setNotificationOnDown($this->notification_on_down); + + $copyObj->setNotificationOnUnreachable($this->notification_on_unreachable); + + $copyObj->setNotificationOnRecovery($this->notification_on_recovery); + + $copyObj->setNotificationOnFlapping($this->notification_on_flapping); + + $copyObj->setNotificationOnScheduledDowntime($this->notification_on_scheduled_downtime); + + $copyObj->setStalkingOnUp($this->stalking_on_up); + + $copyObj->setStalkingOnDown($this->stalking_on_down); + + $copyObj->setStalkingOnUnreachable($this->stalking_on_unreachable); + + $copyObj->setFailurePredictionEnabled($this->failure_prediction_enabled); + + $copyObj->setFlapDetectionOnUp($this->flap_detection_on_up); + + $copyObj->setFlapDetectionOnDown($this->flap_detection_on_down); + + $copyObj->setFlapDetectionOnUnreachable($this->flap_detection_on_unreachable); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + $copyObj->setIconImage($this->icon_image); + + $copyObj->setIconImageAlt($this->icon_image_alt); + + $copyObj->setVrmlImage($this->vrml_image); + + $copyObj->setStatusmapImage($this->statusmap_image); + + $copyObj->setTwoDCoords($this->two_d_coords); + + $copyObj->setThreeDCoords($this->three_d_coords); + + $copyObj->setAutodiscoveryAddressFilter($this->autodiscovery_address_filter); + + $copyObj->setAutodiscoveryHostnameFilter($this->autodiscovery_hostname_filter); + + $copyObj->setAutodiscoveryOsFamilyFilter($this->autodiscovery_os_family_filter); + + $copyObj->setAutodiscoveryOsGenerationFilter($this->autodiscovery_os_generation_filter); + + $copyObj->setAutodiscoveryOsVendorFilter($this->autodiscovery_os_vendor_filter); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosHostTemplateAutodiscoveryServices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateAutodiscoveryService($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosService($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostContactgroups() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostContactgroup($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostgroupMemberships() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostgroupMembership($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostCheckCommandParameters() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostCheckCommandParameter($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostParents() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostParent($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplateInheritancesRelatedBySourceTemplate() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateInheritanceRelatedBySourceTemplate($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplateInheritancesRelatedByTargetTemplate() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateInheritanceRelatedByTargetTemplate($relObj->copy($deepCopy)); + } + } + + foreach ($this->getAutodiscoveryDevices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDevice($relObj->copy($deepCopy)); + } + } + + foreach ($this->getAutodiscoveryDeviceTemplateMatchs() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addAutodiscoveryDeviceTemplateMatch($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostTemplate 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); + $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 NagiosHostTemplatePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostTemplatePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosHostTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByCheckCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setCheckCommand(NULL); + } else { + $this->setCheckCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByCheckCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateRelatedByCheckCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByCheckCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByCheckCommand === null && ($this->check_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->check_command); + $this->aNagiosCommandRelatedByCheckCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByCheckCommand->addNagiosHostTemplatesRelatedByCheckCommand($this); + */ + } + return $this->aNagiosCommandRelatedByCheckCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosHostTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setEventHandler(NULL); + } else { + $this->setEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateRelatedByEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByEventHandler === null && ($this->event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->event_handler); + $this->aNagiosCommandRelatedByEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByEventHandler->addNagiosHostTemplatesRelatedByEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByEventHandler; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosHostTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByCheckPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setCheckPeriod(NULL); + } else { + $this->setCheckPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByCheckPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateRelatedByCheckPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByCheckPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod === null && ($this->check_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->check_period); + $this->aNagiosTimeperiodRelatedByCheckPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByCheckPeriod->addNagiosHostTemplatesRelatedByCheckPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByCheckPeriod; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosHostTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setNotificationPeriod(NULL); + } else { + $this->setNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateRelatedByNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod === null && ($this->notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->notification_period); + $this->aNagiosTimeperiodRelatedByNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByNotificationPeriod->addNagiosHostTemplatesRelatedByNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosHostTemplateAutodiscoveryServices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplateAutodiscoveryServices() + */ + public function clearNagiosHostTemplateAutodiscoveryServices() + { + $this->collNagiosHostTemplateAutodiscoveryServices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplateAutodiscoveryServices collection (array). + * + * By default this just sets the collNagiosHostTemplateAutodiscoveryServices collection to an empty array (like clearcollNagiosHostTemplateAutodiscoveryServices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplateAutodiscoveryServices() + { + $this->collNagiosHostTemplateAutodiscoveryServices = array(); + } + + /** + * Gets an array of NagiosHostTemplateAutodiscoveryService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostTemplateAutodiscoveryServices from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplateAutodiscoveryService[] + * @throws PropelException + */ + public function getNagiosHostTemplateAutodiscoveryServices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateAutodiscoveryServices === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateAutodiscoveryServices = array(); + } else { + + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $this->id); + + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplateAutodiscoveryServices = NagiosHostTemplateAutodiscoveryServicePeer::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. + + + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $this->id); + + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateAutodiscoveryServiceCriteria) || !$this->lastNagiosHostTemplateAutodiscoveryServiceCriteria->equals($criteria)) { + $this->collNagiosHostTemplateAutodiscoveryServices = NagiosHostTemplateAutodiscoveryServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateAutodiscoveryServiceCriteria = $criteria; + return $this->collNagiosHostTemplateAutodiscoveryServices; + } + + /** + * Returns the number of related NagiosHostTemplateAutodiscoveryService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplateAutodiscoveryService objects. + * @throws PropelException + */ + public function countNagiosHostTemplateAutodiscoveryServices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplateAutodiscoveryServices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $this->id); + + $count = NagiosHostTemplateAutodiscoveryServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostTemplateAutodiscoveryServiceCriteria) || !$this->lastNagiosHostTemplateAutodiscoveryServiceCriteria->equals($criteria)) { + $count = NagiosHostTemplateAutodiscoveryServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplateAutodiscoveryServices); + } + } else { + $count = count($this->collNagiosHostTemplateAutodiscoveryServices); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplateAutodiscoveryService object to this object + * through the NagiosHostTemplateAutodiscoveryService foreign key attribute. + * + * @param NagiosHostTemplateAutodiscoveryService $l NagiosHostTemplateAutodiscoveryService + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateAutodiscoveryService(NagiosHostTemplateAutodiscoveryService $l) + { + if ($this->collNagiosHostTemplateAutodiscoveryServices === null) { + $this->initNagiosHostTemplateAutodiscoveryServices(); + } + if (!in_array($l, $this->collNagiosHostTemplateAutodiscoveryServices, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplateAutodiscoveryServices, $l); + $l->setNagiosHostTemplate($this); + } + } + + /** + * Clears out the collNagiosServices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServices() + */ + public function clearNagiosServices() + { + $this->collNagiosServices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServices collection (array). + * + * By default this just sets the collNagiosServices collection to an empty array (like clearcollNagiosServices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServices() + { + $this->collNagiosServices = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosServices from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServices = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceCriteria = $criteria; + return $this->collNagiosServices; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServices); + } + } else { + $count = count($this->collNagiosServices); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosService(NagiosService $l) + { + if ($this->collNagiosServices === null) { + $this->initNagiosServices(); + } + if (!in_array($l, $this->collNagiosServices, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServices, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostTemplate. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + /** + * Clears out the collNagiosHostContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactMembers() + */ + public function clearNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactMembers collection (array). + * + * By default this just sets the collNagiosHostContactMembers collection to an empty array (like clearcollNagiosHostContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactMembers() + { + $this->collNagiosHostContactMembers = array(); + } + + /** + * Gets an array of NagiosHostContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostContactMembers from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactMember[] + * @throws PropelException + */ + public function getNagiosHostContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::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. + + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + NagiosHostContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + return $this->collNagiosHostContactMembers; + } + + /** + * Returns the number of related NagiosHostContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactMember objects. + * @throws PropelException + */ + public function countNagiosHostContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + $count = NagiosHostContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $count = NagiosHostContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactMembers); + } + } else { + $count = count($this->collNagiosHostContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactMember object to this object + * through the NagiosHostContactMember foreign key attribute. + * + * @param NagiosHostContactMember $l NagiosHostContactMember + * @return void + * @throws PropelException + */ + public function addNagiosHostContactMember(NagiosHostContactMember $l) + { + if ($this->collNagiosHostContactMembers === null) { + $this->initNagiosHostContactMembers(); + } + if (!in_array($l, $this->collNagiosHostContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactMembers, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosHostTemplate. + */ + public function getNagiosHostContactMembersJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostContactMembers 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 NagiosHostTemplate. + */ + public function getNagiosHostContactMembersJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosHostContactMembers = array(); + } else { + + $criteria->add(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactMemberCriteria) || !$this->lastNagiosHostContactMemberCriteria->equals($criteria)) { + $this->collNagiosHostContactMembers = NagiosHostContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactMemberCriteria = $criteria; + + return $this->collNagiosHostContactMembers; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostTemplate. + */ + public function getNagiosDependencysJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostTemplate. + */ + public function getNagiosDependencysJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostTemplate. + */ + public function getNagiosDependencysJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostTemplate. + */ + public function getNagiosDependencysJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostTemplate. + */ + public function getNagiosDependencysJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostTemplate. + */ + public function getNagiosEscalationsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostTemplate. + */ + public function getNagiosEscalationsJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostTemplate. + */ + public function getNagiosEscalationsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostTemplate. + */ + public function getNagiosEscalationsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostTemplate. + */ + public function getNagiosEscalationsJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Clears out the collNagiosHostContactgroups collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostContactgroups() + */ + public function clearNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostContactgroups collection (array). + * + * By default this just sets the collNagiosHostContactgroups collection to an empty array (like clearcollNagiosHostContactgroups()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostContactgroups() + { + $this->collNagiosHostContactgroups = array(); + } + + /** + * Gets an array of NagiosHostContactgroup objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostContactgroups from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostContactgroup[] + * @throws PropelException + */ + public function getNagiosHostContactgroups($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::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. + + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + NagiosHostContactgroupPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + return $this->collNagiosHostContactgroups; + } + + /** + * Returns the number of related NagiosHostContactgroup objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostContactgroup objects. + * @throws PropelException + */ + public function countNagiosHostContactgroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + $count = NagiosHostContactgroupPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $count = NagiosHostContactgroupPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostContactgroups); + } + } else { + $count = count($this->collNagiosHostContactgroups); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostContactgroup object to this object + * through the NagiosHostContactgroup foreign key attribute. + * + * @param NagiosHostContactgroup $l NagiosHostContactgroup + * @return void + * @throws PropelException + */ + public function addNagiosHostContactgroup(NagiosHostContactgroup $l) + { + if ($this->collNagiosHostContactgroups === null) { + $this->initNagiosHostContactgroups(); + } + if (!in_array($l, $this->collNagiosHostContactgroups, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostContactgroups, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosHostTemplate. + */ + public function getNagiosHostContactgroupsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostContactgroups 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 NagiosHostTemplate. + */ + public function getNagiosHostContactgroupsJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostContactgroups === null) { + if ($this->isNew()) { + $this->collNagiosHostContactgroups = array(); + } else { + + $criteria->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostContactgroupCriteria) || !$this->lastNagiosHostContactgroupCriteria->equals($criteria)) { + $this->collNagiosHostContactgroups = NagiosHostContactgroupPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostContactgroupCriteria = $criteria; + + return $this->collNagiosHostContactgroups; + } + + /** + * Clears out the collNagiosHostgroupMemberships collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostgroupMemberships() + */ + public function clearNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostgroupMemberships collection (array). + * + * By default this just sets the collNagiosHostgroupMemberships collection to an empty array (like clearcollNagiosHostgroupMemberships()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = array(); + } + + /** + * Gets an array of NagiosHostgroupMembership objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostgroupMemberships from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostgroupMembership[] + * @throws PropelException + */ + public function getNagiosHostgroupMemberships($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::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. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + return $this->collNagiosHostgroupMemberships; + } + + /** + * Returns the number of related NagiosHostgroupMembership objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostgroupMembership objects. + * @throws PropelException + */ + public function countNagiosHostgroupMemberships(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + $count = NagiosHostgroupMembershipPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $count = NagiosHostgroupMembershipPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostgroupMembership object to this object + * through the NagiosHostgroupMembership foreign key attribute. + * + * @param NagiosHostgroupMembership $l NagiosHostgroupMembership + * @return void + * @throws PropelException + */ + public function addNagiosHostgroupMembership(NagiosHostgroupMembership $l) + { + if ($this->collNagiosHostgroupMemberships === null) { + $this->initNagiosHostgroupMemberships(); + } + if (!in_array($l, $this->collNagiosHostgroupMemberships, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostgroupMemberships, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHostTemplate. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHostTemplate. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + /** + * Clears out the collNagiosHostCheckCommandParameters collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostCheckCommandParameters() + */ + public function clearNagiosHostCheckCommandParameters() + { + $this->collNagiosHostCheckCommandParameters = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostCheckCommandParameters collection (array). + * + * By default this just sets the collNagiosHostCheckCommandParameters collection to an empty array (like clearcollNagiosHostCheckCommandParameters()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostCheckCommandParameters() + { + $this->collNagiosHostCheckCommandParameters = array(); + } + + /** + * Gets an array of NagiosHostCheckCommandParameter objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostCheckCommandParameters from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostCheckCommandParameter[] + * @throws PropelException + */ + public function getNagiosHostCheckCommandParameters($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosHostCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::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. + + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + NagiosHostCheckCommandParameterPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostCheckCommandParameterCriteria = $criteria; + return $this->collNagiosHostCheckCommandParameters; + } + + /** + * Returns the number of related NagiosHostCheckCommandParameter objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostCheckCommandParameter objects. + * @throws PropelException + */ + public function countNagiosHostCheckCommandParameters(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + $count = NagiosHostCheckCommandParameterPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $count = NagiosHostCheckCommandParameterPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostCheckCommandParameters); + } + } else { + $count = count($this->collNagiosHostCheckCommandParameters); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostCheckCommandParameter object to this object + * through the NagiosHostCheckCommandParameter foreign key attribute. + * + * @param NagiosHostCheckCommandParameter $l NagiosHostCheckCommandParameter + * @return void + * @throws PropelException + */ + public function addNagiosHostCheckCommandParameter(NagiosHostCheckCommandParameter $l) + { + if ($this->collNagiosHostCheckCommandParameters === null) { + $this->initNagiosHostCheckCommandParameters(); + } + if (!in_array($l, $this->collNagiosHostCheckCommandParameters, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostCheckCommandParameters, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostCheckCommandParameters 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 NagiosHostTemplate. + */ + public function getNagiosHostCheckCommandParametersJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosHostCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostCheckCommandParameterCriteria) || !$this->lastNagiosHostCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosHostCheckCommandParameters = NagiosHostCheckCommandParameterPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostCheckCommandParameterCriteria = $criteria; + + return $this->collNagiosHostCheckCommandParameters; + } + + /** + * Clears out the collNagiosHostParents collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostParents() + */ + public function clearNagiosHostParents() + { + $this->collNagiosHostParents = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostParents collection (array). + * + * By default this just sets the collNagiosHostParents collection to an empty array (like clearcollNagiosHostParents()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostParents() + { + $this->collNagiosHostParents = array(); + } + + /** + * Gets an array of NagiosHostParent objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostParents from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostParent[] + * @throws PropelException + */ + public function getNagiosHostParents($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParents === null) { + if ($this->isNew()) { + $this->collNagiosHostParents = array(); + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + $this->collNagiosHostParents = NagiosHostParentPeer::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. + + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + NagiosHostParentPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostParentCriteria) || !$this->lastNagiosHostParentCriteria->equals($criteria)) { + $this->collNagiosHostParents = NagiosHostParentPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostParentCriteria = $criteria; + return $this->collNagiosHostParents; + } + + /** + * Returns the number of related NagiosHostParent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostParent objects. + * @throws PropelException + */ + public function countNagiosHostParents(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostParents === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + $count = NagiosHostParentPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostParentCriteria) || !$this->lastNagiosHostParentCriteria->equals($criteria)) { + $count = NagiosHostParentPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostParents); + } + } else { + $count = count($this->collNagiosHostParents); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostParent object to this object + * through the NagiosHostParent foreign key attribute. + * + * @param NagiosHostParent $l NagiosHostParent + * @return void + * @throws PropelException + */ + public function addNagiosHostParent(NagiosHostParent $l) + { + if ($this->collNagiosHostParents === null) { + $this->initNagiosHostParents(); + } + if (!in_array($l, $this->collNagiosHostParents, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostParents, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostParents 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 NagiosHostTemplate. + */ + public function getNagiosHostParentsJoinNagiosHostRelatedByChildHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParents === null) { + if ($this->isNew()) { + $this->collNagiosHostParents = array(); + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + $this->collNagiosHostParents = NagiosHostParentPeer::doSelectJoinNagiosHostRelatedByChildHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostParentCriteria) || !$this->lastNagiosHostParentCriteria->equals($criteria)) { + $this->collNagiosHostParents = NagiosHostParentPeer::doSelectJoinNagiosHostRelatedByChildHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostParentCriteria = $criteria; + + return $this->collNagiosHostParents; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostParents 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 NagiosHostTemplate. + */ + public function getNagiosHostParentsJoinNagiosHostRelatedByParentHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostParents === null) { + if ($this->isNew()) { + $this->collNagiosHostParents = array(); + } else { + + $criteria->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + $this->collNagiosHostParents = NagiosHostParentPeer::doSelectJoinNagiosHostRelatedByParentHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostParentCriteria) || !$this->lastNagiosHostParentCriteria->equals($criteria)) { + $this->collNagiosHostParents = NagiosHostParentPeer::doSelectJoinNagiosHostRelatedByParentHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostParentCriteria = $criteria; + + return $this->collNagiosHostParents; + } + + /** + * Clears out the collNagiosHostTemplateInheritancesRelatedBySourceTemplate collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplateInheritancesRelatedBySourceTemplate() + */ + public function clearNagiosHostTemplateInheritancesRelatedBySourceTemplate() + { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplateInheritancesRelatedBySourceTemplate collection (array). + * + * By default this just sets the collNagiosHostTemplateInheritancesRelatedBySourceTemplate collection to an empty array (like clearcollNagiosHostTemplateInheritancesRelatedBySourceTemplate()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplateInheritancesRelatedBySourceTemplate() + { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = array(); + } + + /** + * Gets an array of NagiosHostTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostTemplateInheritancesRelatedBySourceTemplate from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosHostTemplateInheritancesRelatedBySourceTemplate($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = NagiosHostTemplateInheritancePeer::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. + + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = NagiosHostTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria = $criteria; + return $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate; + } + + /** + * Returns the number of related NagiosHostTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosHostTemplateInheritancesRelatedBySourceTemplate(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + $count = NagiosHostTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $count = NagiosHostTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate); + } + } else { + $count = count($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplateInheritance object to this object + * through the NagiosHostTemplateInheritance foreign key attribute. + * + * @param NagiosHostTemplateInheritance $l NagiosHostTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateInheritanceRelatedBySourceTemplate(NagiosHostTemplateInheritance $l) + { + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate === null) { + $this->initNagiosHostTemplateInheritancesRelatedBySourceTemplate(); + } + if (!in_array($l, $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate, $l); + $l->setNagiosHostTemplateRelatedBySourceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostTemplateInheritancesRelatedBySourceTemplate 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 NagiosHostTemplate. + */ + public function getNagiosHostTemplateInheritancesRelatedBySourceTemplateJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateInheritanceRelatedBySourceTemplateCriteria = $criteria; + + return $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate; + } + + /** + * Clears out the collNagiosHostTemplateInheritancesRelatedByTargetTemplate collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplateInheritancesRelatedByTargetTemplate() + */ + public function clearNagiosHostTemplateInheritancesRelatedByTargetTemplate() + { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplateInheritancesRelatedByTargetTemplate collection (array). + * + * By default this just sets the collNagiosHostTemplateInheritancesRelatedByTargetTemplate collection to an empty array (like clearcollNagiosHostTemplateInheritancesRelatedByTargetTemplate()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplateInheritancesRelatedByTargetTemplate() + { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = array(); + } + + /** + * Gets an array of NagiosHostTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related NagiosHostTemplateInheritancesRelatedByTargetTemplate from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosHostTemplateInheritancesRelatedByTargetTemplate($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = NagiosHostTemplateInheritancePeer::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. + + + $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = NagiosHostTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria = $criteria; + return $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate; + } + + /** + * Returns the number of related NagiosHostTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosHostTemplateInheritancesRelatedByTargetTemplate(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + $count = NagiosHostTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $count = NagiosHostTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate); + } + } else { + $count = count($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplateInheritance object to this object + * through the NagiosHostTemplateInheritance foreign key attribute. + * + * @param NagiosHostTemplateInheritance $l NagiosHostTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateInheritanceRelatedByTargetTemplate(NagiosHostTemplateInheritance $l) + { + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate === null) { + $this->initNagiosHostTemplateInheritancesRelatedByTargetTemplate(); + } + if (!in_array($l, $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate, $l); + $l->setNagiosHostTemplateRelatedByTargetTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related NagiosHostTemplateInheritancesRelatedByTargetTemplate 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 NagiosHostTemplate. + */ + public function getNagiosHostTemplateInheritancesRelatedByTargetTemplateJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = array(); + } else { + + $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = NagiosHostTemplateInheritancePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateInheritanceRelatedByTargetTemplateCriteria = $criteria; + + return $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate; + } + + /** + * Clears out the collAutodiscoveryDevices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDevices() + */ + public function clearAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDevices collection (array). + * + * By default this just sets the collAutodiscoveryDevices collection to an empty array (like clearcollAutodiscoveryDevices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDevices() + { + $this->collAutodiscoveryDevices = array(); + } + + /** + * Gets an array of AutodiscoveryDevice objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related AutodiscoveryDevices from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDevice[] + * @throws PropelException + */ + public function getAutodiscoveryDevices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::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. + + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + AutodiscoveryDevicePeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + return $this->collAutodiscoveryDevices; + } + + /** + * Returns the number of related AutodiscoveryDevice objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDevice objects. + * @throws PropelException + */ + public function countAutodiscoveryDevices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + $count = AutodiscoveryDevicePeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $count = AutodiscoveryDevicePeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDevices); + } + } else { + $count = count($this->collAutodiscoveryDevices); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDevice object to this object + * through the AutodiscoveryDevice foreign key attribute. + * + * @param AutodiscoveryDevice $l AutodiscoveryDevice + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDevice(AutodiscoveryDevice $l) + { + if ($this->collAutodiscoveryDevices === null) { + $this->initAutodiscoveryDevices(); + } + if (!in_array($l, $this->collAutodiscoveryDevices, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDevices, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 NagiosHostTemplate. + */ + public function getAutodiscoveryDevicesJoinAutodiscoveryJob($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinAutodiscoveryJob($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinAutodiscoveryJob($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related AutodiscoveryDevices 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 NagiosHostTemplate. + */ + public function getAutodiscoveryDevicesJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDevices === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDevices = array(); + } else { + + $criteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDevicePeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceCriteria) || !$this->lastAutodiscoveryDeviceCriteria->equals($criteria)) { + $this->collAutodiscoveryDevices = AutodiscoveryDevicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceCriteria = $criteria; + + return $this->collAutodiscoveryDevices; + } + + /** + * Clears out the collAutodiscoveryDeviceTemplateMatchs collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addAutodiscoveryDeviceTemplateMatchs() + */ + public function clearAutodiscoveryDeviceTemplateMatchs() + { + $this->collAutodiscoveryDeviceTemplateMatchs = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collAutodiscoveryDeviceTemplateMatchs collection (array). + * + * By default this just sets the collAutodiscoveryDeviceTemplateMatchs collection to an empty array (like clearcollAutodiscoveryDeviceTemplateMatchs()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initAutodiscoveryDeviceTemplateMatchs() + { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } + + /** + * Gets an array of AutodiscoveryDeviceTemplateMatch objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate has previously been saved, it will retrieve + * related AutodiscoveryDeviceTemplateMatchs from storage. If this NagiosHostTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array AutodiscoveryDeviceTemplateMatch[] + * @throws PropelException + */ + public function getAutodiscoveryDeviceTemplateMatchs($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::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. + + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + AutodiscoveryDeviceTemplateMatchPeer::addSelectColumns($criteria); + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelect($criteria, $con); + } + } + } + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = $criteria; + return $this->collAutodiscoveryDeviceTemplateMatchs; + } + + /** + * Returns the number of related AutodiscoveryDeviceTemplateMatch objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related AutodiscoveryDeviceTemplateMatch objects. + * @throws PropelException + */ + public function countAutodiscoveryDeviceTemplateMatchs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + $count = AutodiscoveryDeviceTemplateMatchPeer::doCount($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 count of the collection. + + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $count = AutodiscoveryDeviceTemplateMatchPeer::doCount($criteria, $con); + } else { + $count = count($this->collAutodiscoveryDeviceTemplateMatchs); + } + } else { + $count = count($this->collAutodiscoveryDeviceTemplateMatchs); + } + } + return $count; + } + + /** + * Method called to associate a AutodiscoveryDeviceTemplateMatch object to this object + * through the AutodiscoveryDeviceTemplateMatch foreign key attribute. + * + * @param AutodiscoveryDeviceTemplateMatch $l AutodiscoveryDeviceTemplateMatch + * @return void + * @throws PropelException + */ + public function addAutodiscoveryDeviceTemplateMatch(AutodiscoveryDeviceTemplateMatch $l) + { + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + $this->initAutodiscoveryDeviceTemplateMatchs(); + } + if (!in_array($l, $this->collAutodiscoveryDeviceTemplateMatchs, true)) { // only add it if the **same** object is not already associated + array_push($this->collAutodiscoveryDeviceTemplateMatchs, $l); + $l->setNagiosHostTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostTemplate is new, it will return + * an empty collection; or if this NagiosHostTemplate has previously + * been saved, it will retrieve related AutodiscoveryDeviceTemplateMatchs 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 NagiosHostTemplate. + */ + public function getAutodiscoveryDeviceTemplateMatchsJoinAutodiscoveryDevice($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collAutodiscoveryDeviceTemplateMatchs === null) { + if ($this->isNew()) { + $this->collAutodiscoveryDeviceTemplateMatchs = array(); + } else { + + $criteria->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelectJoinAutodiscoveryDevice($criteria, $con, $join_behavior); + } + } 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(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $this->id); + + if (!isset($this->lastAutodiscoveryDeviceTemplateMatchCriteria) || !$this->lastAutodiscoveryDeviceTemplateMatchCriteria->equals($criteria)) { + $this->collAutodiscoveryDeviceTemplateMatchs = AutodiscoveryDeviceTemplateMatchPeer::doSelectJoinAutodiscoveryDevice($criteria, $con, $join_behavior); + } + } + $this->lastAutodiscoveryDeviceTemplateMatchCriteria = $criteria; + + return $this->collAutodiscoveryDeviceTemplateMatchs; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosHostTemplateAutodiscoveryServices) { + foreach ((array) $this->collNagiosHostTemplateAutodiscoveryServices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServices) { + foreach ((array) $this->collNagiosServices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactMembers) { + foreach ((array) $this->collNagiosHostContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostContactgroups) { + foreach ((array) $this->collNagiosHostContactgroups as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostgroupMemberships) { + foreach ((array) $this->collNagiosHostgroupMemberships as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostCheckCommandParameters) { + foreach ((array) $this->collNagiosHostCheckCommandParameters as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostParents) { + foreach ((array) $this->collNagiosHostParents as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate) { + foreach ((array) $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate) { + foreach ((array) $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collAutodiscoveryDevices) { + foreach ((array) $this->collAutodiscoveryDevices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collAutodiscoveryDeviceTemplateMatchs) { + foreach ((array) $this->collAutodiscoveryDeviceTemplateMatchs as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosHostTemplateAutodiscoveryServices = null; + $this->collNagiosServices = null; + $this->collNagiosHostContactMembers = null; + $this->collNagiosDependencys = null; + $this->collNagiosEscalations = null; + $this->collNagiosHostContactgroups = null; + $this->collNagiosHostgroupMemberships = null; + $this->collNagiosHostCheckCommandParameters = null; + $this->collNagiosHostParents = null; + $this->collNagiosHostTemplateInheritancesRelatedBySourceTemplate = null; + $this->collNagiosHostTemplateInheritancesRelatedByTargetTemplate = null; + $this->collAutodiscoveryDevices = null; + $this->collAutodiscoveryDeviceTemplateMatchs = null; + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + +} // BaseNagiosHostTemplate diff --git a/classes/om/BaseNagiosHostTemplateAutodiscoveryService.php b/classes/om/BaseNagiosHostTemplateAutodiscoveryService.php new file mode 100755 index 0000000..b512f3f --- /dev/null +++ b/classes/om/BaseNagiosHostTemplateAutodiscoveryService.php @@ -0,0 +1,1047 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [protocol] column value. + * + * @return string + */ + public function getProtocol() + { + return $this->protocol; + } + + /** + * Get the [port] column value. + * + * @return string + */ + public function getPort() + { + return $this->port; + } + + /** + * Get the [product] column value. + * + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Get the [version] column value. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Get the [extra_information] column value. + * + * @return string + */ + public function getExtraInformation() + { + return $this->extra_information; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [protocol] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setProtocol($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->protocol !== $v) { + $this->protocol = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::PROTOCOL; + } + + return $this; + } // setProtocol() + + /** + * Set the value of [port] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setPort($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->port !== $v) { + $this->port = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::PORT; + } + + return $this; + } // setPort() + + /** + * Set the value of [product] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setProduct($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->product !== $v) { + $this->product = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::PRODUCT; + } + + return $this; + } // setProduct() + + /** + * Set the value of [version] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setVersion($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->version !== $v) { + $this->version = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::VERSION; + } + + return $this; + } // setVersion() + + /** + * Set the value of [extra_information] column. + * + * @param string $v new value + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + */ + public function setExtraInformation($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->extra_information !== $v) { + $this->extra_information = $v; + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::EXTRA_INFORMATION; + } + + return $this; + } // setExtraInformation() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host_template = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->protocol = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->port = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->product = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->version = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->extra_information = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 8; // 8 = NagiosHostTemplateAutodiscoveryServicePeer::NUM_COLUMNS - NagiosHostTemplateAutodiscoveryServicePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostTemplateAutodiscoveryService object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostTemplateAutodiscoveryServicePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHostTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostTemplateAutodiscoveryServicePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostTemplateAutodiscoveryServicePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostTemplateAutodiscoveryServicePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostTemplateAutodiscoveryServicePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostTemplateAutodiscoveryServicePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosHostTemplateAutodiscoveryServicePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplateAutodiscoveryServicePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHostTemplate(); + break; + case 2: + return $this->getName(); + break; + case 3: + return $this->getProtocol(); + break; + case 4: + return $this->getPort(); + break; + case 5: + return $this->getProduct(); + break; + case 6: + return $this->getVersion(); + break; + case 7: + return $this->getExtraInformation(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostTemplateAutodiscoveryServicePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHostTemplate(), + $keys[2] => $this->getName(), + $keys[3] => $this->getProtocol(), + $keys[4] => $this->getPort(), + $keys[5] => $this->getProduct(), + $keys[6] => $this->getVersion(), + $keys[7] => $this->getExtraInformation(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplateAutodiscoveryServicePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHostTemplate($value); + break; + case 2: + $this->setName($value); + break; + case 3: + $this->setProtocol($value); + break; + case 4: + $this->setPort($value); + break; + case 5: + $this->setProduct($value); + break; + case 6: + $this->setVersion($value); + break; + case 7: + $this->setExtraInformation($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostTemplateAutodiscoveryServicePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHostTemplate($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setProtocol($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setPort($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setProduct($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setExtraInformation($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(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::ID)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::NAME)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::NAME, $this->name); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::PROTOCOL)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::PROTOCOL, $this->protocol); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::PORT)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::PORT, $this->port); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::PRODUCT)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::PRODUCT, $this->product); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::VERSION)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::VERSION, $this->version); + if ($this->isColumnModified(NagiosHostTemplateAutodiscoveryServicePeer::EXTRA_INFORMATION)) $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::EXTRA_INFORMATION, $this->extra_information); + + 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(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, $this->id); + + 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 NagiosHostTemplateAutodiscoveryService (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) + { + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setName($this->name); + + $copyObj->setProtocol($this->protocol); + + $copyObj->setPort($this->port); + + $copyObj->setProduct($this->product); + + $copyObj->setVersion($this->version); + + $copyObj->setExtraInformation($this->extra_information); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostTemplateAutodiscoveryService 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); + $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 NagiosHostTemplateAutodiscoveryServicePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostTemplateAutodiscoveryServicePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostTemplateAutodiscoveryService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateAutodiscoveryService($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostTemplateAutodiscoveryServices($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHostTemplate = null; + } + +} // BaseNagiosHostTemplateAutodiscoveryService diff --git a/classes/om/BaseNagiosHostTemplateAutodiscoveryServicePeer.php b/classes/om/BaseNagiosHostTemplateAutodiscoveryServicePeer.php new file mode 100755 index 0000000..8a27db1 --- /dev/null +++ b/classes/om/BaseNagiosHostTemplateAutodiscoveryServicePeer.php @@ -0,0 +1,952 @@ + array ('Id', 'HostTemplate', 'Name', 'Protocol', 'Port', 'Product', 'Version', 'ExtraInformation', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'hostTemplate', 'name', 'protocol', 'port', 'product', 'version', 'extraInformation', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST_TEMPLATE, self::NAME, self::PROTOCOL, self::PORT, self::PRODUCT, self::VERSION, self::EXTRA_INFORMATION, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host_template', 'name', 'protocol', 'port', 'product', 'version', 'extra_information', ), + 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, 'HostTemplate' => 1, 'Name' => 2, 'Protocol' => 3, 'Port' => 4, 'Product' => 5, 'Version' => 6, 'ExtraInformation' => 7, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'hostTemplate' => 1, 'name' => 2, 'protocol' => 3, 'port' => 4, 'product' => 5, 'version' => 6, 'extraInformation' => 7, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST_TEMPLATE => 1, self::NAME => 2, self::PROTOCOL => 3, self::PORT => 4, self::PRODUCT => 5, self::VERSION => 6, self::EXTRA_INFORMATION => 7, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host_template' => 1, 'name' => 2, 'protocol' => 3, 'port' => 4, 'product' => 5, 'version' => 6, 'extra_information' => 7, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostTemplateAutodiscoveryServiceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostTemplateAutodiscoveryServicePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostTemplateAutodiscoveryServicePeer::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) + { + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::ID); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::NAME); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::PROTOCOL); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::PORT); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::PRODUCT); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::VERSION); + + $criteria->addSelectColumn(NagiosHostTemplateAutodiscoveryServicePeer::EXTRA_INFORMATION); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostTemplateAutodiscoveryService + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostTemplateAutodiscoveryServicePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostTemplateAutodiscoveryServicePeer::populateObjects(NagiosHostTemplateAutodiscoveryServicePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostTemplateAutodiscoveryService $value A NagiosHostTemplateAutodiscoveryService object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostTemplateAutodiscoveryService $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostTemplateAutodiscoveryService object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostTemplateAutodiscoveryService) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostTemplateAutodiscoveryService object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostTemplateAutodiscoveryService Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostTemplateAutodiscoveryServicePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostTemplateAutodiscoveryServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostTemplateAutodiscoveryServicePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostTemplateAutodiscoveryServicePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostTemplateAutodiscoveryService objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateAutodiscoveryService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplateAutodiscoveryServicePeer::NUM_COLUMNS - NagiosHostTemplateAutodiscoveryServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateAutodiscoveryServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateAutodiscoveryServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplateAutodiscoveryServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateAutodiscoveryServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateAutodiscoveryService) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostTemplateAutodiscoveryService($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostTemplateAutodiscoveryService objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateAutodiscoveryService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateAutodiscoveryServicePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplateAutodiscoveryServicePeer::NUM_COLUMNS - NagiosHostTemplateAutodiscoveryServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateAutodiscoveryServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateAutodiscoveryServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplateAutodiscoveryServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateAutodiscoveryServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostTemplateAutodiscoveryService) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostTemplateAutodiscoveryService($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostTemplateAutodiscoveryServicePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostTemplateAutodiscoveryService or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplateAutodiscoveryService object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostTemplateAutodiscoveryService object + } + + if ($criteria->containsKey(NagiosHostTemplateAutodiscoveryServicePeer::ID) && $criteria->keyContainsValue(NagiosHostTemplateAutodiscoveryServicePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostTemplateAutodiscoveryServicePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostTemplateAutodiscoveryService or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplateAutodiscoveryService object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostTemplateAutodiscoveryServicePeer::ID); + $selectCriteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, $criteria->remove(NagiosHostTemplateAutodiscoveryServicePeer::ID), $comparison); + + } else { // $values is NagiosHostTemplateAutodiscoveryService object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_template_autodiscovery_service 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(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostTemplateAutodiscoveryService or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostTemplateAutodiscoveryService object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostTemplateAutodiscoveryServicePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostTemplateAutodiscoveryService) { + // invalidate the cache for this single object + NagiosHostTemplateAutodiscoveryServicePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostTemplateAutodiscoveryServicePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostTemplateAutodiscoveryService 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 NagiosHostTemplateAutodiscoveryService $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(NagiosHostTemplateAutodiscoveryService $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostTemplateAutodiscoveryService + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostTemplateAutodiscoveryServicePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, $pk); + + $v = NagiosHostTemplateAutodiscoveryServicePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplateAutodiscoveryServicePeer::ID, $pks, Criteria::IN); + $objs = NagiosHostTemplateAutodiscoveryServicePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostTemplateAutodiscoveryServicePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostTemplateAutodiscoveryServicePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostTemplateAutodiscoveryServicePeer class: +// +// Propel::getDatabaseMap(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME)->addTableBuilder(NagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME, NagiosHostTemplateAutodiscoveryServicePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostTemplateAutodiscoveryServicePeer::TABLE_NAME, BaseNagiosHostTemplateAutodiscoveryServicePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostTemplateInheritance.php b/classes/om/BaseNagiosHostTemplateInheritance.php new file mode 100755 index 0000000..65a9c39 --- /dev/null +++ b/classes/om/BaseNagiosHostTemplateInheritance.php @@ -0,0 +1,1059 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [source_host] column value. + * + * @return int + */ + public function getSourceHost() + { + return $this->source_host; + } + + /** + * Get the [source_template] column value. + * + * @return int + */ + public function getSourceTemplate() + { + return $this->source_template; + } + + /** + * Get the [target_template] column value. + * + * @return int + */ + public function getTargetTemplate() + { + return $this->target_template; + } + + /** + * Get the [order] column value. + * + * @return int + */ + public function getOrder() + { + return $this->order; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [source_host] column. + * + * @param int $v new value + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + */ + public function setSourceHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->source_host !== $v) { + $this->source_host = $v; + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::SOURCE_HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setSourceHost() + + /** + * Set the value of [source_template] column. + * + * @param int $v new value + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + */ + public function setSourceTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->source_template !== $v) { + $this->source_template = $v; + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE; + } + + if ($this->aNagiosHostTemplateRelatedBySourceTemplate !== null && $this->aNagiosHostTemplateRelatedBySourceTemplate->getId() !== $v) { + $this->aNagiosHostTemplateRelatedBySourceTemplate = null; + } + + return $this; + } // setSourceTemplate() + + /** + * Set the value of [target_template] column. + * + * @param int $v new value + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + */ + public function setTargetTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->target_template !== $v) { + $this->target_template = $v; + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE; + } + + if ($this->aNagiosHostTemplateRelatedByTargetTemplate !== null && $this->aNagiosHostTemplateRelatedByTargetTemplate->getId() !== $v) { + $this->aNagiosHostTemplateRelatedByTargetTemplate = null; + } + + return $this; + } // setTargetTemplate() + + /** + * Set the value of [order] column. + * + * @param int $v new value + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + */ + public function setOrder($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->order !== $v) { + $this->order = $v; + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::ORDER; + } + + return $this; + } // setOrder() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->source_host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->source_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->target_template = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->order = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostTemplateInheritance object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->source_host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplateRelatedBySourceTemplate !== null && $this->source_template !== $this->aNagiosHostTemplateRelatedBySourceTemplate->getId()) { + $this->aNagiosHostTemplateRelatedBySourceTemplate = null; + } + if ($this->aNagiosHostTemplateRelatedByTargetTemplate !== null && $this->target_template !== $this->aNagiosHostTemplateRelatedByTargetTemplate->getId()) { + $this->aNagiosHostTemplateRelatedByTargetTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostTemplateInheritancePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplateRelatedBySourceTemplate = null; + $this->aNagiosHostTemplateRelatedByTargetTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostTemplateInheritancePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostTemplateInheritancePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplateRelatedBySourceTemplate !== null) { + if ($this->aNagiosHostTemplateRelatedBySourceTemplate->isModified() || $this->aNagiosHostTemplateRelatedBySourceTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplateRelatedBySourceTemplate->save($con); + } + $this->setNagiosHostTemplateRelatedBySourceTemplate($this->aNagiosHostTemplateRelatedBySourceTemplate); + } + + if ($this->aNagiosHostTemplateRelatedByTargetTemplate !== null) { + if ($this->aNagiosHostTemplateRelatedByTargetTemplate->isModified() || $this->aNagiosHostTemplateRelatedByTargetTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplateRelatedByTargetTemplate->save($con); + } + $this->setNagiosHostTemplateRelatedByTargetTemplate($this->aNagiosHostTemplateRelatedByTargetTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostTemplateInheritancePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostTemplateInheritancePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostTemplateInheritancePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplateRelatedBySourceTemplate !== null) { + if (!$this->aNagiosHostTemplateRelatedBySourceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplateRelatedBySourceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplateRelatedByTargetTemplate !== null) { + if (!$this->aNagiosHostTemplateRelatedByTargetTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplateRelatedByTargetTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosHostTemplateInheritancePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplateInheritancePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getSourceHost(); + break; + case 2: + return $this->getSourceTemplate(); + break; + case 3: + return $this->getTargetTemplate(); + break; + case 4: + return $this->getOrder(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostTemplateInheritancePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getSourceHost(), + $keys[2] => $this->getSourceTemplate(), + $keys[3] => $this->getTargetTemplate(), + $keys[4] => $this->getOrder(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostTemplateInheritancePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setSourceHost($value); + break; + case 2: + $this->setSourceTemplate($value); + break; + case 3: + $this->setTargetTemplate($value); + break; + case 4: + $this->setOrder($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostTemplateInheritancePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSourceHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setSourceTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTargetTemplate($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setOrder($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(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostTemplateInheritancePeer::ID)) $criteria->add(NagiosHostTemplateInheritancePeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostTemplateInheritancePeer::SOURCE_HOST)) $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_HOST, $this->source_host); + if ($this->isColumnModified(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE)) $criteria->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $this->source_template); + if ($this->isColumnModified(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE)) $criteria->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $this->target_template); + if ($this->isColumnModified(NagiosHostTemplateInheritancePeer::ORDER)) $criteria->add(NagiosHostTemplateInheritancePeer::ORDER, $this->order); + + 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(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + $criteria->add(NagiosHostTemplateInheritancePeer::ID, $this->id); + + 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 NagiosHostTemplateInheritance (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) + { + + $copyObj->setSourceHost($this->source_host); + + $copyObj->setSourceTemplate($this->source_template); + + $copyObj->setTargetTemplate($this->target_template); + + $copyObj->setOrder($this->order); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostTemplateInheritance 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); + $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 NagiosHostTemplateInheritancePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostTemplateInheritancePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setSourceHost(NULL); + } else { + $this->setSourceHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateInheritance($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->source_host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->source_host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosHostTemplateInheritances($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplateRelatedBySourceTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setSourceTemplate(NULL); + } else { + $this->setSourceTemplate($v->getId()); + } + + $this->aNagiosHostTemplateRelatedBySourceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateInheritanceRelatedBySourceTemplate($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplateRelatedBySourceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplateRelatedBySourceTemplate === null && ($this->source_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->source_template); + $this->aNagiosHostTemplateRelatedBySourceTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplateRelatedBySourceTemplate->addNagiosHostTemplateInheritancesRelatedBySourceTemplate($this); + */ + } + return $this->aNagiosHostTemplateRelatedBySourceTemplate; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplateRelatedByTargetTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setTargetTemplate(NULL); + } else { + $this->setTargetTemplate($v->getId()); + } + + $this->aNagiosHostTemplateRelatedByTargetTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostTemplateInheritanceRelatedByTargetTemplate($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplateRelatedByTargetTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplateRelatedByTargetTemplate === null && ($this->target_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->target_template); + $this->aNagiosHostTemplateRelatedByTargetTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplateRelatedByTargetTemplate->addNagiosHostTemplateInheritancesRelatedByTargetTemplate($this); + */ + } + return $this->aNagiosHostTemplateRelatedByTargetTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHost = null; + $this->aNagiosHostTemplateRelatedBySourceTemplate = null; + $this->aNagiosHostTemplateRelatedByTargetTemplate = null; + } + +} // BaseNagiosHostTemplateInheritance diff --git a/classes/om/BaseNagiosHostTemplateInheritancePeer.php b/classes/om/BaseNagiosHostTemplateInheritancePeer.php new file mode 100755 index 0000000..2c07fcd --- /dev/null +++ b/classes/om/BaseNagiosHostTemplateInheritancePeer.php @@ -0,0 +1,1617 @@ + array ('Id', 'SourceHost', 'SourceTemplate', 'TargetTemplate', 'Order', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'sourceHost', 'sourceTemplate', 'targetTemplate', 'order', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SOURCE_HOST, self::SOURCE_TEMPLATE, self::TARGET_TEMPLATE, self::ORDER, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'source_host', 'source_template', 'target_template', 'order', ), + 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, 'SourceHost' => 1, 'SourceTemplate' => 2, 'TargetTemplate' => 3, 'Order' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'sourceHost' => 1, 'sourceTemplate' => 2, 'targetTemplate' => 3, 'order' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SOURCE_HOST => 1, self::SOURCE_TEMPLATE => 2, self::TARGET_TEMPLATE => 3, self::ORDER => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'source_host' => 1, 'source_template' => 2, 'target_template' => 3, 'order' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostTemplateInheritanceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostTemplateInheritancePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostTemplateInheritancePeer::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) + { + + $criteria->addSelectColumn(NagiosHostTemplateInheritancePeer::ID); + + $criteria->addSelectColumn(NagiosHostTemplateInheritancePeer::SOURCE_HOST); + + $criteria->addSelectColumn(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostTemplateInheritancePeer::ORDER); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostTemplateInheritance + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostTemplateInheritancePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostTemplateInheritancePeer::populateObjects(NagiosHostTemplateInheritancePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostTemplateInheritance $value A NagiosHostTemplateInheritance object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostTemplateInheritance $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostTemplateInheritance object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostTemplateInheritance) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostTemplateInheritance object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostTemplateInheritance Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostTemplateInheritancePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplateRelatedBySourceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplateRelatedBySourceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplateRelatedByTargetTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplateRelatedByTargetTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to $obj2 (NagiosHost) + $obj2->addNagiosHostTemplateInheritance($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplateRelatedBySourceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostTemplateInheritanceRelatedBySourceTemplate($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplateRelatedByTargetTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostTemplateInheritanceRelatedByTargetTemplate($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostTemplateInheritance($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostTemplateInheritanceRelatedBySourceTemplate($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key4 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostTemplatePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj4 (NagiosHostTemplate) + $obj4->addNagiosHostTemplateInheritanceRelatedByTargetTemplate($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplateRelatedBySourceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplateRelatedBySourceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplateRelatedByTargetTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplateRelatedByTargetTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostTemplateInheritanceRelatedBySourceTemplate($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostTemplateInheritanceRelatedByTargetTemplate($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with all related objects except NagiosHostTemplateRelatedBySourceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplateRelatedBySourceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostTemplateInheritance($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplateInheritance objects pre-filled with all related objects except NagiosHostTemplateRelatedByTargetTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplateRelatedByTargetTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplateInheritancePeer::NUM_COLUMNS - NagiosHostTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplateInheritancePeer::SOURCE_HOST,), array(NagiosHostPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplateInheritance) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostTemplateInheritance($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostTemplateInheritancePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostTemplateInheritance or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplateInheritance object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostTemplateInheritance object + } + + if ($criteria->containsKey(NagiosHostTemplateInheritancePeer::ID) && $criteria->keyContainsValue(NagiosHostTemplateInheritancePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostTemplateInheritancePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostTemplateInheritance or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplateInheritance object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostTemplateInheritancePeer::ID); + $selectCriteria->add(NagiosHostTemplateInheritancePeer::ID, $criteria->remove(NagiosHostTemplateInheritancePeer::ID), $comparison); + + } else { // $values is NagiosHostTemplateInheritance object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_template_inheritance 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(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostTemplateInheritancePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostTemplateInheritance or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostTemplateInheritance object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostTemplateInheritancePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostTemplateInheritance) { + // invalidate the cache for this single object + NagiosHostTemplateInheritancePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostTemplateInheritancePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostTemplateInheritancePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostTemplateInheritance 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 NagiosHostTemplateInheritance $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(NagiosHostTemplateInheritance $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostTemplateInheritancePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostTemplateInheritancePeer::DATABASE_NAME, NagiosHostTemplateInheritancePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostTemplateInheritance + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostTemplateInheritancePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplateInheritancePeer::ID, $pk); + + $v = NagiosHostTemplateInheritancePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplateInheritancePeer::ID, $pks, Criteria::IN); + $objs = NagiosHostTemplateInheritancePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostTemplateInheritancePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostTemplateInheritancePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostTemplateInheritancePeer class: +// +// Propel::getDatabaseMap(NagiosHostTemplateInheritancePeer::DATABASE_NAME)->addTableBuilder(NagiosHostTemplateInheritancePeer::TABLE_NAME, NagiosHostTemplateInheritancePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostTemplateInheritancePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostTemplateInheritancePeer::TABLE_NAME, BaseNagiosHostTemplateInheritancePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostTemplatePeer.php b/classes/om/BaseNagiosHostTemplatePeer.php new file mode 100755 index 0000000..213527b --- /dev/null +++ b/classes/om/BaseNagiosHostTemplatePeer.php @@ -0,0 +1,2381 @@ + array ('Id', 'Name', 'Description', 'InitialState', 'CheckCommand', 'RetryInterval', 'FirstNotificationDelay', 'MaximumCheckAttempts', 'CheckInterval', 'PassiveChecksEnabled', 'CheckPeriod', 'ObsessOverHost', 'CheckFreshness', 'FreshnessThreshold', 'ActiveChecksEnabled', 'ChecksEnabled', 'EventHandler', 'EventHandlerEnabled', 'LowFlapThreshold', 'HighFlapThreshold', 'FlapDetectionEnabled', 'ProcessPerfData', 'RetainStatusInformation', 'RetainNonstatusInformation', 'NotificationInterval', 'NotificationPeriod', 'NotificationsEnabled', 'NotificationOnDown', 'NotificationOnUnreachable', 'NotificationOnRecovery', 'NotificationOnFlapping', 'NotificationOnScheduledDowntime', 'StalkingOnUp', 'StalkingOnDown', 'StalkingOnUnreachable', 'FailurePredictionEnabled', 'FlapDetectionOnUp', 'FlapDetectionOnDown', 'FlapDetectionOnUnreachable', 'Notes', 'NotesUrl', 'ActionUrl', 'IconImage', 'IconImageAlt', 'VrmlImage', 'StatusmapImage', 'TwoDCoords', 'ThreeDCoords', 'AutodiscoveryAddressFilter', 'AutodiscoveryHostnameFilter', 'AutodiscoveryOsFamilyFilter', 'AutodiscoveryOsGenerationFilter', 'AutodiscoveryOsVendorFilter', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'description', 'initialState', 'checkCommand', 'retryInterval', 'firstNotificationDelay', 'maximumCheckAttempts', 'checkInterval', 'passiveChecksEnabled', 'checkPeriod', 'obsessOverHost', 'checkFreshness', 'freshnessThreshold', 'activeChecksEnabled', 'checksEnabled', 'eventHandler', 'eventHandlerEnabled', 'lowFlapThreshold', 'highFlapThreshold', 'flapDetectionEnabled', 'processPerfData', 'retainStatusInformation', 'retainNonstatusInformation', 'notificationInterval', 'notificationPeriod', 'notificationsEnabled', 'notificationOnDown', 'notificationOnUnreachable', 'notificationOnRecovery', 'notificationOnFlapping', 'notificationOnScheduledDowntime', 'stalkingOnUp', 'stalkingOnDown', 'stalkingOnUnreachable', 'failurePredictionEnabled', 'flapDetectionOnUp', 'flapDetectionOnDown', 'flapDetectionOnUnreachable', 'notes', 'notesUrl', 'actionUrl', 'iconImage', 'iconImageAlt', 'vrmlImage', 'statusmapImage', 'twoDCoords', 'threeDCoords', 'autodiscoveryAddressFilter', 'autodiscoveryHostnameFilter', 'autodiscoveryOsFamilyFilter', 'autodiscoveryOsGenerationFilter', 'autodiscoveryOsVendorFilter', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::INITIAL_STATE, self::CHECK_COMMAND, self::RETRY_INTERVAL, self::FIRST_NOTIFICATION_DELAY, self::MAXIMUM_CHECK_ATTEMPTS, self::CHECK_INTERVAL, self::PASSIVE_CHECKS_ENABLED, self::CHECK_PERIOD, self::OBSESS_OVER_HOST, self::CHECK_FRESHNESS, self::FRESHNESS_THRESHOLD, self::ACTIVE_CHECKS_ENABLED, self::CHECKS_ENABLED, self::EVENT_HANDLER, self::EVENT_HANDLER_ENABLED, self::LOW_FLAP_THRESHOLD, self::HIGH_FLAP_THRESHOLD, self::FLAP_DETECTION_ENABLED, self::PROCESS_PERF_DATA, self::RETAIN_STATUS_INFORMATION, self::RETAIN_NONSTATUS_INFORMATION, self::NOTIFICATION_INTERVAL, self::NOTIFICATION_PERIOD, self::NOTIFICATIONS_ENABLED, self::NOTIFICATION_ON_DOWN, self::NOTIFICATION_ON_UNREACHABLE, self::NOTIFICATION_ON_RECOVERY, self::NOTIFICATION_ON_FLAPPING, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME, self::STALKING_ON_UP, self::STALKING_ON_DOWN, self::STALKING_ON_UNREACHABLE, self::FAILURE_PREDICTION_ENABLED, self::FLAP_DETECTION_ON_UP, self::FLAP_DETECTION_ON_DOWN, self::FLAP_DETECTION_ON_UNREACHABLE, self::NOTES, self::NOTES_URL, self::ACTION_URL, self::ICON_IMAGE, self::ICON_IMAGE_ALT, self::VRML_IMAGE, self::STATUSMAP_IMAGE, self::TWO_D_COORDS, self::THREE_D_COORDS, self::AUTODISCOVERY_ADDRESS_FILTER, self::AUTODISCOVERY_HOSTNAME_FILTER, self::AUTODISCOVERY_OS_FAMILY_FILTER, self::AUTODISCOVERY_OS_GENERATION_FILTER, self::AUTODISCOVERY_OS_VENDOR_FILTER, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'initial_state', 'check_command', 'retry_interval', 'first_notification_delay', 'maximum_check_attempts', 'check_interval', 'passive_checks_enabled', 'check_period', 'obsess_over_host', 'check_freshness', 'freshness_threshold', 'active_checks_enabled', 'checks_enabled', 'event_handler', 'event_handler_enabled', 'low_flap_threshold', 'high_flap_threshold', 'flap_detection_enabled', 'process_perf_data', 'retain_status_information', 'retain_nonstatus_information', 'notification_interval', 'notification_period', 'notifications_enabled', 'notification_on_down', 'notification_on_unreachable', 'notification_on_recovery', 'notification_on_flapping', 'notification_on_scheduled_downtime', 'stalking_on_up', 'stalking_on_down', 'stalking_on_unreachable', 'failure_prediction_enabled', 'flap_detection_on_up', 'flap_detection_on_down', 'flap_detection_on_unreachable', 'notes', 'notes_url', 'action_url', 'icon_image', 'icon_image_alt', 'vrml_image', 'statusmap_image', 'two_d_coords', 'three_d_coords', 'autodiscovery_address_filter', 'autodiscovery_hostname_filter', 'autodiscovery_os_family_filter', 'autodiscovery_os_generation_filter', 'autodiscovery_os_vendor_filter', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, ) + ); + + /** + * 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, 'Name' => 1, 'Description' => 2, 'InitialState' => 3, 'CheckCommand' => 4, 'RetryInterval' => 5, 'FirstNotificationDelay' => 6, 'MaximumCheckAttempts' => 7, 'CheckInterval' => 8, 'PassiveChecksEnabled' => 9, 'CheckPeriod' => 10, 'ObsessOverHost' => 11, 'CheckFreshness' => 12, 'FreshnessThreshold' => 13, 'ActiveChecksEnabled' => 14, 'ChecksEnabled' => 15, 'EventHandler' => 16, 'EventHandlerEnabled' => 17, 'LowFlapThreshold' => 18, 'HighFlapThreshold' => 19, 'FlapDetectionEnabled' => 20, 'ProcessPerfData' => 21, 'RetainStatusInformation' => 22, 'RetainNonstatusInformation' => 23, 'NotificationInterval' => 24, 'NotificationPeriod' => 25, 'NotificationsEnabled' => 26, 'NotificationOnDown' => 27, 'NotificationOnUnreachable' => 28, 'NotificationOnRecovery' => 29, 'NotificationOnFlapping' => 30, 'NotificationOnScheduledDowntime' => 31, 'StalkingOnUp' => 32, 'StalkingOnDown' => 33, 'StalkingOnUnreachable' => 34, 'FailurePredictionEnabled' => 35, 'FlapDetectionOnUp' => 36, 'FlapDetectionOnDown' => 37, 'FlapDetectionOnUnreachable' => 38, 'Notes' => 39, 'NotesUrl' => 40, 'ActionUrl' => 41, 'IconImage' => 42, 'IconImageAlt' => 43, 'VrmlImage' => 44, 'StatusmapImage' => 45, 'TwoDCoords' => 46, 'ThreeDCoords' => 47, 'AutodiscoveryAddressFilter' => 48, 'AutodiscoveryHostnameFilter' => 49, 'AutodiscoveryOsFamilyFilter' => 50, 'AutodiscoveryOsGenerationFilter' => 51, 'AutodiscoveryOsVendorFilter' => 52, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'initialState' => 3, 'checkCommand' => 4, 'retryInterval' => 5, 'firstNotificationDelay' => 6, 'maximumCheckAttempts' => 7, 'checkInterval' => 8, 'passiveChecksEnabled' => 9, 'checkPeriod' => 10, 'obsessOverHost' => 11, 'checkFreshness' => 12, 'freshnessThreshold' => 13, 'activeChecksEnabled' => 14, 'checksEnabled' => 15, 'eventHandler' => 16, 'eventHandlerEnabled' => 17, 'lowFlapThreshold' => 18, 'highFlapThreshold' => 19, 'flapDetectionEnabled' => 20, 'processPerfData' => 21, 'retainStatusInformation' => 22, 'retainNonstatusInformation' => 23, 'notificationInterval' => 24, 'notificationPeriod' => 25, 'notificationsEnabled' => 26, 'notificationOnDown' => 27, 'notificationOnUnreachable' => 28, 'notificationOnRecovery' => 29, 'notificationOnFlapping' => 30, 'notificationOnScheduledDowntime' => 31, 'stalkingOnUp' => 32, 'stalkingOnDown' => 33, 'stalkingOnUnreachable' => 34, 'failurePredictionEnabled' => 35, 'flapDetectionOnUp' => 36, 'flapDetectionOnDown' => 37, 'flapDetectionOnUnreachable' => 38, 'notes' => 39, 'notesUrl' => 40, 'actionUrl' => 41, 'iconImage' => 42, 'iconImageAlt' => 43, 'vrmlImage' => 44, 'statusmapImage' => 45, 'twoDCoords' => 46, 'threeDCoords' => 47, 'autodiscoveryAddressFilter' => 48, 'autodiscoveryHostnameFilter' => 49, 'autodiscoveryOsFamilyFilter' => 50, 'autodiscoveryOsGenerationFilter' => 51, 'autodiscoveryOsVendorFilter' => 52, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::INITIAL_STATE => 3, self::CHECK_COMMAND => 4, self::RETRY_INTERVAL => 5, self::FIRST_NOTIFICATION_DELAY => 6, self::MAXIMUM_CHECK_ATTEMPTS => 7, self::CHECK_INTERVAL => 8, self::PASSIVE_CHECKS_ENABLED => 9, self::CHECK_PERIOD => 10, self::OBSESS_OVER_HOST => 11, self::CHECK_FRESHNESS => 12, self::FRESHNESS_THRESHOLD => 13, self::ACTIVE_CHECKS_ENABLED => 14, self::CHECKS_ENABLED => 15, self::EVENT_HANDLER => 16, self::EVENT_HANDLER_ENABLED => 17, self::LOW_FLAP_THRESHOLD => 18, self::HIGH_FLAP_THRESHOLD => 19, self::FLAP_DETECTION_ENABLED => 20, self::PROCESS_PERF_DATA => 21, self::RETAIN_STATUS_INFORMATION => 22, self::RETAIN_NONSTATUS_INFORMATION => 23, self::NOTIFICATION_INTERVAL => 24, self::NOTIFICATION_PERIOD => 25, self::NOTIFICATIONS_ENABLED => 26, self::NOTIFICATION_ON_DOWN => 27, self::NOTIFICATION_ON_UNREACHABLE => 28, self::NOTIFICATION_ON_RECOVERY => 29, self::NOTIFICATION_ON_FLAPPING => 30, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME => 31, self::STALKING_ON_UP => 32, self::STALKING_ON_DOWN => 33, self::STALKING_ON_UNREACHABLE => 34, self::FAILURE_PREDICTION_ENABLED => 35, self::FLAP_DETECTION_ON_UP => 36, self::FLAP_DETECTION_ON_DOWN => 37, self::FLAP_DETECTION_ON_UNREACHABLE => 38, self::NOTES => 39, self::NOTES_URL => 40, self::ACTION_URL => 41, self::ICON_IMAGE => 42, self::ICON_IMAGE_ALT => 43, self::VRML_IMAGE => 44, self::STATUSMAP_IMAGE => 45, self::TWO_D_COORDS => 46, self::THREE_D_COORDS => 47, self::AUTODISCOVERY_ADDRESS_FILTER => 48, self::AUTODISCOVERY_HOSTNAME_FILTER => 49, self::AUTODISCOVERY_OS_FAMILY_FILTER => 50, self::AUTODISCOVERY_OS_GENERATION_FILTER => 51, self::AUTODISCOVERY_OS_VENDOR_FILTER => 52, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'initial_state' => 3, 'check_command' => 4, 'retry_interval' => 5, 'first_notification_delay' => 6, 'maximum_check_attempts' => 7, 'check_interval' => 8, 'passive_checks_enabled' => 9, 'check_period' => 10, 'obsess_over_host' => 11, 'check_freshness' => 12, 'freshness_threshold' => 13, 'active_checks_enabled' => 14, 'checks_enabled' => 15, 'event_handler' => 16, 'event_handler_enabled' => 17, 'low_flap_threshold' => 18, 'high_flap_threshold' => 19, 'flap_detection_enabled' => 20, 'process_perf_data' => 21, 'retain_status_information' => 22, 'retain_nonstatus_information' => 23, 'notification_interval' => 24, 'notification_period' => 25, 'notifications_enabled' => 26, 'notification_on_down' => 27, 'notification_on_unreachable' => 28, 'notification_on_recovery' => 29, 'notification_on_flapping' => 30, 'notification_on_scheduled_downtime' => 31, 'stalking_on_up' => 32, 'stalking_on_down' => 33, 'stalking_on_unreachable' => 34, 'failure_prediction_enabled' => 35, 'flap_detection_on_up' => 36, 'flap_detection_on_down' => 37, 'flap_detection_on_unreachable' => 38, 'notes' => 39, 'notes_url' => 40, 'action_url' => 41, 'icon_image' => 42, 'icon_image_alt' => 43, 'vrml_image' => 44, 'statusmap_image' => 45, 'two_d_coords' => 46, 'three_d_coords' => 47, 'autodiscovery_address_filter' => 48, 'autodiscovery_hostname_filter' => 49, 'autodiscovery_os_family_filter' => 50, 'autodiscovery_os_generation_filter' => 51, 'autodiscovery_os_vendor_filter' => 52, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostTemplateMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostTemplatePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostTemplatePeer::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) + { + + $criteria->addSelectColumn(NagiosHostTemplatePeer::ID); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NAME); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::DESCRIPTION); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::INITIAL_STATE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::CHECK_COMMAND); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::RETRY_INTERVAL); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FIRST_NOTIFICATION_DELAY); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::MAXIMUM_CHECK_ATTEMPTS); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::PASSIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::CHECK_PERIOD); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::OBSESS_OVER_HOST); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::CHECK_FRESHNESS); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FRESHNESS_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::ACTIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::EVENT_HANDLER_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::LOW_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::HIGH_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FLAP_DETECTION_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::PROCESS_PERF_DATA); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::RETAIN_STATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::RETAIN_NONSTATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_INTERVAL); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::STALKING_ON_UP); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::STALKING_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::STALKING_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FAILURE_PREDICTION_ENABLED); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UP); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FLAP_DETECTION_ON_DOWN); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::FLAP_DETECTION_ON_UNREACHABLE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTES); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::ACTION_URL); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::ICON_IMAGE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::ICON_IMAGE_ALT); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::VRML_IMAGE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::STATUSMAP_IMAGE); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::TWO_D_COORDS); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::THREE_D_COORDS); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::AUTODISCOVERY_ADDRESS_FILTER); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::AUTODISCOVERY_HOSTNAME_FILTER); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::AUTODISCOVERY_OS_FAMILY_FILTER); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::AUTODISCOVERY_OS_GENERATION_FILTER); + + $criteria->addSelectColumn(NagiosHostTemplatePeer::AUTODISCOVERY_OS_VENDOR_FILTER); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostTemplate + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostTemplatePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostTemplatePeer::populateObjects(NagiosHostTemplatePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostTemplate $value A NagiosHostTemplate object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostTemplate $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostTemplate object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostTemplate) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostTemplate object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostTemplate Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostTemplatePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostTemplatePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostTemplatePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to $obj2 (NagiosCommand) + $obj2->addNagiosHostTemplateRelatedByCheckCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to $obj2 (NagiosCommand) + $obj2->addNagiosHostTemplateRelatedByEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostTemplateRelatedByCheckPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostTemplateRelatedByCheckCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostTemplateRelatedByEventHandler($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key4 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosTimeperiodPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosTimeperiodPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj4 (NagiosTimeperiod) + $obj4->addNagiosHostTemplateRelatedByCheckPeriod($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key5 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosTimeperiodPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosTimeperiodPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj5 (NagiosTimeperiod) + $obj5->addNagiosHostTemplateRelatedByNotificationPeriod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with all related objects except NagiosCommandRelatedByCheckCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostTemplateRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosHostTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with all related objects except NagiosCommandRelatedByEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosHostTemplateRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosHostTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with all related objects except NagiosTimeperiodRelatedByCheckPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostTemplateRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostTemplateRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostTemplate objects pre-filled with all related objects except NagiosTimeperiodRelatedByNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosHostTemplateRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosHostTemplateRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostTemplatePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostTemplate or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplate object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostTemplate object + } + + if ($criteria->containsKey(NagiosHostTemplatePeer::ID) && $criteria->keyContainsValue(NagiosHostTemplatePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostTemplatePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostTemplate or Criteria object. + * + * @param mixed $values Criteria or NagiosHostTemplate object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostTemplatePeer::ID); + $selectCriteria->add(NagiosHostTemplatePeer::ID, $criteria->remove(NagiosHostTemplatePeer::ID), $comparison); + + } else { // $values is NagiosHostTemplate object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_host_template 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(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosHostTemplatePeer::doOnDeleteCascade(new Criteria(NagiosHostTemplatePeer::DATABASE_NAME), $con); + NagiosHostTemplatePeer::doOnDeleteSetNull(new Criteria(NagiosHostTemplatePeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosHostTemplatePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostTemplate or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostTemplate object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostTemplatePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostTemplate) { + // invalidate the cache for this single object + NagiosHostTemplatePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostTemplatePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostTemplatePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosHostTemplatePeer::doOnDeleteCascade($criteria, $con); + NagiosHostTemplatePeer::doOnDeleteSetNull($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosHostTemplatePeer::clearInstancePool(); + } else { // it's a PK or object + NagiosHostTemplatePeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosHostTemplateAutodiscoveryServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplateAutodiscoveryServicePeer::clearInstancePool(); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + // invalidate objects in NagiosHostContactgroupPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostContactgroupPeer::clearInstancePool(); + + // invalidate objects in NagiosHostgroupMembershipPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostgroupMembershipPeer::clearInstancePool(); + + // invalidate objects in NagiosHostCheckCommandParameterPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostCheckCommandParameterPeer::clearInstancePool(); + + // invalidate objects in NagiosHostParentPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostParentPeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplateInheritancePeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplateInheritancePeer::clearInstancePool(); + + // invalidate objects in AutodiscoveryDevicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDevicePeer::clearInstancePool(); + + // invalidate objects in AutodiscoveryDeviceTemplateMatchPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + AutodiscoveryDeviceTemplateMatchPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosHostTemplatePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosHostTemplateAutodiscoveryService objects + $c = new Criteria(NagiosHostTemplateAutodiscoveryServicePeer::DATABASE_NAME); + + $c->add(NagiosHostTemplateAutodiscoveryServicePeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostTemplateAutodiscoveryServicePeer::doDelete($c, $con); + + // delete related NagiosService objects + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + + $c->add(NagiosServicePeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosServicePeer::doDelete($c, $con); + + // delete related NagiosHostContactMember objects + $c = new Criteria(NagiosHostContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosHostContactMemberPeer::TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostContactMemberPeer::doDelete($c, $con); + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + + // delete related NagiosEscalation objects + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + + $c->add(NagiosEscalationPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosEscalationPeer::doDelete($c, $con); + + // delete related NagiosHostContactgroup objects + $c = new Criteria(NagiosHostContactgroupPeer::DATABASE_NAME); + + $c->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostContactgroupPeer::doDelete($c, $con); + + // delete related NagiosHostgroupMembership objects + $c = new Criteria(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + $c->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostgroupMembershipPeer::doDelete($c, $con); + + // delete related NagiosHostCheckCommandParameter objects + $c = new Criteria(NagiosHostCheckCommandParameterPeer::DATABASE_NAME); + + $c->add(NagiosHostCheckCommandParameterPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostCheckCommandParameterPeer::doDelete($c, $con); + + // delete related NagiosHostParent objects + $c = new Criteria(NagiosHostParentPeer::DATABASE_NAME); + + $c->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostParentPeer::doDelete($c, $con); + + // delete related NagiosHostTemplateInheritance objects + $c = new Criteria(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosHostTemplateInheritancePeer::SOURCE_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostTemplateInheritancePeer::doDelete($c, $con); + + // delete related NagiosHostTemplateInheritance objects + $c = new Criteria(NagiosHostTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosHostTemplateInheritancePeer::TARGET_TEMPLATE, $obj->getId()); + $affectedRows += NagiosHostTemplateInheritancePeer::doDelete($c, $con); + + // delete related AutodiscoveryDeviceTemplateMatch objects + $c = new Criteria(AutodiscoveryDeviceTemplateMatchPeer::DATABASE_NAME); + + $c->add(AutodiscoveryDeviceTemplateMatchPeer::HOST_TEMPLATE, $obj->getId()); + $affectedRows += AutodiscoveryDeviceTemplateMatchPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * This is a method for emulating ON DELETE SET NULL DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return void + */ + protected static function doOnDeleteSetNull(Criteria $criteria, PropelPDO $con) + { + + // first find the objects that are implicated by the $criteria + $objects = NagiosHostTemplatePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + // set fkey col in related AutodiscoveryDevice rows to NULL + $selectCriteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $selectCriteria->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, $obj->getId()); + $updateValues->add(AutodiscoveryDevicePeer::HOST_TEMPLATE, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + } + } + + /** + * Validates all modified columns of given NagiosHostTemplate 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 NagiosHostTemplate $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(NagiosHostTemplate $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostTemplatePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostTemplatePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostTemplatePeer::DATABASE_NAME, NagiosHostTemplatePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostTemplate + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostTemplatePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplatePeer::ID, $pk); + + $v = NagiosHostTemplatePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $criteria->add(NagiosHostTemplatePeer::ID, $pks, Criteria::IN); + $objs = NagiosHostTemplatePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostTemplatePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostTemplatePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostTemplatePeer class: +// +// Propel::getDatabaseMap(NagiosHostTemplatePeer::DATABASE_NAME)->addTableBuilder(NagiosHostTemplatePeer::TABLE_NAME, NagiosHostTemplatePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostTemplatePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostTemplatePeer::TABLE_NAME, BaseNagiosHostTemplatePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostgroup.php b/classes/om/BaseNagiosHostgroup.php new file mode 100755 index 0000000..82f847b --- /dev/null +++ b/classes/om/BaseNagiosHostgroup.php @@ -0,0 +1,2832 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosHostgroup The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosHostgroupPeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->notes = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->notes_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->action_url = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 6; // 6 = NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostgroup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostgroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collNagiosServices = null; + $this->lastNagiosServiceCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosDependencyTargets = null; + $this->lastNagiosDependencyTargetCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + $this->collNagiosHostgroupMemberships = null; + $this->lastNagiosHostgroupMembershipCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostgroupPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostgroupPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostgroupPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostgroupPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostgroupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosHostgroupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosServices !== null) { + foreach ($this->collNagiosServices as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostgroupMemberships !== null) { + foreach ($this->collNagiosHostgroupMemberships as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostgroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + case 3: + return $this->getNotes(); + break; + case 4: + return $this->getNotesUrl(); + break; + case 5: + return $this->getActionUrl(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostgroupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + $keys[3] => $this->getNotes(), + $keys[4] => $this->getNotesUrl(), + $keys[5] => $this->getActionUrl(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostgroupPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($value); + break; + case 3: + $this->setNotes($value); + break; + case 4: + $this->setNotesUrl($value); + break; + case 5: + $this->setActionUrl($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostgroupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setNotes($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setNotesUrl($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setActionUrl($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(NagiosHostgroupPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostgroupPeer::ID)) $criteria->add(NagiosHostgroupPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostgroupPeer::NAME)) $criteria->add(NagiosHostgroupPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosHostgroupPeer::ALIAS)) $criteria->add(NagiosHostgroupPeer::ALIAS, $this->alias); + if ($this->isColumnModified(NagiosHostgroupPeer::NOTES)) $criteria->add(NagiosHostgroupPeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosHostgroupPeer::NOTES_URL)) $criteria->add(NagiosHostgroupPeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosHostgroupPeer::ACTION_URL)) $criteria->add(NagiosHostgroupPeer::ACTION_URL, $this->action_url); + + 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(NagiosHostgroupPeer::DATABASE_NAME); + + $criteria->add(NagiosHostgroupPeer::ID, $this->id); + + 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 NagiosHostgroup (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosServices() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosService($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencyTargets() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependencyTarget($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostgroupMemberships() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostgroupMembership($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostgroup 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); + $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 NagiosHostgroupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostgroupPeer(); + } + return self::$peer; + } + + /** + * Clears out the collNagiosServices collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServices() + */ + public function clearNagiosServices() + { + $this->collNagiosServices = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServices collection (array). + * + * By default this just sets the collNagiosServices collection to an empty array (like clearcollNagiosServices()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServices() + { + $this->collNagiosServices = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostgroup has previously been saved, it will retrieve + * related NagiosServices from storage. If this NagiosHostgroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServices($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServices = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceCriteria = $criteria; + return $this->collNagiosServices; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServices(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServices); + } + } else { + $count = count($this->collNagiosServices); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosService(NagiosService $l) + { + if ($this->collNagiosServices === null) { + $this->initNagiosServices(); + } + if (!in_array($l, $this->collNagiosServices, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServices, $l); + $l->setNagiosHostgroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByCheckPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByCheckPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosServices 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 NagiosHostgroup. + */ + public function getNagiosServicesJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServices === null) { + if ($this->isNew()) { + $this->collNagiosServices = array(); + } else { + + $criteria->add(NagiosServicePeer::HOSTGROUP, $this->id); + + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosServiceCriteria) || !$this->lastNagiosServiceCriteria->equals($criteria)) { + $this->collNagiosServices = NagiosServicePeer::doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCriteria = $criteria; + + return $this->collNagiosServices; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostgroup has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosHostgroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosHostgroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostgroup. + */ + public function getNagiosDependencysJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostgroup. + */ + public function getNagiosDependencysJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostgroup. + */ + public function getNagiosDependencysJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostgroup. + */ + public function getNagiosDependencysJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosHostgroup. + */ + public function getNagiosDependencysJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::HOSTGROUP, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosDependencyTargets collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencyTargets() + */ + public function clearNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencyTargets collection (array). + * + * By default this just sets the collNagiosDependencyTargets collection to an empty array (like clearcollNagiosDependencyTargets()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = array(); + } + + /** + * Gets an array of NagiosDependencyTarget objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostgroup has previously been saved, it will retrieve + * related NagiosDependencyTargets from storage. If this NagiosHostgroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependencyTarget[] + * @throws PropelException + */ + public function getNagiosDependencyTargets($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::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. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + return $this->collNagiosDependencyTargets; + } + + /** + * Returns the number of related NagiosDependencyTarget objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependencyTarget objects. + * @throws PropelException + */ + public function countNagiosDependencyTargets(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + $count = NagiosDependencyTargetPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $count = NagiosDependencyTargetPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencyTargets); + } + } else { + $count = count($this->collNagiosDependencyTargets); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependencyTarget object to this object + * through the NagiosDependencyTarget foreign key attribute. + * + * @param NagiosDependencyTarget $l NagiosDependencyTarget + * @return void + * @throws PropelException + */ + public function addNagiosDependencyTarget(NagiosDependencyTarget $l) + { + if ($this->collNagiosDependencyTargets === null) { + $this->initNagiosDependencyTargets(); + } + if (!in_array($l, $this->collNagiosDependencyTargets, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencyTargets, $l); + $l->setNagiosHostgroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHostgroup. + */ + public function getNagiosDependencyTargetsJoinNagiosDependency($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHostgroup. + */ + public function getNagiosDependencyTargetsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosHostgroup. + */ + public function getNagiosDependencyTargetsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostgroup has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosHostgroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosHostgroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostgroup. + */ + public function getNagiosEscalationsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostgroup. + */ + public function getNagiosEscalationsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostgroup. + */ + public function getNagiosEscalationsJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostgroup. + */ + public function getNagiosEscalationsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosHostgroup. + */ + public function getNagiosEscalationsJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::HOSTGROUP, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Clears out the collNagiosHostgroupMemberships collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostgroupMemberships() + */ + public function clearNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostgroupMemberships collection (array). + * + * By default this just sets the collNagiosHostgroupMemberships collection to an empty array (like clearcollNagiosHostgroupMemberships()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostgroupMemberships() + { + $this->collNagiosHostgroupMemberships = array(); + } + + /** + * Gets an array of NagiosHostgroupMembership objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosHostgroup has previously been saved, it will retrieve + * related NagiosHostgroupMemberships from storage. If this NagiosHostgroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostgroupMembership[] + * @throws PropelException + */ + public function getNagiosHostgroupMemberships($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::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. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + return $this->collNagiosHostgroupMemberships; + } + + /** + * Returns the number of related NagiosHostgroupMembership objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostgroupMembership objects. + * @throws PropelException + */ + public function countNagiosHostgroupMemberships(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + $count = NagiosHostgroupMembershipPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $count = NagiosHostgroupMembershipPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } else { + $count = count($this->collNagiosHostgroupMemberships); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostgroupMembership object to this object + * through the NagiosHostgroupMembership foreign key attribute. + * + * @param NagiosHostgroupMembership $l NagiosHostgroupMembership + * @return void + * @throws PropelException + */ + public function addNagiosHostgroupMembership(NagiosHostgroupMembership $l) + { + if ($this->collNagiosHostgroupMemberships === null) { + $this->initNagiosHostgroupMemberships(); + } + if (!in_array($l, $this->collNagiosHostgroupMemberships, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostgroupMemberships, $l); + $l->setNagiosHostgroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHostgroup. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosHostgroup is new, it will return + * an empty collection; or if this NagiosHostgroup has previously + * been saved, it will retrieve related NagiosHostgroupMemberships 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 NagiosHostgroup. + */ + public function getNagiosHostgroupMembershipsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostgroupMemberships === null) { + if ($this->isNew()) { + $this->collNagiosHostgroupMemberships = array(); + } else { + + $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->id); + + if (!isset($this->lastNagiosHostgroupMembershipCriteria) || !$this->lastNagiosHostgroupMembershipCriteria->equals($criteria)) { + $this->collNagiosHostgroupMemberships = NagiosHostgroupMembershipPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostgroupMembershipCriteria = $criteria; + + return $this->collNagiosHostgroupMemberships; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosServices) { + foreach ((array) $this->collNagiosServices as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencyTargets) { + foreach ((array) $this->collNagiosDependencyTargets as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostgroupMemberships) { + foreach ((array) $this->collNagiosHostgroupMemberships as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosServices = null; + $this->collNagiosDependencys = null; + $this->collNagiosDependencyTargets = null; + $this->collNagiosEscalations = null; + $this->collNagiosHostgroupMemberships = null; + } + +} // BaseNagiosHostgroup diff --git a/classes/om/BaseNagiosHostgroupMembership.php b/classes/om/BaseNagiosHostgroupMembership.php new file mode 100755 index 0000000..62c2a1c --- /dev/null +++ b/classes/om/BaseNagiosHostgroupMembership.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [hostgroup] column value. + * + * @return int + */ + public function getHostgroup() + { + return $this->hostgroup; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosHostgroupMembership The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosHostgroupMembershipPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosHostgroupMembership The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosHostgroupMembershipPeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosHostgroupMembership The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosHostgroupMembershipPeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [hostgroup] column. + * + * @param int $v new value + * @return NagiosHostgroupMembership The current object (for fluent API support) + */ + public function setHostgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->hostgroup !== $v) { + $this->hostgroup = $v; + $this->modifiedColumns[] = NagiosHostgroupMembershipPeer::HOSTGROUP; + } + + if ($this->aNagiosHostgroup !== null && $this->aNagiosHostgroup->getId() !== $v) { + $this->aNagiosHostgroup = null; + } + + return $this; + } // setHostgroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->host = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->host_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->hostgroup = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosHostgroupMembership object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHostgroup !== null && $this->hostgroup !== $this->aNagiosHostgroup->getId()) { + $this->aNagiosHostgroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosHostgroupMembershipPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHostgroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosHostgroupMembershipPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosHostgroupMembershipPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosHostgroup !== null) { + if ($this->aNagiosHostgroup->isModified() || $this->aNagiosHostgroup->isNew()) { + $affectedRows += $this->aNagiosHostgroup->save($con); + } + $this->setNagiosHostgroup($this->aNagiosHostgroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosHostgroupMembershipPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosHostgroupMembershipPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosHostgroupMembershipPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHostgroup !== null) { + if (!$this->aNagiosHostgroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostgroup->getValidationFailures()); + } + } + + + if (($retval = NagiosHostgroupMembershipPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostgroupMembershipPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getHost(); + break; + case 2: + return $this->getHostTemplate(); + break; + case 3: + return $this->getHostgroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosHostgroupMembershipPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getHost(), + $keys[2] => $this->getHostTemplate(), + $keys[3] => $this->getHostgroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosHostgroupMembershipPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setHost($value); + break; + case 2: + $this->setHostTemplate($value); + break; + case 3: + $this->setHostgroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosHostgroupMembershipPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setHost($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setHostTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setHostgroup($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(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosHostgroupMembershipPeer::ID)) $criteria->add(NagiosHostgroupMembershipPeer::ID, $this->id); + if ($this->isColumnModified(NagiosHostgroupMembershipPeer::HOST)) $criteria->add(NagiosHostgroupMembershipPeer::HOST, $this->host); + if ($this->isColumnModified(NagiosHostgroupMembershipPeer::HOST_TEMPLATE)) $criteria->add(NagiosHostgroupMembershipPeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosHostgroupMembershipPeer::HOSTGROUP)) $criteria->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $this->hostgroup); + + 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(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + $criteria->add(NagiosHostgroupMembershipPeer::ID, $this->id); + + 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 NagiosHostgroupMembership (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) + { + + $copyObj->setHost($this->host); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setHostgroup($this->hostgroup); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosHostgroupMembership 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); + $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 NagiosHostgroupMembershipPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosHostgroupMembershipPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosHostgroupMembership The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostgroupMembership($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosHostgroupMemberships($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosHostgroupMembership The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostgroupMembership($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosHostgroupMemberships($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosHostgroup object. + * + * @param NagiosHostgroup $v + * @return NagiosHostgroupMembership The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostgroup(NagiosHostgroup $v = null) + { + if ($v === null) { + $this->setHostgroup(NULL); + } else { + $this->setHostgroup($v->getId()); + } + + $this->aNagiosHostgroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostgroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosHostgroupMembership($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostgroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostgroup The associated NagiosHostgroup object. + * @throws PropelException + */ + public function getNagiosHostgroup(PropelPDO $con = null) + { + if ($this->aNagiosHostgroup === null && ($this->hostgroup !== null)) { + $c = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $c->add(NagiosHostgroupPeer::ID, $this->hostgroup); + $this->aNagiosHostgroup = NagiosHostgroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostgroup->addNagiosHostgroupMemberships($this); + */ + } + return $this->aNagiosHostgroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHostgroup = null; + } + +} // BaseNagiosHostgroupMembership diff --git a/classes/om/BaseNagiosHostgroupMembershipPeer.php b/classes/om/BaseNagiosHostgroupMembershipPeer.php new file mode 100755 index 0000000..16ef487 --- /dev/null +++ b/classes/om/BaseNagiosHostgroupMembershipPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Host', 'HostTemplate', 'Hostgroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'host', 'hostTemplate', 'hostgroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::HOST, self::HOST_TEMPLATE, self::HOSTGROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'host', 'host_template', 'hostgroup', ), + 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, 'Host' => 1, 'HostTemplate' => 2, 'Hostgroup' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'host' => 1, 'hostTemplate' => 2, 'hostgroup' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HOST => 1, self::HOST_TEMPLATE => 2, self::HOSTGROUP => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'host' => 1, 'host_template' => 2, 'hostgroup' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostgroupMembershipMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostgroupMembershipPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostgroupMembershipPeer::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) + { + + $criteria->addSelectColumn(NagiosHostgroupMembershipPeer::ID); + + $criteria->addSelectColumn(NagiosHostgroupMembershipPeer::HOST); + + $criteria->addSelectColumn(NagiosHostgroupMembershipPeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosHostgroupMembershipPeer::HOSTGROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostgroupMembership + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostgroupMembershipPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostgroupMembershipPeer::populateObjects(NagiosHostgroupMembershipPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostgroupMembership $value A NagiosHostgroupMembership object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostgroupMembership $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostgroupMembership object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostgroupMembership) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostgroupMembership object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostgroupMembership Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostgroupMembershipPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostgroupMembershipPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostgroupMembershipPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to $obj2 (NagiosHost) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with their NagiosHostgroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostgroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostgroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostgroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to $obj2 (NagiosHostgroup) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol2 = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostgroupMembership($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostgroupMembership($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosHostgroupMembership($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupMembershipPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol2 = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key3 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostgroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostgroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj3 (NagiosHostgroup) + $obj3->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol2 = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key3 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostgroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostgroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj3 (NagiosHostgroup) + $obj3->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosHostgroupMembership objects pre-filled with all related objects except NagiosHostgroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosHostgroupMembership objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosHostgroupMembershipPeer::addSelectColumns($c); + $startcol2 = (NagiosHostgroupMembershipPeer::NUM_COLUMNS - NagiosHostgroupMembershipPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosHostgroupMembershipPeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosHostgroupMembershipPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosHostgroupMembershipPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosHostgroupMembershipPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosHostgroupMembershipPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosHostgroupMembership) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosHostgroupMembership($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosHostgroupMembershipPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostgroupMembership or Criteria object. + * + * @param mixed $values Criteria or NagiosHostgroupMembership object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostgroupMembership object + } + + if ($criteria->containsKey(NagiosHostgroupMembershipPeer::ID) && $criteria->keyContainsValue(NagiosHostgroupMembershipPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostgroupMembershipPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostgroupMembership or Criteria object. + * + * @param mixed $values Criteria or NagiosHostgroupMembership object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostgroupMembershipPeer::ID); + $selectCriteria->add(NagiosHostgroupMembershipPeer::ID, $criteria->remove(NagiosHostgroupMembershipPeer::ID), $comparison); + + } else { // $values is NagiosHostgroupMembership object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_hostgroup_membership 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(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosHostgroupMembershipPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostgroupMembership or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostgroupMembership object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostgroupMembershipPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostgroupMembership) { + // invalidate the cache for this single object + NagiosHostgroupMembershipPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostgroupMembershipPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostgroupMembershipPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosHostgroupMembership 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 NagiosHostgroupMembership $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(NagiosHostgroupMembership $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostgroupMembershipPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostgroupMembershipPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostgroupMembershipPeer::DATABASE_NAME, NagiosHostgroupMembershipPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostgroupMembership + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostgroupMembershipPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostgroupMembershipPeer::DATABASE_NAME); + $criteria->add(NagiosHostgroupMembershipPeer::ID, $pk); + + $v = NagiosHostgroupMembershipPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostgroupMembershipPeer::DATABASE_NAME); + $criteria->add(NagiosHostgroupMembershipPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostgroupMembershipPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostgroupMembershipPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostgroupMembershipPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostgroupMembershipPeer class: +// +// Propel::getDatabaseMap(NagiosHostgroupMembershipPeer::DATABASE_NAME)->addTableBuilder(NagiosHostgroupMembershipPeer::TABLE_NAME, NagiosHostgroupMembershipPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostgroupMembershipPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostgroupMembershipPeer::TABLE_NAME, BaseNagiosHostgroupMembershipPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosHostgroupPeer.php b/classes/om/BaseNagiosHostgroupPeer.php new file mode 100755 index 0000000..1c4ba37 --- /dev/null +++ b/classes/om/BaseNagiosHostgroupPeer.php @@ -0,0 +1,789 @@ + array ('Id', 'Name', 'Alias', 'Notes', 'NotesUrl', 'ActionUrl', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', 'notes', 'notesUrl', 'actionUrl', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, self::NOTES, self::NOTES_URL, self::ACTION_URL, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', 'notes', 'notes_url', 'action_url', ), + 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, 'Name' => 1, 'Alias' => 2, 'Notes' => 3, 'NotesUrl' => 4, 'ActionUrl' => 5, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'notes' => 3, 'notesUrl' => 4, 'actionUrl' => 5, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, self::NOTES => 3, self::NOTES_URL => 4, self::ACTION_URL => 5, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'notes' => 3, 'notes_url' => 4, 'action_url' => 5, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosHostgroupMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosHostgroupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosHostgroupPeer::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) + { + + $criteria->addSelectColumn(NagiosHostgroupPeer::ID); + + $criteria->addSelectColumn(NagiosHostgroupPeer::NAME); + + $criteria->addSelectColumn(NagiosHostgroupPeer::ALIAS); + + $criteria->addSelectColumn(NagiosHostgroupPeer::NOTES); + + $criteria->addSelectColumn(NagiosHostgroupPeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosHostgroupPeer::ACTION_URL); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosHostgroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosHostgroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosHostgroup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosHostgroupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosHostgroupPeer::populateObjects(NagiosHostgroupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosHostgroupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosHostgroup $value A NagiosHostgroup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosHostgroup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosHostgroup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosHostgroup) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosHostgroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosHostgroup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosHostgroupPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosHostgroupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosHostgroupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosHostgroupPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosHostgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosHostgroup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosHostgroup object + } + + if ($criteria->containsKey(NagiosHostgroupPeer::ID) && $criteria->keyContainsValue(NagiosHostgroupPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosHostgroupPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosHostgroup or Criteria object. + * + * @param mixed $values Criteria or NagiosHostgroup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosHostgroupPeer::ID); + $selectCriteria->add(NagiosHostgroupPeer::ID, $criteria->remove(NagiosHostgroupPeer::ID), $comparison); + + } else { // $values is NagiosHostgroup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_hostgroup 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(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosHostgroupPeer::doOnDeleteCascade(new Criteria(NagiosHostgroupPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosHostgroupPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosHostgroup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosHostgroup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosHostgroupPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosHostgroup) { + // invalidate the cache for this single object + NagiosHostgroupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosHostgroupPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosHostgroupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosHostgroupPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosHostgroupPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosHostgroupPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyTargetPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyTargetPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + // invalidate objects in NagiosHostgroupMembershipPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostgroupMembershipPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosHostgroupPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosService objects + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + + $c->add(NagiosServicePeer::HOSTGROUP, $obj->getId()); + $affectedRows += NagiosServicePeer::doDelete($c, $con); + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::HOSTGROUP, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + + // delete related NagiosDependencyTarget objects + $c = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + + $c->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $obj->getId()); + $affectedRows += NagiosDependencyTargetPeer::doDelete($c, $con); + + // delete related NagiosEscalation objects + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + + $c->add(NagiosEscalationPeer::HOSTGROUP, $obj->getId()); + $affectedRows += NagiosEscalationPeer::doDelete($c, $con); + + // delete related NagiosHostgroupMembership objects + $c = new Criteria(NagiosHostgroupMembershipPeer::DATABASE_NAME); + + $c->add(NagiosHostgroupMembershipPeer::HOSTGROUP, $obj->getId()); + $affectedRows += NagiosHostgroupMembershipPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosHostgroup 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 NagiosHostgroup $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(NagiosHostgroup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosHostgroupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosHostgroupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosHostgroupPeer::DATABASE_NAME, NagiosHostgroupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosHostgroup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosHostgroupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $criteria->add(NagiosHostgroupPeer::ID, $pk); + + $v = NagiosHostgroupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosHostgroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $criteria->add(NagiosHostgroupPeer::ID, $pks, Criteria::IN); + $objs = NagiosHostgroupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosHostgroupPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosHostgroupPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosHostgroupPeer class: +// +// Propel::getDatabaseMap(NagiosHostgroupPeer::DATABASE_NAME)->addTableBuilder(NagiosHostgroupPeer::TABLE_NAME, NagiosHostgroupPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosHostgroupPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosHostgroupPeer::TABLE_NAME, BaseNagiosHostgroupPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosMainConfiguration.php b/classes/om/BaseNagiosMainConfiguration.php new file mode 100755 index 0000000..a1a4a0b --- /dev/null +++ b/classes/om/BaseNagiosMainConfiguration.php @@ -0,0 +1,7257 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [config_dir] column value. + * + * @return string + */ + public function getConfigDir() + { + return $this->config_dir; + } + + /** + * Get the [log_file] column value. + * + * @return string + */ + public function getLogFile() + { + return $this->log_file; + } + + /** + * Get the [temp_file] column value. + * + * @return string + */ + public function getTempFile() + { + return $this->temp_file; + } + + /** + * Get the [status_file] column value. + * + * @return string + */ + public function getStatusFile() + { + return $this->status_file; + } + + /** + * Get the [status_update_interval] column value. + * + * @return int + */ + public function getStatusUpdateInterval() + { + return $this->status_update_interval; + } + + /** + * Get the [nagios_user] column value. + * + * @return string + */ + public function getNagiosUser() + { + return $this->nagios_user; + } + + /** + * Get the [nagios_group] column value. + * + * @return string + */ + public function getNagiosGroup() + { + return $this->nagios_group; + } + + /** + * Get the [enable_notifications] column value. + * + * @return boolean + */ + public function getEnableNotifications() + { + return $this->enable_notifications; + } + + /** + * Get the [execute_service_checks] column value. + * + * @return boolean + */ + public function getExecuteServiceChecks() + { + return $this->execute_service_checks; + } + + /** + * Get the [accept_passive_service_checks] column value. + * + * @return boolean + */ + public function getAcceptPassiveServiceChecks() + { + return $this->accept_passive_service_checks; + } + + /** + * Get the [enable_event_handlers] column value. + * + * @return boolean + */ + public function getEnableEventHandlers() + { + return $this->enable_event_handlers; + } + + /** + * Get the [log_rotation_method] column value. + * + * @return string + */ + public function getLogRotationMethod() + { + return $this->log_rotation_method; + } + + /** + * Get the [log_archive_path] column value. + * + * @return string + */ + public function getLogArchivePath() + { + return $this->log_archive_path; + } + + /** + * Get the [check_external_commands] column value. + * + * @return boolean + */ + public function getCheckExternalCommands() + { + return $this->check_external_commands; + } + + /** + * Get the [command_check_interval] column value. + * + * @return string + */ + public function getCommandCheckInterval() + { + return $this->command_check_interval; + } + + /** + * Get the [command_file] column value. + * + * @return string + */ + public function getCommandFile() + { + return $this->command_file; + } + + /** + * Get the [lock_file] column value. + * + * @return string + */ + public function getLockFile() + { + return $this->lock_file; + } + + /** + * Get the [retain_state_information] column value. + * + * @return boolean + */ + public function getRetainStateInformation() + { + return $this->retain_state_information; + } + + /** + * Get the [state_retention_file] column value. + * + * @return string + */ + public function getStateRetentionFile() + { + return $this->state_retention_file; + } + + /** + * Get the [retention_update_interval] column value. + * + * @return int + */ + public function getRetentionUpdateInterval() + { + return $this->retention_update_interval; + } + + /** + * Get the [use_retained_program_state] column value. + * + * @return boolean + */ + public function getUseRetainedProgramState() + { + return $this->use_retained_program_state; + } + + /** + * Get the [use_syslog] column value. + * + * @return boolean + */ + public function getUseSyslog() + { + return $this->use_syslog; + } + + /** + * Get the [log_notifications] column value. + * + * @return boolean + */ + public function getLogNotifications() + { + return $this->log_notifications; + } + + /** + * Get the [log_service_retries] column value. + * + * @return boolean + */ + public function getLogServiceRetries() + { + return $this->log_service_retries; + } + + /** + * Get the [log_host_retries] column value. + * + * @return boolean + */ + public function getLogHostRetries() + { + return $this->log_host_retries; + } + + /** + * Get the [log_event_handlers] column value. + * + * @return boolean + */ + public function getLogEventHandlers() + { + return $this->log_event_handlers; + } + + /** + * Get the [log_initial_states] column value. + * + * @return boolean + */ + public function getLogInitialStates() + { + return $this->log_initial_states; + } + + /** + * Get the [log_external_commands] column value. + * + * @return boolean + */ + public function getLogExternalCommands() + { + return $this->log_external_commands; + } + + /** + * Get the [log_passive_checks] column value. + * + * @return boolean + */ + public function getLogPassiveChecks() + { + return $this->log_passive_checks; + } + + /** + * Get the [global_host_event_handler] column value. + * + * @return int + */ + public function getGlobalHostEventHandler() + { + return $this->global_host_event_handler; + } + + /** + * Get the [global_service_event_handler] column value. + * + * @return int + */ + public function getGlobalServiceEventHandler() + { + return $this->global_service_event_handler; + } + + /** + * Get the [external_command_buffer_slots] column value. + * + * @return int + */ + public function getExternalCommandBufferSlots() + { + return $this->external_command_buffer_slots; + } + + /** + * Get the [sleep_time] column value. + * + * @return double + */ + public function getSleepTime() + { + return $this->sleep_time; + } + + /** + * Get the [service_interleave_factor] column value. + * + * @return string + */ + public function getServiceInterleaveFactor() + { + return $this->service_interleave_factor; + } + + /** + * Get the [max_concurrent_checks] column value. + * + * @return int + */ + public function getMaxConcurrentChecks() + { + return $this->max_concurrent_checks; + } + + /** + * Get the [service_reaper_frequency] column value. + * + * @return int + */ + public function getServiceReaperFrequency() + { + return $this->service_reaper_frequency; + } + + /** + * Get the [interval_length] column value. + * + * @return int + */ + public function getIntervalLength() + { + return $this->interval_length; + } + + /** + * Get the [use_aggressive_host_checking] column value. + * + * @return boolean + */ + public function getUseAggressiveHostChecking() + { + return $this->use_aggressive_host_checking; + } + + /** + * Get the [enable_flap_detection] column value. + * + * @return boolean + */ + public function getEnableFlapDetection() + { + return $this->enable_flap_detection; + } + + /** + * Get the [low_service_flap_threshold] column value. + * + * @return double + */ + public function getLowServiceFlapThreshold() + { + return $this->low_service_flap_threshold; + } + + /** + * Get the [high_service_flap_threshold] column value. + * + * @return double + */ + public function getHighServiceFlapThreshold() + { + return $this->high_service_flap_threshold; + } + + /** + * Get the [low_host_flap_threshold] column value. + * + * @return double + */ + public function getLowHostFlapThreshold() + { + return $this->low_host_flap_threshold; + } + + /** + * Get the [high_host_flap_threshold] column value. + * + * @return double + */ + public function getHighHostFlapThreshold() + { + return $this->high_host_flap_threshold; + } + + /** + * Get the [soft_state_dependencies] column value. + * + * @return boolean + */ + public function getSoftStateDependencies() + { + return $this->soft_state_dependencies; + } + + /** + * Get the [service_check_timeout] column value. + * + * @return int + */ + public function getServiceCheckTimeout() + { + return $this->service_check_timeout; + } + + /** + * Get the [host_check_timeout] column value. + * + * @return int + */ + public function getHostCheckTimeout() + { + return $this->host_check_timeout; + } + + /** + * Get the [event_handler_timeout] column value. + * + * @return int + */ + public function getEventHandlerTimeout() + { + return $this->event_handler_timeout; + } + + /** + * Get the [notification_timeout] column value. + * + * @return int + */ + public function getNotificationTimeout() + { + return $this->notification_timeout; + } + + /** + * Get the [ocsp_timeout] column value. + * + * @return int + */ + public function getOcspTimeout() + { + return $this->ocsp_timeout; + } + + /** + * Get the [ohcp_timeout] column value. + * + * @return int + */ + public function getOhcpTimeout() + { + return $this->ohcp_timeout; + } + + /** + * Get the [perfdata_timeout] column value. + * + * @return int + */ + public function getPerfdataTimeout() + { + return $this->perfdata_timeout; + } + + /** + * Get the [obsess_over_services] column value. + * + * @return boolean + */ + public function getObsessOverServices() + { + return $this->obsess_over_services; + } + + /** + * Get the [ocsp_command] column value. + * + * @return int + */ + public function getOcspCommand() + { + return $this->ocsp_command; + } + + /** + * Get the [process_performance_data] column value. + * + * @return boolean + */ + public function getProcessPerformanceData() + { + return $this->process_performance_data; + } + + /** + * Get the [check_for_orphaned_services] column value. + * + * @return boolean + */ + public function getCheckForOrphanedServices() + { + return $this->check_for_orphaned_services; + } + + /** + * Get the [check_service_freshness] column value. + * + * @return boolean + */ + public function getCheckServiceFreshness() + { + return $this->check_service_freshness; + } + + /** + * Get the [freshness_check_interval] column value. + * + * @return int + */ + public function getFreshnessCheckInterval() + { + return $this->freshness_check_interval; + } + + /** + * Get the [date_format] column value. + * + * @return string + */ + public function getDateFormat() + { + return $this->date_format; + } + + /** + * Get the [illegal_object_name_chars] column value. + * + * @return string + */ + public function getIllegalObjectNameChars() + { + return $this->illegal_object_name_chars; + } + + /** + * Get the [illegal_macro_output_chars] column value. + * + * @return string + */ + public function getIllegalMacroOutputChars() + { + return $this->illegal_macro_output_chars; + } + + /** + * Get the [admin_email] column value. + * + * @return string + */ + public function getAdminEmail() + { + return $this->admin_email; + } + + /** + * Get the [admin_pager] column value. + * + * @return string + */ + public function getAdminPager() + { + return $this->admin_pager; + } + + /** + * Get the [execute_host_checks] column value. + * + * @return boolean + */ + public function getExecuteHostChecks() + { + return $this->execute_host_checks; + } + + /** + * Get the [service_inter_check_delay_method] column value. + * + * @return string + */ + public function getServiceInterCheckDelayMethod() + { + return $this->service_inter_check_delay_method; + } + + /** + * Get the [use_retained_scheduling_info] column value. + * + * @return boolean + */ + public function getUseRetainedSchedulingInfo() + { + return $this->use_retained_scheduling_info; + } + + /** + * Get the [accept_passive_host_checks] column value. + * + * @return boolean + */ + public function getAcceptPassiveHostChecks() + { + return $this->accept_passive_host_checks; + } + + /** + * Get the [max_service_check_spread] column value. + * + * @return int + */ + public function getMaxServiceCheckSpread() + { + return $this->max_service_check_spread; + } + + /** + * Get the [host_inter_check_delay_method] column value. + * + * @return string + */ + public function getHostInterCheckDelayMethod() + { + return $this->host_inter_check_delay_method; + } + + /** + * Get the [max_host_check_spread] column value. + * + * @return int + */ + public function getMaxHostCheckSpread() + { + return $this->max_host_check_spread; + } + + /** + * Get the [auto_reschedule_checks] column value. + * + * @return boolean + */ + public function getAutoRescheduleChecks() + { + return $this->auto_reschedule_checks; + } + + /** + * Get the [auto_rescheduling_interval] column value. + * + * @return int + */ + public function getAutoReschedulingInterval() + { + return $this->auto_rescheduling_interval; + } + + /** + * Get the [auto_rescheduling_window] column value. + * + * @return int + */ + public function getAutoReschedulingWindow() + { + return $this->auto_rescheduling_window; + } + + /** + * Get the [ochp_timeout] column value. + * + * @return int + */ + public function getOchpTimeout() + { + return $this->ochp_timeout; + } + + /** + * Get the [obsess_over_hosts] column value. + * + * @return boolean + */ + public function getObsessOverHosts() + { + return $this->obsess_over_hosts; + } + + /** + * Get the [ochp_command] column value. + * + * @return int + */ + public function getOchpCommand() + { + return $this->ochp_command; + } + + /** + * Get the [check_host_freshness] column value. + * + * @return boolean + */ + public function getCheckHostFreshness() + { + return $this->check_host_freshness; + } + + /** + * Get the [host_freshness_check_interval] column value. + * + * @return int + */ + public function getHostFreshnessCheckInterval() + { + return $this->host_freshness_check_interval; + } + + /** + * Get the [service_freshness_check_interval] column value. + * + * @return int + */ + public function getServiceFreshnessCheckInterval() + { + return $this->service_freshness_check_interval; + } + + /** + * Get the [use_regexp_matching] column value. + * + * @return boolean + */ + public function getUseRegexpMatching() + { + return $this->use_regexp_matching; + } + + /** + * Get the [use_true_regexp_matching] column value. + * + * @return boolean + */ + public function getUseTrueRegexpMatching() + { + return $this->use_true_regexp_matching; + } + + /** + * Get the [event_broker_options] column value. + * + * @return string + */ + public function getEventBrokerOptions() + { + return $this->event_broker_options; + } + + /** + * Get the [daemon_dumps_core] column value. + * + * @return boolean + */ + public function getDaemonDumpsCore() + { + return $this->daemon_dumps_core; + } + + /** + * Get the [host_perfdata_command] column value. + * + * @return int + */ + public function getHostPerfdataCommand() + { + return $this->host_perfdata_command; + } + + /** + * Get the [service_perfdata_command] column value. + * + * @return int + */ + public function getServicePerfdataCommand() + { + return $this->service_perfdata_command; + } + + /** + * Get the [host_perfdata_file] column value. + * + * @return string + */ + public function getHostPerfdataFile() + { + return $this->host_perfdata_file; + } + + /** + * Get the [host_perfdata_file_template] column value. + * + * @return string + */ + public function getHostPerfdataFileTemplate() + { + return $this->host_perfdata_file_template; + } + + /** + * Get the [service_perfdata_file] column value. + * + * @return string + */ + public function getServicePerfdataFile() + { + return $this->service_perfdata_file; + } + + /** + * Get the [service_perfdata_file_template] column value. + * + * @return string + */ + public function getServicePerfdataFileTemplate() + { + return $this->service_perfdata_file_template; + } + + /** + * Get the [host_perfdata_file_mode] column value. + * + * @return string + */ + public function getHostPerfdataFileMode() + { + return $this->host_perfdata_file_mode; + } + + /** + * Get the [service_perfdata_file_mode] column value. + * + * @return string + */ + public function getServicePerfdataFileMode() + { + return $this->service_perfdata_file_mode; + } + + /** + * Get the [host_perfdata_file_processing_command] column value. + * + * @return int + */ + public function getHostPerfdataFileProcessingCommand() + { + return $this->host_perfdata_file_processing_command; + } + + /** + * Get the [service_perfdata_file_processing_command] column value. + * + * @return int + */ + public function getServicePerfdataFileProcessingCommand() + { + return $this->service_perfdata_file_processing_command; + } + + /** + * Get the [host_perfdata_file_processing_interval] column value. + * + * @return int + */ + public function getHostPerfdataFileProcessingInterval() + { + return $this->host_perfdata_file_processing_interval; + } + + /** + * Get the [service_perfdata_file_processing_interval] column value. + * + * @return int + */ + public function getServicePerfdataFileProcessingInterval() + { + return $this->service_perfdata_file_processing_interval; + } + + /** + * Get the [object_cache_file] column value. + * + * @return string + */ + public function getObjectCacheFile() + { + return $this->object_cache_file; + } + + /** + * Get the [precached_object_file] column value. + * + * @return string + */ + public function getPrecachedObjectFile() + { + return $this->precached_object_file; + } + + /** + * Get the [retained_host_attribute_mask] column value. + * + * @return int + */ + public function getRetainedHostAttributeMask() + { + return $this->retained_host_attribute_mask; + } + + /** + * Get the [retained_service_attribute_mask] column value. + * + * @return int + */ + public function getRetainedServiceAttributeMask() + { + return $this->retained_service_attribute_mask; + } + + /** + * Get the [retained_process_host_attribute_mask] column value. + * + * @return int + */ + public function getRetainedProcessHostAttributeMask() + { + return $this->retained_process_host_attribute_mask; + } + + /** + * Get the [retained_process_service_attribute_mask] column value. + * + * @return int + */ + public function getRetainedProcessServiceAttributeMask() + { + return $this->retained_process_service_attribute_mask; + } + + /** + * Get the [retained_contact_host_attribute_mask] column value. + * + * @return int + */ + public function getRetainedContactHostAttributeMask() + { + return $this->retained_contact_host_attribute_mask; + } + + /** + * Get the [retained_contact_service_attribute_mask] column value. + * + * @return int + */ + public function getRetainedContactServiceAttributeMask() + { + return $this->retained_contact_service_attribute_mask; + } + + /** + * Get the [check_result_reaper_frequency] column value. + * + * @return int + */ + public function getCheckResultReaperFrequency() + { + return $this->check_result_reaper_frequency; + } + + /** + * Get the [max_check_result_reaper_time] column value. + * + * @return int + */ + public function getMaxCheckResultReaperTime() + { + return $this->max_check_result_reaper_time; + } + + /** + * Get the [check_result_path] column value. + * + * @return string + */ + public function getCheckResultPath() + { + return $this->check_result_path; + } + + /** + * Get the [max_check_result_file_age] column value. + * + * @return int + */ + public function getMaxCheckResultFileAge() + { + return $this->max_check_result_file_age; + } + + /** + * Get the [translate_passive_host_checks] column value. + * + * @return boolean + */ + public function getTranslatePassiveHostChecks() + { + return $this->translate_passive_host_checks; + } + + /** + * Get the [passive_host_checks_are_soft] column value. + * + * @return boolean + */ + public function getPassiveHostChecksAreSoft() + { + return $this->passive_host_checks_are_soft; + } + + /** + * Get the [enable_predictive_host_dependency_checks] column value. + * + * @return boolean + */ + public function getEnablePredictiveHostDependencyChecks() + { + return $this->enable_predictive_host_dependency_checks; + } + + /** + * Get the [enable_predictive_service_dependency_checks] column value. + * + * @return boolean + */ + public function getEnablePredictiveServiceDependencyChecks() + { + return $this->enable_predictive_service_dependency_checks; + } + + /** + * Get the [cached_host_check_horizon] column value. + * + * @return int + */ + public function getCachedHostCheckHorizon() + { + return $this->cached_host_check_horizon; + } + + /** + * Get the [cached_service_check_horizon] column value. + * + * @return int + */ + public function getCachedServiceCheckHorizon() + { + return $this->cached_service_check_horizon; + } + + /** + * Get the [use_large_installation_tweaks] column value. + * + * @return boolean + */ + public function getUseLargeInstallationTweaks() + { + return $this->use_large_installation_tweaks; + } + + /** + * Get the [free_child_process_memory] column value. + * + * @return boolean + */ + public function getFreeChildProcessMemory() + { + return $this->free_child_process_memory; + } + + /** + * Get the [child_processes_fork_twice] column value. + * + * @return boolean + */ + public function getChildProcessesForkTwice() + { + return $this->child_processes_fork_twice; + } + + /** + * Get the [enable_environment_macros] column value. + * + * @return boolean + */ + public function getEnableEnvironmentMacros() + { + return $this->enable_environment_macros; + } + + /** + * Get the [additional_freshness_latency] column value. + * + * @return int + */ + public function getAdditionalFreshnessLatency() + { + return $this->additional_freshness_latency; + } + + /** + * Get the [enable_embedded_perl] column value. + * + * @return boolean + */ + public function getEnableEmbeddedPerl() + { + return $this->enable_embedded_perl; + } + + /** + * Get the [use_embedded_perl_implicitly] column value. + * + * @return boolean + */ + public function getUseEmbeddedPerlImplicitly() + { + return $this->use_embedded_perl_implicitly; + } + + /** + * Get the [p1_file] column value. + * + * @return string + */ + public function getP1File() + { + return $this->p1_file; + } + + /** + * Get the [use_timezone] column value. + * + * @return string + */ + public function getUseTimezone() + { + return $this->use_timezone; + } + + /** + * Get the [debug_file] column value. + * + * @return string + */ + public function getDebugFile() + { + return $this->debug_file; + } + + /** + * Get the [debug_level] column value. + * + * @return int + */ + public function getDebugLevel() + { + return $this->debug_level; + } + + /** + * Get the [debug_verbosity] column value. + * + * @return int + */ + public function getDebugVerbosity() + { + return $this->debug_verbosity; + } + + /** + * Get the [max_debug_file_size] column value. + * + * @return int + */ + public function getMaxDebugFileSize() + { + return $this->max_debug_file_size; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [config_dir] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setConfigDir($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->config_dir !== $v) { + $this->config_dir = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CONFIG_DIR; + } + + return $this; + } // setConfigDir() + + /** + * Set the value of [log_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->log_file !== $v) { + $this->log_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_FILE; + } + + return $this; + } // setLogFile() + + /** + * Set the value of [temp_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setTempFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->temp_file !== $v) { + $this->temp_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::TEMP_FILE; + } + + return $this; + } // setTempFile() + + /** + * Set the value of [status_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setStatusFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->status_file !== $v) { + $this->status_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::STATUS_FILE; + } + + return $this; + } // setStatusFile() + + /** + * Set the value of [status_update_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setStatusUpdateInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->status_update_interval !== $v) { + $this->status_update_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::STATUS_UPDATE_INTERVAL; + } + + return $this; + } // setStatusUpdateInterval() + + /** + * Set the value of [nagios_user] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setNagiosUser($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->nagios_user !== $v) { + $this->nagios_user = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::NAGIOS_USER; + } + + return $this; + } // setNagiosUser() + + /** + * Set the value of [nagios_group] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setNagiosGroup($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->nagios_group !== $v) { + $this->nagios_group = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::NAGIOS_GROUP; + } + + return $this; + } // setNagiosGroup() + + /** + * Set the value of [enable_notifications] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnableNotifications($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_notifications !== $v) { + $this->enable_notifications = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_NOTIFICATIONS; + } + + return $this; + } // setEnableNotifications() + + /** + * Set the value of [execute_service_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setExecuteServiceChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execute_service_checks !== $v) { + $this->execute_service_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::EXECUTE_SERVICE_CHECKS; + } + + return $this; + } // setExecuteServiceChecks() + + /** + * Set the value of [accept_passive_service_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAcceptPassiveServiceChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->accept_passive_service_checks !== $v) { + $this->accept_passive_service_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ACCEPT_PASSIVE_SERVICE_CHECKS; + } + + return $this; + } // setAcceptPassiveServiceChecks() + + /** + * Set the value of [enable_event_handlers] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnableEventHandlers($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_event_handlers !== $v) { + $this->enable_event_handlers = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_EVENT_HANDLERS; + } + + return $this; + } // setEnableEventHandlers() + + /** + * Set the value of [log_rotation_method] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogRotationMethod($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->log_rotation_method !== $v) { + $this->log_rotation_method = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_ROTATION_METHOD; + } + + return $this; + } // setLogRotationMethod() + + /** + * Set the value of [log_archive_path] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogArchivePath($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->log_archive_path !== $v) { + $this->log_archive_path = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_ARCHIVE_PATH; + } + + return $this; + } // setLogArchivePath() + + /** + * Set the value of [check_external_commands] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckExternalCommands($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_external_commands !== $v) { + $this->check_external_commands = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_EXTERNAL_COMMANDS; + } + + return $this; + } // setCheckExternalCommands() + + /** + * Set the value of [command_check_interval] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCommandCheckInterval($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->command_check_interval !== $v) { + $this->command_check_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::COMMAND_CHECK_INTERVAL; + } + + return $this; + } // setCommandCheckInterval() + + /** + * Set the value of [command_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCommandFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->command_file !== $v) { + $this->command_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::COMMAND_FILE; + } + + return $this; + } // setCommandFile() + + /** + * Set the value of [lock_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLockFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->lock_file !== $v) { + $this->lock_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOCK_FILE; + } + + return $this; + } // setLockFile() + + /** + * Set the value of [retain_state_information] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainStateInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_state_information !== $v) { + $this->retain_state_information = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAIN_STATE_INFORMATION; + } + + return $this; + } // setRetainStateInformation() + + /** + * Set the value of [state_retention_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setStateRetentionFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->state_retention_file !== $v) { + $this->state_retention_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::STATE_RETENTION_FILE; + } + + return $this; + } // setStateRetentionFile() + + /** + * Set the value of [retention_update_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetentionUpdateInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retention_update_interval !== $v) { + $this->retention_update_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETENTION_UPDATE_INTERVAL; + } + + return $this; + } // setRetentionUpdateInterval() + + /** + * Set the value of [use_retained_program_state] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseRetainedProgramState($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_retained_program_state !== $v) { + $this->use_retained_program_state = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_RETAINED_PROGRAM_STATE; + } + + return $this; + } // setUseRetainedProgramState() + + /** + * Set the value of [use_syslog] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseSyslog($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_syslog !== $v) { + $this->use_syslog = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_SYSLOG; + } + + return $this; + } // setUseSyslog() + + /** + * Set the value of [log_notifications] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogNotifications($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_notifications !== $v) { + $this->log_notifications = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_NOTIFICATIONS; + } + + return $this; + } // setLogNotifications() + + /** + * Set the value of [log_service_retries] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogServiceRetries($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_service_retries !== $v) { + $this->log_service_retries = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_SERVICE_RETRIES; + } + + return $this; + } // setLogServiceRetries() + + /** + * Set the value of [log_host_retries] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogHostRetries($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_host_retries !== $v) { + $this->log_host_retries = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_HOST_RETRIES; + } + + return $this; + } // setLogHostRetries() + + /** + * Set the value of [log_event_handlers] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogEventHandlers($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_event_handlers !== $v) { + $this->log_event_handlers = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_EVENT_HANDLERS; + } + + return $this; + } // setLogEventHandlers() + + /** + * Set the value of [log_initial_states] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogInitialStates($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_initial_states !== $v) { + $this->log_initial_states = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_INITIAL_STATES; + } + + return $this; + } // setLogInitialStates() + + /** + * Set the value of [log_external_commands] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogExternalCommands($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_external_commands !== $v) { + $this->log_external_commands = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_EXTERNAL_COMMANDS; + } + + return $this; + } // setLogExternalCommands() + + /** + * Set the value of [log_passive_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLogPassiveChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->log_passive_checks !== $v) { + $this->log_passive_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOG_PASSIVE_CHECKS; + } + + return $this; + } // setLogPassiveChecks() + + /** + * Set the value of [global_host_event_handler] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setGlobalHostEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->global_host_event_handler !== $v) { + $this->global_host_event_handler = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler !== null && $this->aNagiosCommandRelatedByGlobalHostEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByGlobalHostEventHandler = null; + } + + return $this; + } // setGlobalHostEventHandler() + + /** + * Set the value of [global_service_event_handler] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setGlobalServiceEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->global_service_event_handler !== $v) { + $this->global_service_event_handler = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler !== null && $this->aNagiosCommandRelatedByGlobalServiceEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = null; + } + + return $this; + } // setGlobalServiceEventHandler() + + /** + * Set the value of [external_command_buffer_slots] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setExternalCommandBufferSlots($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->external_command_buffer_slots !== $v) { + $this->external_command_buffer_slots = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::EXTERNAL_COMMAND_BUFFER_SLOTS; + } + + return $this; + } // setExternalCommandBufferSlots() + + /** + * Set the value of [sleep_time] column. + * + * @param double $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setSleepTime($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->sleep_time !== $v) { + $this->sleep_time = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SLEEP_TIME; + } + + return $this; + } // setSleepTime() + + /** + * Set the value of [service_interleave_factor] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServiceInterleaveFactor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_interleave_factor !== $v) { + $this->service_interleave_factor = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_INTERLEAVE_FACTOR; + } + + return $this; + } // setServiceInterleaveFactor() + + /** + * Set the value of [max_concurrent_checks] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxConcurrentChecks($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_concurrent_checks !== $v) { + $this->max_concurrent_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_CONCURRENT_CHECKS; + } + + return $this; + } // setMaxConcurrentChecks() + + /** + * Set the value of [service_reaper_frequency] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServiceReaperFrequency($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_reaper_frequency !== $v) { + $this->service_reaper_frequency = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_REAPER_FREQUENCY; + } + + return $this; + } // setServiceReaperFrequency() + + /** + * Set the value of [interval_length] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setIntervalLength($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->interval_length !== $v) { + $this->interval_length = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::INTERVAL_LENGTH; + } + + return $this; + } // setIntervalLength() + + /** + * Set the value of [use_aggressive_host_checking] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseAggressiveHostChecking($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_aggressive_host_checking !== $v) { + $this->use_aggressive_host_checking = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_AGGRESSIVE_HOST_CHECKING; + } + + return $this; + } // setUseAggressiveHostChecking() + + /** + * Set the value of [enable_flap_detection] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnableFlapDetection($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_flap_detection !== $v) { + $this->enable_flap_detection = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_FLAP_DETECTION; + } + + return $this; + } // setEnableFlapDetection() + + /** + * Set the value of [low_service_flap_threshold] column. + * + * @param double $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLowServiceFlapThreshold($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->low_service_flap_threshold !== $v) { + $this->low_service_flap_threshold = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOW_SERVICE_FLAP_THRESHOLD; + } + + return $this; + } // setLowServiceFlapThreshold() + + /** + * Set the value of [high_service_flap_threshold] column. + * + * @param double $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHighServiceFlapThreshold($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->high_service_flap_threshold !== $v) { + $this->high_service_flap_threshold = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HIGH_SERVICE_FLAP_THRESHOLD; + } + + return $this; + } // setHighServiceFlapThreshold() + + /** + * Set the value of [low_host_flap_threshold] column. + * + * @param double $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setLowHostFlapThreshold($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->low_host_flap_threshold !== $v) { + $this->low_host_flap_threshold = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::LOW_HOST_FLAP_THRESHOLD; + } + + return $this; + } // setLowHostFlapThreshold() + + /** + * Set the value of [high_host_flap_threshold] column. + * + * @param double $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHighHostFlapThreshold($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->high_host_flap_threshold !== $v) { + $this->high_host_flap_threshold = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HIGH_HOST_FLAP_THRESHOLD; + } + + return $this; + } // setHighHostFlapThreshold() + + /** + * Set the value of [soft_state_dependencies] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setSoftStateDependencies($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->soft_state_dependencies !== $v) { + $this->soft_state_dependencies = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SOFT_STATE_DEPENDENCIES; + } + + return $this; + } // setSoftStateDependencies() + + /** + * Set the value of [service_check_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServiceCheckTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_check_timeout !== $v) { + $this->service_check_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_CHECK_TIMEOUT; + } + + return $this; + } // setServiceCheckTimeout() + + /** + * Set the value of [host_check_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostCheckTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_check_timeout !== $v) { + $this->host_check_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_CHECK_TIMEOUT; + } + + return $this; + } // setHostCheckTimeout() + + /** + * Set the value of [event_handler_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEventHandlerTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->event_handler_timeout !== $v) { + $this->event_handler_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::EVENT_HANDLER_TIMEOUT; + } + + return $this; + } // setEventHandlerTimeout() + + /** + * Set the value of [notification_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setNotificationTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_timeout !== $v) { + $this->notification_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::NOTIFICATION_TIMEOUT; + } + + return $this; + } // setNotificationTimeout() + + /** + * Set the value of [ocsp_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setOcspTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->ocsp_timeout !== $v) { + $this->ocsp_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OCSP_TIMEOUT; + } + + return $this; + } // setOcspTimeout() + + /** + * Set the value of [ohcp_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setOhcpTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->ohcp_timeout !== $v) { + $this->ohcp_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OHCP_TIMEOUT; + } + + return $this; + } // setOhcpTimeout() + + /** + * Set the value of [perfdata_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setPerfdataTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->perfdata_timeout !== $v) { + $this->perfdata_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::PERFDATA_TIMEOUT; + } + + return $this; + } // setPerfdataTimeout() + + /** + * Set the value of [obsess_over_services] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setObsessOverServices($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_services !== $v) { + $this->obsess_over_services = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OBSESS_OVER_SERVICES; + } + + return $this; + } // setObsessOverServices() + + /** + * Set the value of [ocsp_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setOcspCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->ocsp_command !== $v) { + $this->ocsp_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OCSP_COMMAND; + } + + if ($this->aNagiosCommandRelatedByOcspCommand !== null && $this->aNagiosCommandRelatedByOcspCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByOcspCommand = null; + } + + return $this; + } // setOcspCommand() + + /** + * Set the value of [process_performance_data] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setProcessPerformanceData($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->process_performance_data !== $v) { + $this->process_performance_data = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::PROCESS_PERFORMANCE_DATA; + } + + return $this; + } // setProcessPerformanceData() + + /** + * Set the value of [check_for_orphaned_services] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckForOrphanedServices($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_for_orphaned_services !== $v) { + $this->check_for_orphaned_services = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_FOR_ORPHANED_SERVICES; + } + + return $this; + } // setCheckForOrphanedServices() + + /** + * Set the value of [check_service_freshness] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckServiceFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_service_freshness !== $v) { + $this->check_service_freshness = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_SERVICE_FRESHNESS; + } + + return $this; + } // setCheckServiceFreshness() + + /** + * Set the value of [freshness_check_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setFreshnessCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->freshness_check_interval !== $v) { + $this->freshness_check_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::FRESHNESS_CHECK_INTERVAL; + } + + return $this; + } // setFreshnessCheckInterval() + + /** + * Set the value of [date_format] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setDateFormat($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->date_format !== $v) { + $this->date_format = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::DATE_FORMAT; + } + + return $this; + } // setDateFormat() + + /** + * Set the value of [illegal_object_name_chars] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setIllegalObjectNameChars($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->illegal_object_name_chars !== $v) { + $this->illegal_object_name_chars = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ILLEGAL_OBJECT_NAME_CHARS; + } + + return $this; + } // setIllegalObjectNameChars() + + /** + * Set the value of [illegal_macro_output_chars] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setIllegalMacroOutputChars($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->illegal_macro_output_chars !== $v) { + $this->illegal_macro_output_chars = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ILLEGAL_MACRO_OUTPUT_CHARS; + } + + return $this; + } // setIllegalMacroOutputChars() + + /** + * Set the value of [admin_email] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAdminEmail($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->admin_email !== $v) { + $this->admin_email = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ADMIN_EMAIL; + } + + return $this; + } // setAdminEmail() + + /** + * Set the value of [admin_pager] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAdminPager($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->admin_pager !== $v) { + $this->admin_pager = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ADMIN_PAGER; + } + + return $this; + } // setAdminPager() + + /** + * Set the value of [execute_host_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setExecuteHostChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->execute_host_checks !== $v) { + $this->execute_host_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::EXECUTE_HOST_CHECKS; + } + + return $this; + } // setExecuteHostChecks() + + /** + * Set the value of [service_inter_check_delay_method] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServiceInterCheckDelayMethod($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_inter_check_delay_method !== $v) { + $this->service_inter_check_delay_method = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_INTER_CHECK_DELAY_METHOD; + } + + return $this; + } // setServiceInterCheckDelayMethod() + + /** + * Set the value of [use_retained_scheduling_info] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseRetainedSchedulingInfo($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_retained_scheduling_info !== $v) { + $this->use_retained_scheduling_info = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_RETAINED_SCHEDULING_INFO; + } + + return $this; + } // setUseRetainedSchedulingInfo() + + /** + * Set the value of [accept_passive_host_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAcceptPassiveHostChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->accept_passive_host_checks !== $v) { + $this->accept_passive_host_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ACCEPT_PASSIVE_HOST_CHECKS; + } + + return $this; + } // setAcceptPassiveHostChecks() + + /** + * Set the value of [max_service_check_spread] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxServiceCheckSpread($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_service_check_spread !== $v) { + $this->max_service_check_spread = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_SERVICE_CHECK_SPREAD; + } + + return $this; + } // setMaxServiceCheckSpread() + + /** + * Set the value of [host_inter_check_delay_method] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostInterCheckDelayMethod($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_inter_check_delay_method !== $v) { + $this->host_inter_check_delay_method = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_INTER_CHECK_DELAY_METHOD; + } + + return $this; + } // setHostInterCheckDelayMethod() + + /** + * Set the value of [max_host_check_spread] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxHostCheckSpread($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_host_check_spread !== $v) { + $this->max_host_check_spread = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_HOST_CHECK_SPREAD; + } + + return $this; + } // setMaxHostCheckSpread() + + /** + * Set the value of [auto_reschedule_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAutoRescheduleChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->auto_reschedule_checks !== $v) { + $this->auto_reschedule_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::AUTO_RESCHEDULE_CHECKS; + } + + return $this; + } // setAutoRescheduleChecks() + + /** + * Set the value of [auto_rescheduling_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAutoReschedulingInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->auto_rescheduling_interval !== $v) { + $this->auto_rescheduling_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::AUTO_RESCHEDULING_INTERVAL; + } + + return $this; + } // setAutoReschedulingInterval() + + /** + * Set the value of [auto_rescheduling_window] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAutoReschedulingWindow($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->auto_rescheduling_window !== $v) { + $this->auto_rescheduling_window = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::AUTO_RESCHEDULING_WINDOW; + } + + return $this; + } // setAutoReschedulingWindow() + + /** + * Set the value of [ochp_timeout] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setOchpTimeout($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->ochp_timeout !== $v) { + $this->ochp_timeout = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OCHP_TIMEOUT; + } + + return $this; + } // setOchpTimeout() + + /** + * Set the value of [obsess_over_hosts] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setObsessOverHosts($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_hosts !== $v) { + $this->obsess_over_hosts = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OBSESS_OVER_HOSTS; + } + + return $this; + } // setObsessOverHosts() + + /** + * Set the value of [ochp_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setOchpCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->ochp_command !== $v) { + $this->ochp_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OCHP_COMMAND; + } + + if ($this->aNagiosCommandRelatedByOchpCommand !== null && $this->aNagiosCommandRelatedByOchpCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByOchpCommand = null; + } + + return $this; + } // setOchpCommand() + + /** + * Set the value of [check_host_freshness] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckHostFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_host_freshness !== $v) { + $this->check_host_freshness = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_HOST_FRESHNESS; + } + + return $this; + } // setCheckHostFreshness() + + /** + * Set the value of [host_freshness_check_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostFreshnessCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_freshness_check_interval !== $v) { + $this->host_freshness_check_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_FRESHNESS_CHECK_INTERVAL; + } + + return $this; + } // setHostFreshnessCheckInterval() + + /** + * Set the value of [service_freshness_check_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServiceFreshnessCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_freshness_check_interval !== $v) { + $this->service_freshness_check_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_FRESHNESS_CHECK_INTERVAL; + } + + return $this; + } // setServiceFreshnessCheckInterval() + + /** + * Set the value of [use_regexp_matching] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseRegexpMatching($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_regexp_matching !== $v) { + $this->use_regexp_matching = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_REGEXP_MATCHING; + } + + return $this; + } // setUseRegexpMatching() + + /** + * Set the value of [use_true_regexp_matching] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseTrueRegexpMatching($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_true_regexp_matching !== $v) { + $this->use_true_regexp_matching = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_TRUE_REGEXP_MATCHING; + } + + return $this; + } // setUseTrueRegexpMatching() + + /** + * Set the value of [event_broker_options] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEventBrokerOptions($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->event_broker_options !== $v) { + $this->event_broker_options = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::EVENT_BROKER_OPTIONS; + } + + return $this; + } // setEventBrokerOptions() + + /** + * Set the value of [daemon_dumps_core] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setDaemonDumpsCore($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->daemon_dumps_core !== $v) { + $this->daemon_dumps_core = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::DAEMON_DUMPS_CORE; + } + + return $this; + } // setDaemonDumpsCore() + + /** + * Set the value of [host_perfdata_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_perfdata_command !== $v) { + $this->host_perfdata_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND; + } + + if ($this->aNagiosCommandRelatedByHostPerfdataCommand !== null && $this->aNagiosCommandRelatedByHostPerfdataCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByHostPerfdataCommand = null; + } + + return $this; + } // setHostPerfdataCommand() + + /** + * Set the value of [service_perfdata_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_perfdata_command !== $v) { + $this->service_perfdata_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND; + } + + if ($this->aNagiosCommandRelatedByServicePerfdataCommand !== null && $this->aNagiosCommandRelatedByServicePerfdataCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByServicePerfdataCommand = null; + } + + return $this; + } // setServicePerfdataCommand() + + /** + * Set the value of [host_perfdata_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_perfdata_file !== $v) { + $this->host_perfdata_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_FILE; + } + + return $this; + } // setHostPerfdataFile() + + /** + * Set the value of [host_perfdata_file_template] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataFileTemplate($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_perfdata_file_template !== $v) { + $this->host_perfdata_file_template = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_TEMPLATE; + } + + return $this; + } // setHostPerfdataFileTemplate() + + /** + * Set the value of [service_perfdata_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_perfdata_file !== $v) { + $this->service_perfdata_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE; + } + + return $this; + } // setServicePerfdataFile() + + /** + * Set the value of [service_perfdata_file_template] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataFileTemplate($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_perfdata_file_template !== $v) { + $this->service_perfdata_file_template = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_TEMPLATE; + } + + return $this; + } // setServicePerfdataFileTemplate() + + /** + * Set the value of [host_perfdata_file_mode] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataFileMode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->host_perfdata_file_mode !== $v) { + $this->host_perfdata_file_mode = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_MODE; + } + + return $this; + } // setHostPerfdataFileMode() + + /** + * Set the value of [service_perfdata_file_mode] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataFileMode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->service_perfdata_file_mode !== $v) { + $this->service_perfdata_file_mode = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_MODE; + } + + return $this; + } // setServicePerfdataFileMode() + + /** + * Set the value of [host_perfdata_file_processing_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataFileProcessingCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_perfdata_file_processing_command !== $v) { + $this->host_perfdata_file_processing_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND; + } + + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand !== null && $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = null; + } + + return $this; + } // setHostPerfdataFileProcessingCommand() + + /** + * Set the value of [service_perfdata_file_processing_command] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataFileProcessingCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_perfdata_file_processing_command !== $v) { + $this->service_perfdata_file_processing_command = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND; + } + + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand !== null && $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = null; + } + + return $this; + } // setServicePerfdataFileProcessingCommand() + + /** + * Set the value of [host_perfdata_file_processing_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setHostPerfdataFileProcessingInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_perfdata_file_processing_interval !== $v) { + $this->host_perfdata_file_processing_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_INTERVAL; + } + + return $this; + } // setHostPerfdataFileProcessingInterval() + + /** + * Set the value of [service_perfdata_file_processing_interval] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setServicePerfdataFileProcessingInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_perfdata_file_processing_interval !== $v) { + $this->service_perfdata_file_processing_interval = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL; + } + + return $this; + } // setServicePerfdataFileProcessingInterval() + + /** + * Set the value of [object_cache_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setObjectCacheFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->object_cache_file !== $v) { + $this->object_cache_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::OBJECT_CACHE_FILE; + } + + return $this; + } // setObjectCacheFile() + + /** + * Set the value of [precached_object_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setPrecachedObjectFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->precached_object_file !== $v) { + $this->precached_object_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::PRECACHED_OBJECT_FILE; + } + + return $this; + } // setPrecachedObjectFile() + + /** + * Set the value of [retained_host_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedHostAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_host_attribute_mask !== $v) { + $this->retained_host_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_HOST_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedHostAttributeMask() + + /** + * Set the value of [retained_service_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedServiceAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_service_attribute_mask !== $v) { + $this->retained_service_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_SERVICE_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedServiceAttributeMask() + + /** + * Set the value of [retained_process_host_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedProcessHostAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_process_host_attribute_mask !== $v) { + $this->retained_process_host_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedProcessHostAttributeMask() + + /** + * Set the value of [retained_process_service_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedProcessServiceAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_process_service_attribute_mask !== $v) { + $this->retained_process_service_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedProcessServiceAttributeMask() + + /** + * Set the value of [retained_contact_host_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedContactHostAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_contact_host_attribute_mask !== $v) { + $this->retained_contact_host_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedContactHostAttributeMask() + + /** + * Set the value of [retained_contact_service_attribute_mask] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setRetainedContactServiceAttributeMask($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retained_contact_service_attribute_mask !== $v) { + $this->retained_contact_service_attribute_mask = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK; + } + + return $this; + } // setRetainedContactServiceAttributeMask() + + /** + * Set the value of [check_result_reaper_frequency] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckResultReaperFrequency($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_result_reaper_frequency !== $v) { + $this->check_result_reaper_frequency = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_RESULT_REAPER_FREQUENCY; + } + + return $this; + } // setCheckResultReaperFrequency() + + /** + * Set the value of [max_check_result_reaper_time] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxCheckResultReaperTime($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_check_result_reaper_time !== $v) { + $this->max_check_result_reaper_time = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_CHECK_RESULT_REAPER_TIME; + } + + return $this; + } // setMaxCheckResultReaperTime() + + /** + * Set the value of [check_result_path] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCheckResultPath($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->check_result_path !== $v) { + $this->check_result_path = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHECK_RESULT_PATH; + } + + return $this; + } // setCheckResultPath() + + /** + * Set the value of [max_check_result_file_age] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxCheckResultFileAge($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_check_result_file_age !== $v) { + $this->max_check_result_file_age = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_CHECK_RESULT_FILE_AGE; + } + + return $this; + } // setMaxCheckResultFileAge() + + /** + * Set the value of [translate_passive_host_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setTranslatePassiveHostChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->translate_passive_host_checks !== $v) { + $this->translate_passive_host_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::TRANSLATE_PASSIVE_HOST_CHECKS; + } + + return $this; + } // setTranslatePassiveHostChecks() + + /** + * Set the value of [passive_host_checks_are_soft] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setPassiveHostChecksAreSoft($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->passive_host_checks_are_soft !== $v) { + $this->passive_host_checks_are_soft = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::PASSIVE_HOST_CHECKS_ARE_SOFT; + } + + return $this; + } // setPassiveHostChecksAreSoft() + + /** + * Set the value of [enable_predictive_host_dependency_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnablePredictiveHostDependencyChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_predictive_host_dependency_checks !== $v) { + $this->enable_predictive_host_dependency_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS; + } + + return $this; + } // setEnablePredictiveHostDependencyChecks() + + /** + * Set the value of [enable_predictive_service_dependency_checks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnablePredictiveServiceDependencyChecks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_predictive_service_dependency_checks !== $v) { + $this->enable_predictive_service_dependency_checks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS; + } + + return $this; + } // setEnablePredictiveServiceDependencyChecks() + + /** + * Set the value of [cached_host_check_horizon] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCachedHostCheckHorizon($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->cached_host_check_horizon !== $v) { + $this->cached_host_check_horizon = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CACHED_HOST_CHECK_HORIZON; + } + + return $this; + } // setCachedHostCheckHorizon() + + /** + * Set the value of [cached_service_check_horizon] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setCachedServiceCheckHorizon($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->cached_service_check_horizon !== $v) { + $this->cached_service_check_horizon = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CACHED_SERVICE_CHECK_HORIZON; + } + + return $this; + } // setCachedServiceCheckHorizon() + + /** + * Set the value of [use_large_installation_tweaks] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseLargeInstallationTweaks($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_large_installation_tweaks !== $v) { + $this->use_large_installation_tweaks = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_LARGE_INSTALLATION_TWEAKS; + } + + return $this; + } // setUseLargeInstallationTweaks() + + /** + * Set the value of [free_child_process_memory] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setFreeChildProcessMemory($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->free_child_process_memory !== $v) { + $this->free_child_process_memory = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::FREE_CHILD_PROCESS_MEMORY; + } + + return $this; + } // setFreeChildProcessMemory() + + /** + * Set the value of [child_processes_fork_twice] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setChildProcessesForkTwice($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->child_processes_fork_twice !== $v) { + $this->child_processes_fork_twice = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::CHILD_PROCESSES_FORK_TWICE; + } + + return $this; + } // setChildProcessesForkTwice() + + /** + * Set the value of [enable_environment_macros] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnableEnvironmentMacros($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_environment_macros !== $v) { + $this->enable_environment_macros = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_ENVIRONMENT_MACROS; + } + + return $this; + } // setEnableEnvironmentMacros() + + /** + * Set the value of [additional_freshness_latency] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setAdditionalFreshnessLatency($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->additional_freshness_latency !== $v) { + $this->additional_freshness_latency = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ADDITIONAL_FRESHNESS_LATENCY; + } + + return $this; + } // setAdditionalFreshnessLatency() + + /** + * Set the value of [enable_embedded_perl] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setEnableEmbeddedPerl($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->enable_embedded_perl !== $v) { + $this->enable_embedded_perl = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ENABLE_EMBEDDED_PERL; + } + + return $this; + } // setEnableEmbeddedPerl() + + /** + * Set the value of [use_embedded_perl_implicitly] column. + * + * @param boolean $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseEmbeddedPerlImplicitly($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->use_embedded_perl_implicitly !== $v) { + $this->use_embedded_perl_implicitly = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_EMBEDDED_PERL_IMPLICITLY; + } + + return $this; + } // setUseEmbeddedPerlImplicitly() + + /** + * Set the value of [p1_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setP1File($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->p1_file !== $v) { + $this->p1_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::P1_FILE; + } + + return $this; + } // setP1File() + + /** + * Set the value of [use_timezone] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setUseTimezone($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->use_timezone !== $v) { + $this->use_timezone = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::USE_TIMEZONE; + } + + return $this; + } // setUseTimezone() + + /** + * Set the value of [debug_file] column. + * + * @param string $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setDebugFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->debug_file !== $v) { + $this->debug_file = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::DEBUG_FILE; + } + + return $this; + } // setDebugFile() + + /** + * Set the value of [debug_level] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setDebugLevel($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->debug_level !== $v) { + $this->debug_level = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::DEBUG_LEVEL; + } + + return $this; + } // setDebugLevel() + + /** + * Set the value of [debug_verbosity] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setDebugVerbosity($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->debug_verbosity !== $v) { + $this->debug_verbosity = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::DEBUG_VERBOSITY; + } + + return $this; + } // setDebugVerbosity() + + /** + * Set the value of [max_debug_file_size] column. + * + * @param int $v new value + * @return NagiosMainConfiguration The current object (for fluent API support) + */ + public function setMaxDebugFileSize($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_debug_file_size !== $v) { + $this->max_debug_file_size = $v; + $this->modifiedColumns[] = NagiosMainConfigurationPeer::MAX_DEBUG_FILE_SIZE; + } + + return $this; + } // setMaxDebugFileSize() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->config_dir = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->log_file = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->temp_file = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->status_file = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->status_update_interval = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->nagios_user = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->nagios_group = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->enable_notifications = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null; + $this->execute_service_checks = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->accept_passive_service_checks = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null; + $this->enable_event_handlers = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->log_rotation_method = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; + $this->log_archive_path = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->check_external_commands = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->command_check_interval = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; + $this->command_file = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; + $this->lock_file = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; + $this->retain_state_information = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; + $this->state_retention_file = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; + $this->retention_update_interval = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null; + $this->use_retained_program_state = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->use_syslog = ($row[$startcol + 22] !== null) ? (boolean) $row[$startcol + 22] : null; + $this->log_notifications = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; + $this->log_service_retries = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; + $this->log_host_retries = ($row[$startcol + 25] !== null) ? (boolean) $row[$startcol + 25] : null; + $this->log_event_handlers = ($row[$startcol + 26] !== null) ? (boolean) $row[$startcol + 26] : null; + $this->log_initial_states = ($row[$startcol + 27] !== null) ? (boolean) $row[$startcol + 27] : null; + $this->log_external_commands = ($row[$startcol + 28] !== null) ? (boolean) $row[$startcol + 28] : null; + $this->log_passive_checks = ($row[$startcol + 29] !== null) ? (boolean) $row[$startcol + 29] : null; + $this->global_host_event_handler = ($row[$startcol + 30] !== null) ? (int) $row[$startcol + 30] : null; + $this->global_service_event_handler = ($row[$startcol + 31] !== null) ? (int) $row[$startcol + 31] : null; + $this->external_command_buffer_slots = ($row[$startcol + 32] !== null) ? (int) $row[$startcol + 32] : null; + $this->sleep_time = ($row[$startcol + 33] !== null) ? (double) $row[$startcol + 33] : null; + $this->service_interleave_factor = ($row[$startcol + 34] !== null) ? (string) $row[$startcol + 34] : null; + $this->max_concurrent_checks = ($row[$startcol + 35] !== null) ? (int) $row[$startcol + 35] : null; + $this->service_reaper_frequency = ($row[$startcol + 36] !== null) ? (int) $row[$startcol + 36] : null; + $this->interval_length = ($row[$startcol + 37] !== null) ? (int) $row[$startcol + 37] : null; + $this->use_aggressive_host_checking = ($row[$startcol + 38] !== null) ? (boolean) $row[$startcol + 38] : null; + $this->enable_flap_detection = ($row[$startcol + 39] !== null) ? (boolean) $row[$startcol + 39] : null; + $this->low_service_flap_threshold = ($row[$startcol + 40] !== null) ? (double) $row[$startcol + 40] : null; + $this->high_service_flap_threshold = ($row[$startcol + 41] !== null) ? (double) $row[$startcol + 41] : null; + $this->low_host_flap_threshold = ($row[$startcol + 42] !== null) ? (double) $row[$startcol + 42] : null; + $this->high_host_flap_threshold = ($row[$startcol + 43] !== null) ? (double) $row[$startcol + 43] : null; + $this->soft_state_dependencies = ($row[$startcol + 44] !== null) ? (boolean) $row[$startcol + 44] : null; + $this->service_check_timeout = ($row[$startcol + 45] !== null) ? (int) $row[$startcol + 45] : null; + $this->host_check_timeout = ($row[$startcol + 46] !== null) ? (int) $row[$startcol + 46] : null; + $this->event_handler_timeout = ($row[$startcol + 47] !== null) ? (int) $row[$startcol + 47] : null; + $this->notification_timeout = ($row[$startcol + 48] !== null) ? (int) $row[$startcol + 48] : null; + $this->ocsp_timeout = ($row[$startcol + 49] !== null) ? (int) $row[$startcol + 49] : null; + $this->ohcp_timeout = ($row[$startcol + 50] !== null) ? (int) $row[$startcol + 50] : null; + $this->perfdata_timeout = ($row[$startcol + 51] !== null) ? (int) $row[$startcol + 51] : null; + $this->obsess_over_services = ($row[$startcol + 52] !== null) ? (boolean) $row[$startcol + 52] : null; + $this->ocsp_command = ($row[$startcol + 53] !== null) ? (int) $row[$startcol + 53] : null; + $this->process_performance_data = ($row[$startcol + 54] !== null) ? (boolean) $row[$startcol + 54] : null; + $this->check_for_orphaned_services = ($row[$startcol + 55] !== null) ? (boolean) $row[$startcol + 55] : null; + $this->check_service_freshness = ($row[$startcol + 56] !== null) ? (boolean) $row[$startcol + 56] : null; + $this->freshness_check_interval = ($row[$startcol + 57] !== null) ? (int) $row[$startcol + 57] : null; + $this->date_format = ($row[$startcol + 58] !== null) ? (string) $row[$startcol + 58] : null; + $this->illegal_object_name_chars = ($row[$startcol + 59] !== null) ? (string) $row[$startcol + 59] : null; + $this->illegal_macro_output_chars = ($row[$startcol + 60] !== null) ? (string) $row[$startcol + 60] : null; + $this->admin_email = ($row[$startcol + 61] !== null) ? (string) $row[$startcol + 61] : null; + $this->admin_pager = ($row[$startcol + 62] !== null) ? (string) $row[$startcol + 62] : null; + $this->execute_host_checks = ($row[$startcol + 63] !== null) ? (boolean) $row[$startcol + 63] : null; + $this->service_inter_check_delay_method = ($row[$startcol + 64] !== null) ? (string) $row[$startcol + 64] : null; + $this->use_retained_scheduling_info = ($row[$startcol + 65] !== null) ? (boolean) $row[$startcol + 65] : null; + $this->accept_passive_host_checks = ($row[$startcol + 66] !== null) ? (boolean) $row[$startcol + 66] : null; + $this->max_service_check_spread = ($row[$startcol + 67] !== null) ? (int) $row[$startcol + 67] : null; + $this->host_inter_check_delay_method = ($row[$startcol + 68] !== null) ? (string) $row[$startcol + 68] : null; + $this->max_host_check_spread = ($row[$startcol + 69] !== null) ? (int) $row[$startcol + 69] : null; + $this->auto_reschedule_checks = ($row[$startcol + 70] !== null) ? (boolean) $row[$startcol + 70] : null; + $this->auto_rescheduling_interval = ($row[$startcol + 71] !== null) ? (int) $row[$startcol + 71] : null; + $this->auto_rescheduling_window = ($row[$startcol + 72] !== null) ? (int) $row[$startcol + 72] : null; + $this->ochp_timeout = ($row[$startcol + 73] !== null) ? (int) $row[$startcol + 73] : null; + $this->obsess_over_hosts = ($row[$startcol + 74] !== null) ? (boolean) $row[$startcol + 74] : null; + $this->ochp_command = ($row[$startcol + 75] !== null) ? (int) $row[$startcol + 75] : null; + $this->check_host_freshness = ($row[$startcol + 76] !== null) ? (boolean) $row[$startcol + 76] : null; + $this->host_freshness_check_interval = ($row[$startcol + 77] !== null) ? (int) $row[$startcol + 77] : null; + $this->service_freshness_check_interval = ($row[$startcol + 78] !== null) ? (int) $row[$startcol + 78] : null; + $this->use_regexp_matching = ($row[$startcol + 79] !== null) ? (boolean) $row[$startcol + 79] : null; + $this->use_true_regexp_matching = ($row[$startcol + 80] !== null) ? (boolean) $row[$startcol + 80] : null; + $this->event_broker_options = ($row[$startcol + 81] !== null) ? (string) $row[$startcol + 81] : null; + $this->daemon_dumps_core = ($row[$startcol + 82] !== null) ? (boolean) $row[$startcol + 82] : null; + $this->host_perfdata_command = ($row[$startcol + 83] !== null) ? (int) $row[$startcol + 83] : null; + $this->service_perfdata_command = ($row[$startcol + 84] !== null) ? (int) $row[$startcol + 84] : null; + $this->host_perfdata_file = ($row[$startcol + 85] !== null) ? (string) $row[$startcol + 85] : null; + $this->host_perfdata_file_template = ($row[$startcol + 86] !== null) ? (string) $row[$startcol + 86] : null; + $this->service_perfdata_file = ($row[$startcol + 87] !== null) ? (string) $row[$startcol + 87] : null; + $this->service_perfdata_file_template = ($row[$startcol + 88] !== null) ? (string) $row[$startcol + 88] : null; + $this->host_perfdata_file_mode = ($row[$startcol + 89] !== null) ? (string) $row[$startcol + 89] : null; + $this->service_perfdata_file_mode = ($row[$startcol + 90] !== null) ? (string) $row[$startcol + 90] : null; + $this->host_perfdata_file_processing_command = ($row[$startcol + 91] !== null) ? (int) $row[$startcol + 91] : null; + $this->service_perfdata_file_processing_command = ($row[$startcol + 92] !== null) ? (int) $row[$startcol + 92] : null; + $this->host_perfdata_file_processing_interval = ($row[$startcol + 93] !== null) ? (int) $row[$startcol + 93] : null; + $this->service_perfdata_file_processing_interval = ($row[$startcol + 94] !== null) ? (int) $row[$startcol + 94] : null; + $this->object_cache_file = ($row[$startcol + 95] !== null) ? (string) $row[$startcol + 95] : null; + $this->precached_object_file = ($row[$startcol + 96] !== null) ? (string) $row[$startcol + 96] : null; + $this->retained_host_attribute_mask = ($row[$startcol + 97] !== null) ? (int) $row[$startcol + 97] : null; + $this->retained_service_attribute_mask = ($row[$startcol + 98] !== null) ? (int) $row[$startcol + 98] : null; + $this->retained_process_host_attribute_mask = ($row[$startcol + 99] !== null) ? (int) $row[$startcol + 99] : null; + $this->retained_process_service_attribute_mask = ($row[$startcol + 100] !== null) ? (int) $row[$startcol + 100] : null; + $this->retained_contact_host_attribute_mask = ($row[$startcol + 101] !== null) ? (int) $row[$startcol + 101] : null; + $this->retained_contact_service_attribute_mask = ($row[$startcol + 102] !== null) ? (int) $row[$startcol + 102] : null; + $this->check_result_reaper_frequency = ($row[$startcol + 103] !== null) ? (int) $row[$startcol + 103] : null; + $this->max_check_result_reaper_time = ($row[$startcol + 104] !== null) ? (int) $row[$startcol + 104] : null; + $this->check_result_path = ($row[$startcol + 105] !== null) ? (string) $row[$startcol + 105] : null; + $this->max_check_result_file_age = ($row[$startcol + 106] !== null) ? (int) $row[$startcol + 106] : null; + $this->translate_passive_host_checks = ($row[$startcol + 107] !== null) ? (boolean) $row[$startcol + 107] : null; + $this->passive_host_checks_are_soft = ($row[$startcol + 108] !== null) ? (boolean) $row[$startcol + 108] : null; + $this->enable_predictive_host_dependency_checks = ($row[$startcol + 109] !== null) ? (boolean) $row[$startcol + 109] : null; + $this->enable_predictive_service_dependency_checks = ($row[$startcol + 110] !== null) ? (boolean) $row[$startcol + 110] : null; + $this->cached_host_check_horizon = ($row[$startcol + 111] !== null) ? (int) $row[$startcol + 111] : null; + $this->cached_service_check_horizon = ($row[$startcol + 112] !== null) ? (int) $row[$startcol + 112] : null; + $this->use_large_installation_tweaks = ($row[$startcol + 113] !== null) ? (boolean) $row[$startcol + 113] : null; + $this->free_child_process_memory = ($row[$startcol + 114] !== null) ? (boolean) $row[$startcol + 114] : null; + $this->child_processes_fork_twice = ($row[$startcol + 115] !== null) ? (boolean) $row[$startcol + 115] : null; + $this->enable_environment_macros = ($row[$startcol + 116] !== null) ? (boolean) $row[$startcol + 116] : null; + $this->additional_freshness_latency = ($row[$startcol + 117] !== null) ? (int) $row[$startcol + 117] : null; + $this->enable_embedded_perl = ($row[$startcol + 118] !== null) ? (boolean) $row[$startcol + 118] : null; + $this->use_embedded_perl_implicitly = ($row[$startcol + 119] !== null) ? (boolean) $row[$startcol + 119] : null; + $this->p1_file = ($row[$startcol + 120] !== null) ? (string) $row[$startcol + 120] : null; + $this->use_timezone = ($row[$startcol + 121] !== null) ? (string) $row[$startcol + 121] : null; + $this->debug_file = ($row[$startcol + 122] !== null) ? (string) $row[$startcol + 122] : null; + $this->debug_level = ($row[$startcol + 123] !== null) ? (int) $row[$startcol + 123] : null; + $this->debug_verbosity = ($row[$startcol + 124] !== null) ? (int) $row[$startcol + 124] : null; + $this->max_debug_file_size = ($row[$startcol + 125] !== null) ? (int) $row[$startcol + 125] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 126; // 126 = NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosMainConfiguration object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler !== null && $this->global_host_event_handler !== $this->aNagiosCommandRelatedByGlobalHostEventHandler->getId()) { + $this->aNagiosCommandRelatedByGlobalHostEventHandler = null; + } + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler !== null && $this->global_service_event_handler !== $this->aNagiosCommandRelatedByGlobalServiceEventHandler->getId()) { + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = null; + } + if ($this->aNagiosCommandRelatedByOcspCommand !== null && $this->ocsp_command !== $this->aNagiosCommandRelatedByOcspCommand->getId()) { + $this->aNagiosCommandRelatedByOcspCommand = null; + } + if ($this->aNagiosCommandRelatedByOchpCommand !== null && $this->ochp_command !== $this->aNagiosCommandRelatedByOchpCommand->getId()) { + $this->aNagiosCommandRelatedByOchpCommand = null; + } + if ($this->aNagiosCommandRelatedByHostPerfdataCommand !== null && $this->host_perfdata_command !== $this->aNagiosCommandRelatedByHostPerfdataCommand->getId()) { + $this->aNagiosCommandRelatedByHostPerfdataCommand = null; + } + if ($this->aNagiosCommandRelatedByServicePerfdataCommand !== null && $this->service_perfdata_command !== $this->aNagiosCommandRelatedByServicePerfdataCommand->getId()) { + $this->aNagiosCommandRelatedByServicePerfdataCommand = null; + } + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand !== null && $this->host_perfdata_file_processing_command !== $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->getId()) { + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = null; + } + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand !== null && $this->service_perfdata_file_processing_command !== $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->getId()) { + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosMainConfigurationPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosCommandRelatedByOcspCommand = null; + $this->aNagiosCommandRelatedByOchpCommand = null; + $this->aNagiosCommandRelatedByHostPerfdataCommand = null; + $this->aNagiosCommandRelatedByServicePerfdataCommand = null; + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = null; + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = null; + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = null; + $this->aNagiosCommandRelatedByGlobalHostEventHandler = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosMainConfigurationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosMainConfigurationPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosCommandRelatedByOcspCommand !== null) { + if ($this->aNagiosCommandRelatedByOcspCommand->isModified() || $this->aNagiosCommandRelatedByOcspCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByOcspCommand->save($con); + } + $this->setNagiosCommandRelatedByOcspCommand($this->aNagiosCommandRelatedByOcspCommand); + } + + if ($this->aNagiosCommandRelatedByOchpCommand !== null) { + if ($this->aNagiosCommandRelatedByOchpCommand->isModified() || $this->aNagiosCommandRelatedByOchpCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByOchpCommand->save($con); + } + $this->setNagiosCommandRelatedByOchpCommand($this->aNagiosCommandRelatedByOchpCommand); + } + + if ($this->aNagiosCommandRelatedByHostPerfdataCommand !== null) { + if ($this->aNagiosCommandRelatedByHostPerfdataCommand->isModified() || $this->aNagiosCommandRelatedByHostPerfdataCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByHostPerfdataCommand->save($con); + } + $this->setNagiosCommandRelatedByHostPerfdataCommand($this->aNagiosCommandRelatedByHostPerfdataCommand); + } + + if ($this->aNagiosCommandRelatedByServicePerfdataCommand !== null) { + if ($this->aNagiosCommandRelatedByServicePerfdataCommand->isModified() || $this->aNagiosCommandRelatedByServicePerfdataCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByServicePerfdataCommand->save($con); + } + $this->setNagiosCommandRelatedByServicePerfdataCommand($this->aNagiosCommandRelatedByServicePerfdataCommand); + } + + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand !== null) { + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->isModified() || $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->save($con); + } + $this->setNagiosCommandRelatedByHostPerfdataFileProcessingCommand($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand); + } + + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand !== null) { + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->isModified() || $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->save($con); + } + $this->setNagiosCommandRelatedByServicePerfdataFileProcessingCommand($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand); + } + + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler !== null) { + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler->isModified() || $this->aNagiosCommandRelatedByGlobalServiceEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByGlobalServiceEventHandler->save($con); + } + $this->setNagiosCommandRelatedByGlobalServiceEventHandler($this->aNagiosCommandRelatedByGlobalServiceEventHandler); + } + + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler !== null) { + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler->isModified() || $this->aNagiosCommandRelatedByGlobalHostEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByGlobalHostEventHandler->save($con); + } + $this->setNagiosCommandRelatedByGlobalHostEventHandler($this->aNagiosCommandRelatedByGlobalHostEventHandler); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosMainConfigurationPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosMainConfigurationPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosMainConfigurationPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosCommandRelatedByOcspCommand !== null) { + if (!$this->aNagiosCommandRelatedByOcspCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByOcspCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByOchpCommand !== null) { + if (!$this->aNagiosCommandRelatedByOchpCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByOchpCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByHostPerfdataCommand !== null) { + if (!$this->aNagiosCommandRelatedByHostPerfdataCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByHostPerfdataCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByServicePerfdataCommand !== null) { + if (!$this->aNagiosCommandRelatedByServicePerfdataCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByServicePerfdataCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand !== null) { + if (!$this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand !== null) { + if (!$this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByGlobalServiceEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByGlobalServiceEventHandler->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByGlobalHostEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByGlobalHostEventHandler->getValidationFailures()); + } + } + + + if (($retval = NagiosMainConfigurationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosMainConfigurationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getConfigDir(); + break; + case 2: + return $this->getLogFile(); + break; + case 3: + return $this->getTempFile(); + break; + case 4: + return $this->getStatusFile(); + break; + case 5: + return $this->getStatusUpdateInterval(); + break; + case 6: + return $this->getNagiosUser(); + break; + case 7: + return $this->getNagiosGroup(); + break; + case 8: + return $this->getEnableNotifications(); + break; + case 9: + return $this->getExecuteServiceChecks(); + break; + case 10: + return $this->getAcceptPassiveServiceChecks(); + break; + case 11: + return $this->getEnableEventHandlers(); + break; + case 12: + return $this->getLogRotationMethod(); + break; + case 13: + return $this->getLogArchivePath(); + break; + case 14: + return $this->getCheckExternalCommands(); + break; + case 15: + return $this->getCommandCheckInterval(); + break; + case 16: + return $this->getCommandFile(); + break; + case 17: + return $this->getLockFile(); + break; + case 18: + return $this->getRetainStateInformation(); + break; + case 19: + return $this->getStateRetentionFile(); + break; + case 20: + return $this->getRetentionUpdateInterval(); + break; + case 21: + return $this->getUseRetainedProgramState(); + break; + case 22: + return $this->getUseSyslog(); + break; + case 23: + return $this->getLogNotifications(); + break; + case 24: + return $this->getLogServiceRetries(); + break; + case 25: + return $this->getLogHostRetries(); + break; + case 26: + return $this->getLogEventHandlers(); + break; + case 27: + return $this->getLogInitialStates(); + break; + case 28: + return $this->getLogExternalCommands(); + break; + case 29: + return $this->getLogPassiveChecks(); + break; + case 30: + return $this->getGlobalHostEventHandler(); + break; + case 31: + return $this->getGlobalServiceEventHandler(); + break; + case 32: + return $this->getExternalCommandBufferSlots(); + break; + case 33: + return $this->getSleepTime(); + break; + case 34: + return $this->getServiceInterleaveFactor(); + break; + case 35: + return $this->getMaxConcurrentChecks(); + break; + case 36: + return $this->getServiceReaperFrequency(); + break; + case 37: + return $this->getIntervalLength(); + break; + case 38: + return $this->getUseAggressiveHostChecking(); + break; + case 39: + return $this->getEnableFlapDetection(); + break; + case 40: + return $this->getLowServiceFlapThreshold(); + break; + case 41: + return $this->getHighServiceFlapThreshold(); + break; + case 42: + return $this->getLowHostFlapThreshold(); + break; + case 43: + return $this->getHighHostFlapThreshold(); + break; + case 44: + return $this->getSoftStateDependencies(); + break; + case 45: + return $this->getServiceCheckTimeout(); + break; + case 46: + return $this->getHostCheckTimeout(); + break; + case 47: + return $this->getEventHandlerTimeout(); + break; + case 48: + return $this->getNotificationTimeout(); + break; + case 49: + return $this->getOcspTimeout(); + break; + case 50: + return $this->getOhcpTimeout(); + break; + case 51: + return $this->getPerfdataTimeout(); + break; + case 52: + return $this->getObsessOverServices(); + break; + case 53: + return $this->getOcspCommand(); + break; + case 54: + return $this->getProcessPerformanceData(); + break; + case 55: + return $this->getCheckForOrphanedServices(); + break; + case 56: + return $this->getCheckServiceFreshness(); + break; + case 57: + return $this->getFreshnessCheckInterval(); + break; + case 58: + return $this->getDateFormat(); + break; + case 59: + return $this->getIllegalObjectNameChars(); + break; + case 60: + return $this->getIllegalMacroOutputChars(); + break; + case 61: + return $this->getAdminEmail(); + break; + case 62: + return $this->getAdminPager(); + break; + case 63: + return $this->getExecuteHostChecks(); + break; + case 64: + return $this->getServiceInterCheckDelayMethod(); + break; + case 65: + return $this->getUseRetainedSchedulingInfo(); + break; + case 66: + return $this->getAcceptPassiveHostChecks(); + break; + case 67: + return $this->getMaxServiceCheckSpread(); + break; + case 68: + return $this->getHostInterCheckDelayMethod(); + break; + case 69: + return $this->getMaxHostCheckSpread(); + break; + case 70: + return $this->getAutoRescheduleChecks(); + break; + case 71: + return $this->getAutoReschedulingInterval(); + break; + case 72: + return $this->getAutoReschedulingWindow(); + break; + case 73: + return $this->getOchpTimeout(); + break; + case 74: + return $this->getObsessOverHosts(); + break; + case 75: + return $this->getOchpCommand(); + break; + case 76: + return $this->getCheckHostFreshness(); + break; + case 77: + return $this->getHostFreshnessCheckInterval(); + break; + case 78: + return $this->getServiceFreshnessCheckInterval(); + break; + case 79: + return $this->getUseRegexpMatching(); + break; + case 80: + return $this->getUseTrueRegexpMatching(); + break; + case 81: + return $this->getEventBrokerOptions(); + break; + case 82: + return $this->getDaemonDumpsCore(); + break; + case 83: + return $this->getHostPerfdataCommand(); + break; + case 84: + return $this->getServicePerfdataCommand(); + break; + case 85: + return $this->getHostPerfdataFile(); + break; + case 86: + return $this->getHostPerfdataFileTemplate(); + break; + case 87: + return $this->getServicePerfdataFile(); + break; + case 88: + return $this->getServicePerfdataFileTemplate(); + break; + case 89: + return $this->getHostPerfdataFileMode(); + break; + case 90: + return $this->getServicePerfdataFileMode(); + break; + case 91: + return $this->getHostPerfdataFileProcessingCommand(); + break; + case 92: + return $this->getServicePerfdataFileProcessingCommand(); + break; + case 93: + return $this->getHostPerfdataFileProcessingInterval(); + break; + case 94: + return $this->getServicePerfdataFileProcessingInterval(); + break; + case 95: + return $this->getObjectCacheFile(); + break; + case 96: + return $this->getPrecachedObjectFile(); + break; + case 97: + return $this->getRetainedHostAttributeMask(); + break; + case 98: + return $this->getRetainedServiceAttributeMask(); + break; + case 99: + return $this->getRetainedProcessHostAttributeMask(); + break; + case 100: + return $this->getRetainedProcessServiceAttributeMask(); + break; + case 101: + return $this->getRetainedContactHostAttributeMask(); + break; + case 102: + return $this->getRetainedContactServiceAttributeMask(); + break; + case 103: + return $this->getCheckResultReaperFrequency(); + break; + case 104: + return $this->getMaxCheckResultReaperTime(); + break; + case 105: + return $this->getCheckResultPath(); + break; + case 106: + return $this->getMaxCheckResultFileAge(); + break; + case 107: + return $this->getTranslatePassiveHostChecks(); + break; + case 108: + return $this->getPassiveHostChecksAreSoft(); + break; + case 109: + return $this->getEnablePredictiveHostDependencyChecks(); + break; + case 110: + return $this->getEnablePredictiveServiceDependencyChecks(); + break; + case 111: + return $this->getCachedHostCheckHorizon(); + break; + case 112: + return $this->getCachedServiceCheckHorizon(); + break; + case 113: + return $this->getUseLargeInstallationTweaks(); + break; + case 114: + return $this->getFreeChildProcessMemory(); + break; + case 115: + return $this->getChildProcessesForkTwice(); + break; + case 116: + return $this->getEnableEnvironmentMacros(); + break; + case 117: + return $this->getAdditionalFreshnessLatency(); + break; + case 118: + return $this->getEnableEmbeddedPerl(); + break; + case 119: + return $this->getUseEmbeddedPerlImplicitly(); + break; + case 120: + return $this->getP1File(); + break; + case 121: + return $this->getUseTimezone(); + break; + case 122: + return $this->getDebugFile(); + break; + case 123: + return $this->getDebugLevel(); + break; + case 124: + return $this->getDebugVerbosity(); + break; + case 125: + return $this->getMaxDebugFileSize(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosMainConfigurationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getConfigDir(), + $keys[2] => $this->getLogFile(), + $keys[3] => $this->getTempFile(), + $keys[4] => $this->getStatusFile(), + $keys[5] => $this->getStatusUpdateInterval(), + $keys[6] => $this->getNagiosUser(), + $keys[7] => $this->getNagiosGroup(), + $keys[8] => $this->getEnableNotifications(), + $keys[9] => $this->getExecuteServiceChecks(), + $keys[10] => $this->getAcceptPassiveServiceChecks(), + $keys[11] => $this->getEnableEventHandlers(), + $keys[12] => $this->getLogRotationMethod(), + $keys[13] => $this->getLogArchivePath(), + $keys[14] => $this->getCheckExternalCommands(), + $keys[15] => $this->getCommandCheckInterval(), + $keys[16] => $this->getCommandFile(), + $keys[17] => $this->getLockFile(), + $keys[18] => $this->getRetainStateInformation(), + $keys[19] => $this->getStateRetentionFile(), + $keys[20] => $this->getRetentionUpdateInterval(), + $keys[21] => $this->getUseRetainedProgramState(), + $keys[22] => $this->getUseSyslog(), + $keys[23] => $this->getLogNotifications(), + $keys[24] => $this->getLogServiceRetries(), + $keys[25] => $this->getLogHostRetries(), + $keys[26] => $this->getLogEventHandlers(), + $keys[27] => $this->getLogInitialStates(), + $keys[28] => $this->getLogExternalCommands(), + $keys[29] => $this->getLogPassiveChecks(), + $keys[30] => $this->getGlobalHostEventHandler(), + $keys[31] => $this->getGlobalServiceEventHandler(), + $keys[32] => $this->getExternalCommandBufferSlots(), + $keys[33] => $this->getSleepTime(), + $keys[34] => $this->getServiceInterleaveFactor(), + $keys[35] => $this->getMaxConcurrentChecks(), + $keys[36] => $this->getServiceReaperFrequency(), + $keys[37] => $this->getIntervalLength(), + $keys[38] => $this->getUseAggressiveHostChecking(), + $keys[39] => $this->getEnableFlapDetection(), + $keys[40] => $this->getLowServiceFlapThreshold(), + $keys[41] => $this->getHighServiceFlapThreshold(), + $keys[42] => $this->getLowHostFlapThreshold(), + $keys[43] => $this->getHighHostFlapThreshold(), + $keys[44] => $this->getSoftStateDependencies(), + $keys[45] => $this->getServiceCheckTimeout(), + $keys[46] => $this->getHostCheckTimeout(), + $keys[47] => $this->getEventHandlerTimeout(), + $keys[48] => $this->getNotificationTimeout(), + $keys[49] => $this->getOcspTimeout(), + $keys[50] => $this->getOhcpTimeout(), + $keys[51] => $this->getPerfdataTimeout(), + $keys[52] => $this->getObsessOverServices(), + $keys[53] => $this->getOcspCommand(), + $keys[54] => $this->getProcessPerformanceData(), + $keys[55] => $this->getCheckForOrphanedServices(), + $keys[56] => $this->getCheckServiceFreshness(), + $keys[57] => $this->getFreshnessCheckInterval(), + $keys[58] => $this->getDateFormat(), + $keys[59] => $this->getIllegalObjectNameChars(), + $keys[60] => $this->getIllegalMacroOutputChars(), + $keys[61] => $this->getAdminEmail(), + $keys[62] => $this->getAdminPager(), + $keys[63] => $this->getExecuteHostChecks(), + $keys[64] => $this->getServiceInterCheckDelayMethod(), + $keys[65] => $this->getUseRetainedSchedulingInfo(), + $keys[66] => $this->getAcceptPassiveHostChecks(), + $keys[67] => $this->getMaxServiceCheckSpread(), + $keys[68] => $this->getHostInterCheckDelayMethod(), + $keys[69] => $this->getMaxHostCheckSpread(), + $keys[70] => $this->getAutoRescheduleChecks(), + $keys[71] => $this->getAutoReschedulingInterval(), + $keys[72] => $this->getAutoReschedulingWindow(), + $keys[73] => $this->getOchpTimeout(), + $keys[74] => $this->getObsessOverHosts(), + $keys[75] => $this->getOchpCommand(), + $keys[76] => $this->getCheckHostFreshness(), + $keys[77] => $this->getHostFreshnessCheckInterval(), + $keys[78] => $this->getServiceFreshnessCheckInterval(), + $keys[79] => $this->getUseRegexpMatching(), + $keys[80] => $this->getUseTrueRegexpMatching(), + $keys[81] => $this->getEventBrokerOptions(), + $keys[82] => $this->getDaemonDumpsCore(), + $keys[83] => $this->getHostPerfdataCommand(), + $keys[84] => $this->getServicePerfdataCommand(), + $keys[85] => $this->getHostPerfdataFile(), + $keys[86] => $this->getHostPerfdataFileTemplate(), + $keys[87] => $this->getServicePerfdataFile(), + $keys[88] => $this->getServicePerfdataFileTemplate(), + $keys[89] => $this->getHostPerfdataFileMode(), + $keys[90] => $this->getServicePerfdataFileMode(), + $keys[91] => $this->getHostPerfdataFileProcessingCommand(), + $keys[92] => $this->getServicePerfdataFileProcessingCommand(), + $keys[93] => $this->getHostPerfdataFileProcessingInterval(), + $keys[94] => $this->getServicePerfdataFileProcessingInterval(), + $keys[95] => $this->getObjectCacheFile(), + $keys[96] => $this->getPrecachedObjectFile(), + $keys[97] => $this->getRetainedHostAttributeMask(), + $keys[98] => $this->getRetainedServiceAttributeMask(), + $keys[99] => $this->getRetainedProcessHostAttributeMask(), + $keys[100] => $this->getRetainedProcessServiceAttributeMask(), + $keys[101] => $this->getRetainedContactHostAttributeMask(), + $keys[102] => $this->getRetainedContactServiceAttributeMask(), + $keys[103] => $this->getCheckResultReaperFrequency(), + $keys[104] => $this->getMaxCheckResultReaperTime(), + $keys[105] => $this->getCheckResultPath(), + $keys[106] => $this->getMaxCheckResultFileAge(), + $keys[107] => $this->getTranslatePassiveHostChecks(), + $keys[108] => $this->getPassiveHostChecksAreSoft(), + $keys[109] => $this->getEnablePredictiveHostDependencyChecks(), + $keys[110] => $this->getEnablePredictiveServiceDependencyChecks(), + $keys[111] => $this->getCachedHostCheckHorizon(), + $keys[112] => $this->getCachedServiceCheckHorizon(), + $keys[113] => $this->getUseLargeInstallationTweaks(), + $keys[114] => $this->getFreeChildProcessMemory(), + $keys[115] => $this->getChildProcessesForkTwice(), + $keys[116] => $this->getEnableEnvironmentMacros(), + $keys[117] => $this->getAdditionalFreshnessLatency(), + $keys[118] => $this->getEnableEmbeddedPerl(), + $keys[119] => $this->getUseEmbeddedPerlImplicitly(), + $keys[120] => $this->getP1File(), + $keys[121] => $this->getUseTimezone(), + $keys[122] => $this->getDebugFile(), + $keys[123] => $this->getDebugLevel(), + $keys[124] => $this->getDebugVerbosity(), + $keys[125] => $this->getMaxDebugFileSize(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosMainConfigurationPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setConfigDir($value); + break; + case 2: + $this->setLogFile($value); + break; + case 3: + $this->setTempFile($value); + break; + case 4: + $this->setStatusFile($value); + break; + case 5: + $this->setStatusUpdateInterval($value); + break; + case 6: + $this->setNagiosUser($value); + break; + case 7: + $this->setNagiosGroup($value); + break; + case 8: + $this->setEnableNotifications($value); + break; + case 9: + $this->setExecuteServiceChecks($value); + break; + case 10: + $this->setAcceptPassiveServiceChecks($value); + break; + case 11: + $this->setEnableEventHandlers($value); + break; + case 12: + $this->setLogRotationMethod($value); + break; + case 13: + $this->setLogArchivePath($value); + break; + case 14: + $this->setCheckExternalCommands($value); + break; + case 15: + $this->setCommandCheckInterval($value); + break; + case 16: + $this->setCommandFile($value); + break; + case 17: + $this->setLockFile($value); + break; + case 18: + $this->setRetainStateInformation($value); + break; + case 19: + $this->setStateRetentionFile($value); + break; + case 20: + $this->setRetentionUpdateInterval($value); + break; + case 21: + $this->setUseRetainedProgramState($value); + break; + case 22: + $this->setUseSyslog($value); + break; + case 23: + $this->setLogNotifications($value); + break; + case 24: + $this->setLogServiceRetries($value); + break; + case 25: + $this->setLogHostRetries($value); + break; + case 26: + $this->setLogEventHandlers($value); + break; + case 27: + $this->setLogInitialStates($value); + break; + case 28: + $this->setLogExternalCommands($value); + break; + case 29: + $this->setLogPassiveChecks($value); + break; + case 30: + $this->setGlobalHostEventHandler($value); + break; + case 31: + $this->setGlobalServiceEventHandler($value); + break; + case 32: + $this->setExternalCommandBufferSlots($value); + break; + case 33: + $this->setSleepTime($value); + break; + case 34: + $this->setServiceInterleaveFactor($value); + break; + case 35: + $this->setMaxConcurrentChecks($value); + break; + case 36: + $this->setServiceReaperFrequency($value); + break; + case 37: + $this->setIntervalLength($value); + break; + case 38: + $this->setUseAggressiveHostChecking($value); + break; + case 39: + $this->setEnableFlapDetection($value); + break; + case 40: + $this->setLowServiceFlapThreshold($value); + break; + case 41: + $this->setHighServiceFlapThreshold($value); + break; + case 42: + $this->setLowHostFlapThreshold($value); + break; + case 43: + $this->setHighHostFlapThreshold($value); + break; + case 44: + $this->setSoftStateDependencies($value); + break; + case 45: + $this->setServiceCheckTimeout($value); + break; + case 46: + $this->setHostCheckTimeout($value); + break; + case 47: + $this->setEventHandlerTimeout($value); + break; + case 48: + $this->setNotificationTimeout($value); + break; + case 49: + $this->setOcspTimeout($value); + break; + case 50: + $this->setOhcpTimeout($value); + break; + case 51: + $this->setPerfdataTimeout($value); + break; + case 52: + $this->setObsessOverServices($value); + break; + case 53: + $this->setOcspCommand($value); + break; + case 54: + $this->setProcessPerformanceData($value); + break; + case 55: + $this->setCheckForOrphanedServices($value); + break; + case 56: + $this->setCheckServiceFreshness($value); + break; + case 57: + $this->setFreshnessCheckInterval($value); + break; + case 58: + $this->setDateFormat($value); + break; + case 59: + $this->setIllegalObjectNameChars($value); + break; + case 60: + $this->setIllegalMacroOutputChars($value); + break; + case 61: + $this->setAdminEmail($value); + break; + case 62: + $this->setAdminPager($value); + break; + case 63: + $this->setExecuteHostChecks($value); + break; + case 64: + $this->setServiceInterCheckDelayMethod($value); + break; + case 65: + $this->setUseRetainedSchedulingInfo($value); + break; + case 66: + $this->setAcceptPassiveHostChecks($value); + break; + case 67: + $this->setMaxServiceCheckSpread($value); + break; + case 68: + $this->setHostInterCheckDelayMethod($value); + break; + case 69: + $this->setMaxHostCheckSpread($value); + break; + case 70: + $this->setAutoRescheduleChecks($value); + break; + case 71: + $this->setAutoReschedulingInterval($value); + break; + case 72: + $this->setAutoReschedulingWindow($value); + break; + case 73: + $this->setOchpTimeout($value); + break; + case 74: + $this->setObsessOverHosts($value); + break; + case 75: + $this->setOchpCommand($value); + break; + case 76: + $this->setCheckHostFreshness($value); + break; + case 77: + $this->setHostFreshnessCheckInterval($value); + break; + case 78: + $this->setServiceFreshnessCheckInterval($value); + break; + case 79: + $this->setUseRegexpMatching($value); + break; + case 80: + $this->setUseTrueRegexpMatching($value); + break; + case 81: + $this->setEventBrokerOptions($value); + break; + case 82: + $this->setDaemonDumpsCore($value); + break; + case 83: + $this->setHostPerfdataCommand($value); + break; + case 84: + $this->setServicePerfdataCommand($value); + break; + case 85: + $this->setHostPerfdataFile($value); + break; + case 86: + $this->setHostPerfdataFileTemplate($value); + break; + case 87: + $this->setServicePerfdataFile($value); + break; + case 88: + $this->setServicePerfdataFileTemplate($value); + break; + case 89: + $this->setHostPerfdataFileMode($value); + break; + case 90: + $this->setServicePerfdataFileMode($value); + break; + case 91: + $this->setHostPerfdataFileProcessingCommand($value); + break; + case 92: + $this->setServicePerfdataFileProcessingCommand($value); + break; + case 93: + $this->setHostPerfdataFileProcessingInterval($value); + break; + case 94: + $this->setServicePerfdataFileProcessingInterval($value); + break; + case 95: + $this->setObjectCacheFile($value); + break; + case 96: + $this->setPrecachedObjectFile($value); + break; + case 97: + $this->setRetainedHostAttributeMask($value); + break; + case 98: + $this->setRetainedServiceAttributeMask($value); + break; + case 99: + $this->setRetainedProcessHostAttributeMask($value); + break; + case 100: + $this->setRetainedProcessServiceAttributeMask($value); + break; + case 101: + $this->setRetainedContactHostAttributeMask($value); + break; + case 102: + $this->setRetainedContactServiceAttributeMask($value); + break; + case 103: + $this->setCheckResultReaperFrequency($value); + break; + case 104: + $this->setMaxCheckResultReaperTime($value); + break; + case 105: + $this->setCheckResultPath($value); + break; + case 106: + $this->setMaxCheckResultFileAge($value); + break; + case 107: + $this->setTranslatePassiveHostChecks($value); + break; + case 108: + $this->setPassiveHostChecksAreSoft($value); + break; + case 109: + $this->setEnablePredictiveHostDependencyChecks($value); + break; + case 110: + $this->setEnablePredictiveServiceDependencyChecks($value); + break; + case 111: + $this->setCachedHostCheckHorizon($value); + break; + case 112: + $this->setCachedServiceCheckHorizon($value); + break; + case 113: + $this->setUseLargeInstallationTweaks($value); + break; + case 114: + $this->setFreeChildProcessMemory($value); + break; + case 115: + $this->setChildProcessesForkTwice($value); + break; + case 116: + $this->setEnableEnvironmentMacros($value); + break; + case 117: + $this->setAdditionalFreshnessLatency($value); + break; + case 118: + $this->setEnableEmbeddedPerl($value); + break; + case 119: + $this->setUseEmbeddedPerlImplicitly($value); + break; + case 120: + $this->setP1File($value); + break; + case 121: + $this->setUseTimezone($value); + break; + case 122: + $this->setDebugFile($value); + break; + case 123: + $this->setDebugLevel($value); + break; + case 124: + $this->setDebugVerbosity($value); + break; + case 125: + $this->setMaxDebugFileSize($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosMainConfigurationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setConfigDir($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setLogFile($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTempFile($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setStatusFile($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setStatusUpdateInterval($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setNagiosUser($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setNagiosGroup($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setEnableNotifications($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setExecuteServiceChecks($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setAcceptPassiveServiceChecks($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setEnableEventHandlers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setLogRotationMethod($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setLogArchivePath($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setCheckExternalCommands($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setCommandCheckInterval($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setCommandFile($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setLockFile($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setRetainStateInformation($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setStateRetentionFile($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setRetentionUpdateInterval($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setUseRetainedProgramState($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setUseSyslog($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setLogNotifications($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setLogServiceRetries($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setLogHostRetries($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setLogEventHandlers($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setLogInitialStates($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setLogExternalCommands($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setLogPassiveChecks($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setGlobalHostEventHandler($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setGlobalServiceEventHandler($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setExternalCommandBufferSlots($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setSleepTime($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setServiceInterleaveFactor($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setMaxConcurrentChecks($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setServiceReaperFrequency($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setIntervalLength($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setUseAggressiveHostChecking($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setEnableFlapDetection($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setLowServiceFlapThreshold($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setHighServiceFlapThreshold($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setLowHostFlapThreshold($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setHighHostFlapThreshold($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setSoftStateDependencies($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setServiceCheckTimeout($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setHostCheckTimeout($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setEventHandlerTimeout($arr[$keys[47]]); + if (array_key_exists($keys[48], $arr)) $this->setNotificationTimeout($arr[$keys[48]]); + if (array_key_exists($keys[49], $arr)) $this->setOcspTimeout($arr[$keys[49]]); + if (array_key_exists($keys[50], $arr)) $this->setOhcpTimeout($arr[$keys[50]]); + if (array_key_exists($keys[51], $arr)) $this->setPerfdataTimeout($arr[$keys[51]]); + if (array_key_exists($keys[52], $arr)) $this->setObsessOverServices($arr[$keys[52]]); + if (array_key_exists($keys[53], $arr)) $this->setOcspCommand($arr[$keys[53]]); + if (array_key_exists($keys[54], $arr)) $this->setProcessPerformanceData($arr[$keys[54]]); + if (array_key_exists($keys[55], $arr)) $this->setCheckForOrphanedServices($arr[$keys[55]]); + if (array_key_exists($keys[56], $arr)) $this->setCheckServiceFreshness($arr[$keys[56]]); + if (array_key_exists($keys[57], $arr)) $this->setFreshnessCheckInterval($arr[$keys[57]]); + if (array_key_exists($keys[58], $arr)) $this->setDateFormat($arr[$keys[58]]); + if (array_key_exists($keys[59], $arr)) $this->setIllegalObjectNameChars($arr[$keys[59]]); + if (array_key_exists($keys[60], $arr)) $this->setIllegalMacroOutputChars($arr[$keys[60]]); + if (array_key_exists($keys[61], $arr)) $this->setAdminEmail($arr[$keys[61]]); + if (array_key_exists($keys[62], $arr)) $this->setAdminPager($arr[$keys[62]]); + if (array_key_exists($keys[63], $arr)) $this->setExecuteHostChecks($arr[$keys[63]]); + if (array_key_exists($keys[64], $arr)) $this->setServiceInterCheckDelayMethod($arr[$keys[64]]); + if (array_key_exists($keys[65], $arr)) $this->setUseRetainedSchedulingInfo($arr[$keys[65]]); + if (array_key_exists($keys[66], $arr)) $this->setAcceptPassiveHostChecks($arr[$keys[66]]); + if (array_key_exists($keys[67], $arr)) $this->setMaxServiceCheckSpread($arr[$keys[67]]); + if (array_key_exists($keys[68], $arr)) $this->setHostInterCheckDelayMethod($arr[$keys[68]]); + if (array_key_exists($keys[69], $arr)) $this->setMaxHostCheckSpread($arr[$keys[69]]); + if (array_key_exists($keys[70], $arr)) $this->setAutoRescheduleChecks($arr[$keys[70]]); + if (array_key_exists($keys[71], $arr)) $this->setAutoReschedulingInterval($arr[$keys[71]]); + if (array_key_exists($keys[72], $arr)) $this->setAutoReschedulingWindow($arr[$keys[72]]); + if (array_key_exists($keys[73], $arr)) $this->setOchpTimeout($arr[$keys[73]]); + if (array_key_exists($keys[74], $arr)) $this->setObsessOverHosts($arr[$keys[74]]); + if (array_key_exists($keys[75], $arr)) $this->setOchpCommand($arr[$keys[75]]); + if (array_key_exists($keys[76], $arr)) $this->setCheckHostFreshness($arr[$keys[76]]); + if (array_key_exists($keys[77], $arr)) $this->setHostFreshnessCheckInterval($arr[$keys[77]]); + if (array_key_exists($keys[78], $arr)) $this->setServiceFreshnessCheckInterval($arr[$keys[78]]); + if (array_key_exists($keys[79], $arr)) $this->setUseRegexpMatching($arr[$keys[79]]); + if (array_key_exists($keys[80], $arr)) $this->setUseTrueRegexpMatching($arr[$keys[80]]); + if (array_key_exists($keys[81], $arr)) $this->setEventBrokerOptions($arr[$keys[81]]); + if (array_key_exists($keys[82], $arr)) $this->setDaemonDumpsCore($arr[$keys[82]]); + if (array_key_exists($keys[83], $arr)) $this->setHostPerfdataCommand($arr[$keys[83]]); + if (array_key_exists($keys[84], $arr)) $this->setServicePerfdataCommand($arr[$keys[84]]); + if (array_key_exists($keys[85], $arr)) $this->setHostPerfdataFile($arr[$keys[85]]); + if (array_key_exists($keys[86], $arr)) $this->setHostPerfdataFileTemplate($arr[$keys[86]]); + if (array_key_exists($keys[87], $arr)) $this->setServicePerfdataFile($arr[$keys[87]]); + if (array_key_exists($keys[88], $arr)) $this->setServicePerfdataFileTemplate($arr[$keys[88]]); + if (array_key_exists($keys[89], $arr)) $this->setHostPerfdataFileMode($arr[$keys[89]]); + if (array_key_exists($keys[90], $arr)) $this->setServicePerfdataFileMode($arr[$keys[90]]); + if (array_key_exists($keys[91], $arr)) $this->setHostPerfdataFileProcessingCommand($arr[$keys[91]]); + if (array_key_exists($keys[92], $arr)) $this->setServicePerfdataFileProcessingCommand($arr[$keys[92]]); + if (array_key_exists($keys[93], $arr)) $this->setHostPerfdataFileProcessingInterval($arr[$keys[93]]); + if (array_key_exists($keys[94], $arr)) $this->setServicePerfdataFileProcessingInterval($arr[$keys[94]]); + if (array_key_exists($keys[95], $arr)) $this->setObjectCacheFile($arr[$keys[95]]); + if (array_key_exists($keys[96], $arr)) $this->setPrecachedObjectFile($arr[$keys[96]]); + if (array_key_exists($keys[97], $arr)) $this->setRetainedHostAttributeMask($arr[$keys[97]]); + if (array_key_exists($keys[98], $arr)) $this->setRetainedServiceAttributeMask($arr[$keys[98]]); + if (array_key_exists($keys[99], $arr)) $this->setRetainedProcessHostAttributeMask($arr[$keys[99]]); + if (array_key_exists($keys[100], $arr)) $this->setRetainedProcessServiceAttributeMask($arr[$keys[100]]); + if (array_key_exists($keys[101], $arr)) $this->setRetainedContactHostAttributeMask($arr[$keys[101]]); + if (array_key_exists($keys[102], $arr)) $this->setRetainedContactServiceAttributeMask($arr[$keys[102]]); + if (array_key_exists($keys[103], $arr)) $this->setCheckResultReaperFrequency($arr[$keys[103]]); + if (array_key_exists($keys[104], $arr)) $this->setMaxCheckResultReaperTime($arr[$keys[104]]); + if (array_key_exists($keys[105], $arr)) $this->setCheckResultPath($arr[$keys[105]]); + if (array_key_exists($keys[106], $arr)) $this->setMaxCheckResultFileAge($arr[$keys[106]]); + if (array_key_exists($keys[107], $arr)) $this->setTranslatePassiveHostChecks($arr[$keys[107]]); + if (array_key_exists($keys[108], $arr)) $this->setPassiveHostChecksAreSoft($arr[$keys[108]]); + if (array_key_exists($keys[109], $arr)) $this->setEnablePredictiveHostDependencyChecks($arr[$keys[109]]); + if (array_key_exists($keys[110], $arr)) $this->setEnablePredictiveServiceDependencyChecks($arr[$keys[110]]); + if (array_key_exists($keys[111], $arr)) $this->setCachedHostCheckHorizon($arr[$keys[111]]); + if (array_key_exists($keys[112], $arr)) $this->setCachedServiceCheckHorizon($arr[$keys[112]]); + if (array_key_exists($keys[113], $arr)) $this->setUseLargeInstallationTweaks($arr[$keys[113]]); + if (array_key_exists($keys[114], $arr)) $this->setFreeChildProcessMemory($arr[$keys[114]]); + if (array_key_exists($keys[115], $arr)) $this->setChildProcessesForkTwice($arr[$keys[115]]); + if (array_key_exists($keys[116], $arr)) $this->setEnableEnvironmentMacros($arr[$keys[116]]); + if (array_key_exists($keys[117], $arr)) $this->setAdditionalFreshnessLatency($arr[$keys[117]]); + if (array_key_exists($keys[118], $arr)) $this->setEnableEmbeddedPerl($arr[$keys[118]]); + if (array_key_exists($keys[119], $arr)) $this->setUseEmbeddedPerlImplicitly($arr[$keys[119]]); + if (array_key_exists($keys[120], $arr)) $this->setP1File($arr[$keys[120]]); + if (array_key_exists($keys[121], $arr)) $this->setUseTimezone($arr[$keys[121]]); + if (array_key_exists($keys[122], $arr)) $this->setDebugFile($arr[$keys[122]]); + if (array_key_exists($keys[123], $arr)) $this->setDebugLevel($arr[$keys[123]]); + if (array_key_exists($keys[124], $arr)) $this->setDebugVerbosity($arr[$keys[124]]); + if (array_key_exists($keys[125], $arr)) $this->setMaxDebugFileSize($arr[$keys[125]]); + } + + /** + * 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(NagiosMainConfigurationPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosMainConfigurationPeer::ID)) $criteria->add(NagiosMainConfigurationPeer::ID, $this->id); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CONFIG_DIR)) $criteria->add(NagiosMainConfigurationPeer::CONFIG_DIR, $this->config_dir); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_FILE)) $criteria->add(NagiosMainConfigurationPeer::LOG_FILE, $this->log_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::TEMP_FILE)) $criteria->add(NagiosMainConfigurationPeer::TEMP_FILE, $this->temp_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::STATUS_FILE)) $criteria->add(NagiosMainConfigurationPeer::STATUS_FILE, $this->status_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::STATUS_UPDATE_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::STATUS_UPDATE_INTERVAL, $this->status_update_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::NAGIOS_USER)) $criteria->add(NagiosMainConfigurationPeer::NAGIOS_USER, $this->nagios_user); + if ($this->isColumnModified(NagiosMainConfigurationPeer::NAGIOS_GROUP)) $criteria->add(NagiosMainConfigurationPeer::NAGIOS_GROUP, $this->nagios_group); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_NOTIFICATIONS)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_NOTIFICATIONS, $this->enable_notifications); + if ($this->isColumnModified(NagiosMainConfigurationPeer::EXECUTE_SERVICE_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::EXECUTE_SERVICE_CHECKS, $this->execute_service_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_SERVICE_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_SERVICE_CHECKS, $this->accept_passive_service_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_EVENT_HANDLERS)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_EVENT_HANDLERS, $this->enable_event_handlers); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_ROTATION_METHOD)) $criteria->add(NagiosMainConfigurationPeer::LOG_ROTATION_METHOD, $this->log_rotation_method); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_ARCHIVE_PATH)) $criteria->add(NagiosMainConfigurationPeer::LOG_ARCHIVE_PATH, $this->log_archive_path); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_EXTERNAL_COMMANDS)) $criteria->add(NagiosMainConfigurationPeer::CHECK_EXTERNAL_COMMANDS, $this->check_external_commands); + if ($this->isColumnModified(NagiosMainConfigurationPeer::COMMAND_CHECK_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::COMMAND_CHECK_INTERVAL, $this->command_check_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::COMMAND_FILE)) $criteria->add(NagiosMainConfigurationPeer::COMMAND_FILE, $this->command_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOCK_FILE)) $criteria->add(NagiosMainConfigurationPeer::LOCK_FILE, $this->lock_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAIN_STATE_INFORMATION)) $criteria->add(NagiosMainConfigurationPeer::RETAIN_STATE_INFORMATION, $this->retain_state_information); + if ($this->isColumnModified(NagiosMainConfigurationPeer::STATE_RETENTION_FILE)) $criteria->add(NagiosMainConfigurationPeer::STATE_RETENTION_FILE, $this->state_retention_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETENTION_UPDATE_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::RETENTION_UPDATE_INTERVAL, $this->retention_update_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_RETAINED_PROGRAM_STATE)) $criteria->add(NagiosMainConfigurationPeer::USE_RETAINED_PROGRAM_STATE, $this->use_retained_program_state); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_SYSLOG)) $criteria->add(NagiosMainConfigurationPeer::USE_SYSLOG, $this->use_syslog); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_NOTIFICATIONS)) $criteria->add(NagiosMainConfigurationPeer::LOG_NOTIFICATIONS, $this->log_notifications); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_SERVICE_RETRIES)) $criteria->add(NagiosMainConfigurationPeer::LOG_SERVICE_RETRIES, $this->log_service_retries); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_HOST_RETRIES)) $criteria->add(NagiosMainConfigurationPeer::LOG_HOST_RETRIES, $this->log_host_retries); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_EVENT_HANDLERS)) $criteria->add(NagiosMainConfigurationPeer::LOG_EVENT_HANDLERS, $this->log_event_handlers); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_INITIAL_STATES)) $criteria->add(NagiosMainConfigurationPeer::LOG_INITIAL_STATES, $this->log_initial_states); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_EXTERNAL_COMMANDS)) $criteria->add(NagiosMainConfigurationPeer::LOG_EXTERNAL_COMMANDS, $this->log_external_commands); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOG_PASSIVE_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::LOG_PASSIVE_CHECKS, $this->log_passive_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER)) $criteria->add(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER, $this->global_host_event_handler); + if ($this->isColumnModified(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER)) $criteria->add(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER, $this->global_service_event_handler); + if ($this->isColumnModified(NagiosMainConfigurationPeer::EXTERNAL_COMMAND_BUFFER_SLOTS)) $criteria->add(NagiosMainConfigurationPeer::EXTERNAL_COMMAND_BUFFER_SLOTS, $this->external_command_buffer_slots); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SLEEP_TIME)) $criteria->add(NagiosMainConfigurationPeer::SLEEP_TIME, $this->sleep_time); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_INTERLEAVE_FACTOR)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_INTERLEAVE_FACTOR, $this->service_interleave_factor); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_CONCURRENT_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::MAX_CONCURRENT_CHECKS, $this->max_concurrent_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_REAPER_FREQUENCY)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_REAPER_FREQUENCY, $this->service_reaper_frequency); + if ($this->isColumnModified(NagiosMainConfigurationPeer::INTERVAL_LENGTH)) $criteria->add(NagiosMainConfigurationPeer::INTERVAL_LENGTH, $this->interval_length); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_AGGRESSIVE_HOST_CHECKING)) $criteria->add(NagiosMainConfigurationPeer::USE_AGGRESSIVE_HOST_CHECKING, $this->use_aggressive_host_checking); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_FLAP_DETECTION)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_FLAP_DETECTION, $this->enable_flap_detection); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOW_SERVICE_FLAP_THRESHOLD)) $criteria->add(NagiosMainConfigurationPeer::LOW_SERVICE_FLAP_THRESHOLD, $this->low_service_flap_threshold); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HIGH_SERVICE_FLAP_THRESHOLD)) $criteria->add(NagiosMainConfigurationPeer::HIGH_SERVICE_FLAP_THRESHOLD, $this->high_service_flap_threshold); + if ($this->isColumnModified(NagiosMainConfigurationPeer::LOW_HOST_FLAP_THRESHOLD)) $criteria->add(NagiosMainConfigurationPeer::LOW_HOST_FLAP_THRESHOLD, $this->low_host_flap_threshold); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HIGH_HOST_FLAP_THRESHOLD)) $criteria->add(NagiosMainConfigurationPeer::HIGH_HOST_FLAP_THRESHOLD, $this->high_host_flap_threshold); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SOFT_STATE_DEPENDENCIES)) $criteria->add(NagiosMainConfigurationPeer::SOFT_STATE_DEPENDENCIES, $this->soft_state_dependencies); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_CHECK_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_CHECK_TIMEOUT, $this->service_check_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_CHECK_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::HOST_CHECK_TIMEOUT, $this->host_check_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::EVENT_HANDLER_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::EVENT_HANDLER_TIMEOUT, $this->event_handler_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::NOTIFICATION_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::NOTIFICATION_TIMEOUT, $this->notification_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OCSP_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::OCSP_TIMEOUT, $this->ocsp_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OHCP_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::OHCP_TIMEOUT, $this->ohcp_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::PERFDATA_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::PERFDATA_TIMEOUT, $this->perfdata_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OBSESS_OVER_SERVICES)) $criteria->add(NagiosMainConfigurationPeer::OBSESS_OVER_SERVICES, $this->obsess_over_services); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OCSP_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::OCSP_COMMAND, $this->ocsp_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::PROCESS_PERFORMANCE_DATA)) $criteria->add(NagiosMainConfigurationPeer::PROCESS_PERFORMANCE_DATA, $this->process_performance_data); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_FOR_ORPHANED_SERVICES)) $criteria->add(NagiosMainConfigurationPeer::CHECK_FOR_ORPHANED_SERVICES, $this->check_for_orphaned_services); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_SERVICE_FRESHNESS)) $criteria->add(NagiosMainConfigurationPeer::CHECK_SERVICE_FRESHNESS, $this->check_service_freshness); + if ($this->isColumnModified(NagiosMainConfigurationPeer::FRESHNESS_CHECK_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::FRESHNESS_CHECK_INTERVAL, $this->freshness_check_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::DATE_FORMAT)) $criteria->add(NagiosMainConfigurationPeer::DATE_FORMAT, $this->date_format); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ILLEGAL_OBJECT_NAME_CHARS)) $criteria->add(NagiosMainConfigurationPeer::ILLEGAL_OBJECT_NAME_CHARS, $this->illegal_object_name_chars); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ILLEGAL_MACRO_OUTPUT_CHARS)) $criteria->add(NagiosMainConfigurationPeer::ILLEGAL_MACRO_OUTPUT_CHARS, $this->illegal_macro_output_chars); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ADMIN_EMAIL)) $criteria->add(NagiosMainConfigurationPeer::ADMIN_EMAIL, $this->admin_email); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ADMIN_PAGER)) $criteria->add(NagiosMainConfigurationPeer::ADMIN_PAGER, $this->admin_pager); + if ($this->isColumnModified(NagiosMainConfigurationPeer::EXECUTE_HOST_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::EXECUTE_HOST_CHECKS, $this->execute_host_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_INTER_CHECK_DELAY_METHOD)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_INTER_CHECK_DELAY_METHOD, $this->service_inter_check_delay_method); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_RETAINED_SCHEDULING_INFO)) $criteria->add(NagiosMainConfigurationPeer::USE_RETAINED_SCHEDULING_INFO, $this->use_retained_scheduling_info); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_HOST_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_HOST_CHECKS, $this->accept_passive_host_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_SERVICE_CHECK_SPREAD)) $criteria->add(NagiosMainConfigurationPeer::MAX_SERVICE_CHECK_SPREAD, $this->max_service_check_spread); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_INTER_CHECK_DELAY_METHOD)) $criteria->add(NagiosMainConfigurationPeer::HOST_INTER_CHECK_DELAY_METHOD, $this->host_inter_check_delay_method); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_HOST_CHECK_SPREAD)) $criteria->add(NagiosMainConfigurationPeer::MAX_HOST_CHECK_SPREAD, $this->max_host_check_spread); + if ($this->isColumnModified(NagiosMainConfigurationPeer::AUTO_RESCHEDULE_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::AUTO_RESCHEDULE_CHECKS, $this->auto_reschedule_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_INTERVAL, $this->auto_rescheduling_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_WINDOW)) $criteria->add(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_WINDOW, $this->auto_rescheduling_window); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OCHP_TIMEOUT)) $criteria->add(NagiosMainConfigurationPeer::OCHP_TIMEOUT, $this->ochp_timeout); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OBSESS_OVER_HOSTS)) $criteria->add(NagiosMainConfigurationPeer::OBSESS_OVER_HOSTS, $this->obsess_over_hosts); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OCHP_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::OCHP_COMMAND, $this->ochp_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_HOST_FRESHNESS)) $criteria->add(NagiosMainConfigurationPeer::CHECK_HOST_FRESHNESS, $this->check_host_freshness); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_FRESHNESS_CHECK_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::HOST_FRESHNESS_CHECK_INTERVAL, $this->host_freshness_check_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_FRESHNESS_CHECK_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_FRESHNESS_CHECK_INTERVAL, $this->service_freshness_check_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_REGEXP_MATCHING)) $criteria->add(NagiosMainConfigurationPeer::USE_REGEXP_MATCHING, $this->use_regexp_matching); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_TRUE_REGEXP_MATCHING)) $criteria->add(NagiosMainConfigurationPeer::USE_TRUE_REGEXP_MATCHING, $this->use_true_regexp_matching); + if ($this->isColumnModified(NagiosMainConfigurationPeer::EVENT_BROKER_OPTIONS)) $criteria->add(NagiosMainConfigurationPeer::EVENT_BROKER_OPTIONS, $this->event_broker_options); + if ($this->isColumnModified(NagiosMainConfigurationPeer::DAEMON_DUMPS_CORE)) $criteria->add(NagiosMainConfigurationPeer::DAEMON_DUMPS_CORE, $this->daemon_dumps_core); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND, $this->host_perfdata_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND, $this->service_perfdata_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE, $this->host_perfdata_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_TEMPLATE)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_TEMPLATE, $this->host_perfdata_file_template); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE, $this->service_perfdata_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_TEMPLATE)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_TEMPLATE, $this->service_perfdata_file_template); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_MODE)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_MODE, $this->host_perfdata_file_mode); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_MODE)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_MODE, $this->service_perfdata_file_mode); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND, $this->host_perfdata_file_processing_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, $this->service_perfdata_file_processing_command); + if ($this->isColumnModified(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_INTERVAL, $this->host_perfdata_file_processing_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL)) $criteria->add(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL, $this->service_perfdata_file_processing_interval); + if ($this->isColumnModified(NagiosMainConfigurationPeer::OBJECT_CACHE_FILE)) $criteria->add(NagiosMainConfigurationPeer::OBJECT_CACHE_FILE, $this->object_cache_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::PRECACHED_OBJECT_FILE)) $criteria->add(NagiosMainConfigurationPeer::PRECACHED_OBJECT_FILE, $this->precached_object_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_HOST_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_HOST_ATTRIBUTE_MASK, $this->retained_host_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_SERVICE_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_SERVICE_ATTRIBUTE_MASK, $this->retained_service_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK, $this->retained_process_host_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK, $this->retained_process_service_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK, $this->retained_contact_host_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK)) $criteria->add(NagiosMainConfigurationPeer::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK, $this->retained_contact_service_attribute_mask); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_RESULT_REAPER_FREQUENCY)) $criteria->add(NagiosMainConfigurationPeer::CHECK_RESULT_REAPER_FREQUENCY, $this->check_result_reaper_frequency); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_REAPER_TIME)) $criteria->add(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_REAPER_TIME, $this->max_check_result_reaper_time); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHECK_RESULT_PATH)) $criteria->add(NagiosMainConfigurationPeer::CHECK_RESULT_PATH, $this->check_result_path); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_FILE_AGE)) $criteria->add(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_FILE_AGE, $this->max_check_result_file_age); + if ($this->isColumnModified(NagiosMainConfigurationPeer::TRANSLATE_PASSIVE_HOST_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::TRANSLATE_PASSIVE_HOST_CHECKS, $this->translate_passive_host_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::PASSIVE_HOST_CHECKS_ARE_SOFT)) $criteria->add(NagiosMainConfigurationPeer::PASSIVE_HOST_CHECKS_ARE_SOFT, $this->passive_host_checks_are_soft); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS, $this->enable_predictive_host_dependency_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS, $this->enable_predictive_service_dependency_checks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CACHED_HOST_CHECK_HORIZON)) $criteria->add(NagiosMainConfigurationPeer::CACHED_HOST_CHECK_HORIZON, $this->cached_host_check_horizon); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CACHED_SERVICE_CHECK_HORIZON)) $criteria->add(NagiosMainConfigurationPeer::CACHED_SERVICE_CHECK_HORIZON, $this->cached_service_check_horizon); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_LARGE_INSTALLATION_TWEAKS)) $criteria->add(NagiosMainConfigurationPeer::USE_LARGE_INSTALLATION_TWEAKS, $this->use_large_installation_tweaks); + if ($this->isColumnModified(NagiosMainConfigurationPeer::FREE_CHILD_PROCESS_MEMORY)) $criteria->add(NagiosMainConfigurationPeer::FREE_CHILD_PROCESS_MEMORY, $this->free_child_process_memory); + if ($this->isColumnModified(NagiosMainConfigurationPeer::CHILD_PROCESSES_FORK_TWICE)) $criteria->add(NagiosMainConfigurationPeer::CHILD_PROCESSES_FORK_TWICE, $this->child_processes_fork_twice); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_ENVIRONMENT_MACROS)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_ENVIRONMENT_MACROS, $this->enable_environment_macros); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ADDITIONAL_FRESHNESS_LATENCY)) $criteria->add(NagiosMainConfigurationPeer::ADDITIONAL_FRESHNESS_LATENCY, $this->additional_freshness_latency); + if ($this->isColumnModified(NagiosMainConfigurationPeer::ENABLE_EMBEDDED_PERL)) $criteria->add(NagiosMainConfigurationPeer::ENABLE_EMBEDDED_PERL, $this->enable_embedded_perl); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_EMBEDDED_PERL_IMPLICITLY)) $criteria->add(NagiosMainConfigurationPeer::USE_EMBEDDED_PERL_IMPLICITLY, $this->use_embedded_perl_implicitly); + if ($this->isColumnModified(NagiosMainConfigurationPeer::P1_FILE)) $criteria->add(NagiosMainConfigurationPeer::P1_FILE, $this->p1_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::USE_TIMEZONE)) $criteria->add(NagiosMainConfigurationPeer::USE_TIMEZONE, $this->use_timezone); + if ($this->isColumnModified(NagiosMainConfigurationPeer::DEBUG_FILE)) $criteria->add(NagiosMainConfigurationPeer::DEBUG_FILE, $this->debug_file); + if ($this->isColumnModified(NagiosMainConfigurationPeer::DEBUG_LEVEL)) $criteria->add(NagiosMainConfigurationPeer::DEBUG_LEVEL, $this->debug_level); + if ($this->isColumnModified(NagiosMainConfigurationPeer::DEBUG_VERBOSITY)) $criteria->add(NagiosMainConfigurationPeer::DEBUG_VERBOSITY, $this->debug_verbosity); + if ($this->isColumnModified(NagiosMainConfigurationPeer::MAX_DEBUG_FILE_SIZE)) $criteria->add(NagiosMainConfigurationPeer::MAX_DEBUG_FILE_SIZE, $this->max_debug_file_size); + + 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(NagiosMainConfigurationPeer::DATABASE_NAME); + + $criteria->add(NagiosMainConfigurationPeer::ID, $this->id); + + 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 NagiosMainConfiguration (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) + { + + $copyObj->setConfigDir($this->config_dir); + + $copyObj->setLogFile($this->log_file); + + $copyObj->setTempFile($this->temp_file); + + $copyObj->setStatusFile($this->status_file); + + $copyObj->setStatusUpdateInterval($this->status_update_interval); + + $copyObj->setNagiosUser($this->nagios_user); + + $copyObj->setNagiosGroup($this->nagios_group); + + $copyObj->setEnableNotifications($this->enable_notifications); + + $copyObj->setExecuteServiceChecks($this->execute_service_checks); + + $copyObj->setAcceptPassiveServiceChecks($this->accept_passive_service_checks); + + $copyObj->setEnableEventHandlers($this->enable_event_handlers); + + $copyObj->setLogRotationMethod($this->log_rotation_method); + + $copyObj->setLogArchivePath($this->log_archive_path); + + $copyObj->setCheckExternalCommands($this->check_external_commands); + + $copyObj->setCommandCheckInterval($this->command_check_interval); + + $copyObj->setCommandFile($this->command_file); + + $copyObj->setLockFile($this->lock_file); + + $copyObj->setRetainStateInformation($this->retain_state_information); + + $copyObj->setStateRetentionFile($this->state_retention_file); + + $copyObj->setRetentionUpdateInterval($this->retention_update_interval); + + $copyObj->setUseRetainedProgramState($this->use_retained_program_state); + + $copyObj->setUseSyslog($this->use_syslog); + + $copyObj->setLogNotifications($this->log_notifications); + + $copyObj->setLogServiceRetries($this->log_service_retries); + + $copyObj->setLogHostRetries($this->log_host_retries); + + $copyObj->setLogEventHandlers($this->log_event_handlers); + + $copyObj->setLogInitialStates($this->log_initial_states); + + $copyObj->setLogExternalCommands($this->log_external_commands); + + $copyObj->setLogPassiveChecks($this->log_passive_checks); + + $copyObj->setGlobalHostEventHandler($this->global_host_event_handler); + + $copyObj->setGlobalServiceEventHandler($this->global_service_event_handler); + + $copyObj->setExternalCommandBufferSlots($this->external_command_buffer_slots); + + $copyObj->setSleepTime($this->sleep_time); + + $copyObj->setServiceInterleaveFactor($this->service_interleave_factor); + + $copyObj->setMaxConcurrentChecks($this->max_concurrent_checks); + + $copyObj->setServiceReaperFrequency($this->service_reaper_frequency); + + $copyObj->setIntervalLength($this->interval_length); + + $copyObj->setUseAggressiveHostChecking($this->use_aggressive_host_checking); + + $copyObj->setEnableFlapDetection($this->enable_flap_detection); + + $copyObj->setLowServiceFlapThreshold($this->low_service_flap_threshold); + + $copyObj->setHighServiceFlapThreshold($this->high_service_flap_threshold); + + $copyObj->setLowHostFlapThreshold($this->low_host_flap_threshold); + + $copyObj->setHighHostFlapThreshold($this->high_host_flap_threshold); + + $copyObj->setSoftStateDependencies($this->soft_state_dependencies); + + $copyObj->setServiceCheckTimeout($this->service_check_timeout); + + $copyObj->setHostCheckTimeout($this->host_check_timeout); + + $copyObj->setEventHandlerTimeout($this->event_handler_timeout); + + $copyObj->setNotificationTimeout($this->notification_timeout); + + $copyObj->setOcspTimeout($this->ocsp_timeout); + + $copyObj->setOhcpTimeout($this->ohcp_timeout); + + $copyObj->setPerfdataTimeout($this->perfdata_timeout); + + $copyObj->setObsessOverServices($this->obsess_over_services); + + $copyObj->setOcspCommand($this->ocsp_command); + + $copyObj->setProcessPerformanceData($this->process_performance_data); + + $copyObj->setCheckForOrphanedServices($this->check_for_orphaned_services); + + $copyObj->setCheckServiceFreshness($this->check_service_freshness); + + $copyObj->setFreshnessCheckInterval($this->freshness_check_interval); + + $copyObj->setDateFormat($this->date_format); + + $copyObj->setIllegalObjectNameChars($this->illegal_object_name_chars); + + $copyObj->setIllegalMacroOutputChars($this->illegal_macro_output_chars); + + $copyObj->setAdminEmail($this->admin_email); + + $copyObj->setAdminPager($this->admin_pager); + + $copyObj->setExecuteHostChecks($this->execute_host_checks); + + $copyObj->setServiceInterCheckDelayMethod($this->service_inter_check_delay_method); + + $copyObj->setUseRetainedSchedulingInfo($this->use_retained_scheduling_info); + + $copyObj->setAcceptPassiveHostChecks($this->accept_passive_host_checks); + + $copyObj->setMaxServiceCheckSpread($this->max_service_check_spread); + + $copyObj->setHostInterCheckDelayMethod($this->host_inter_check_delay_method); + + $copyObj->setMaxHostCheckSpread($this->max_host_check_spread); + + $copyObj->setAutoRescheduleChecks($this->auto_reschedule_checks); + + $copyObj->setAutoReschedulingInterval($this->auto_rescheduling_interval); + + $copyObj->setAutoReschedulingWindow($this->auto_rescheduling_window); + + $copyObj->setOchpTimeout($this->ochp_timeout); + + $copyObj->setObsessOverHosts($this->obsess_over_hosts); + + $copyObj->setOchpCommand($this->ochp_command); + + $copyObj->setCheckHostFreshness($this->check_host_freshness); + + $copyObj->setHostFreshnessCheckInterval($this->host_freshness_check_interval); + + $copyObj->setServiceFreshnessCheckInterval($this->service_freshness_check_interval); + + $copyObj->setUseRegexpMatching($this->use_regexp_matching); + + $copyObj->setUseTrueRegexpMatching($this->use_true_regexp_matching); + + $copyObj->setEventBrokerOptions($this->event_broker_options); + + $copyObj->setDaemonDumpsCore($this->daemon_dumps_core); + + $copyObj->setHostPerfdataCommand($this->host_perfdata_command); + + $copyObj->setServicePerfdataCommand($this->service_perfdata_command); + + $copyObj->setHostPerfdataFile($this->host_perfdata_file); + + $copyObj->setHostPerfdataFileTemplate($this->host_perfdata_file_template); + + $copyObj->setServicePerfdataFile($this->service_perfdata_file); + + $copyObj->setServicePerfdataFileTemplate($this->service_perfdata_file_template); + + $copyObj->setHostPerfdataFileMode($this->host_perfdata_file_mode); + + $copyObj->setServicePerfdataFileMode($this->service_perfdata_file_mode); + + $copyObj->setHostPerfdataFileProcessingCommand($this->host_perfdata_file_processing_command); + + $copyObj->setServicePerfdataFileProcessingCommand($this->service_perfdata_file_processing_command); + + $copyObj->setHostPerfdataFileProcessingInterval($this->host_perfdata_file_processing_interval); + + $copyObj->setServicePerfdataFileProcessingInterval($this->service_perfdata_file_processing_interval); + + $copyObj->setObjectCacheFile($this->object_cache_file); + + $copyObj->setPrecachedObjectFile($this->precached_object_file); + + $copyObj->setRetainedHostAttributeMask($this->retained_host_attribute_mask); + + $copyObj->setRetainedServiceAttributeMask($this->retained_service_attribute_mask); + + $copyObj->setRetainedProcessHostAttributeMask($this->retained_process_host_attribute_mask); + + $copyObj->setRetainedProcessServiceAttributeMask($this->retained_process_service_attribute_mask); + + $copyObj->setRetainedContactHostAttributeMask($this->retained_contact_host_attribute_mask); + + $copyObj->setRetainedContactServiceAttributeMask($this->retained_contact_service_attribute_mask); + + $copyObj->setCheckResultReaperFrequency($this->check_result_reaper_frequency); + + $copyObj->setMaxCheckResultReaperTime($this->max_check_result_reaper_time); + + $copyObj->setCheckResultPath($this->check_result_path); + + $copyObj->setMaxCheckResultFileAge($this->max_check_result_file_age); + + $copyObj->setTranslatePassiveHostChecks($this->translate_passive_host_checks); + + $copyObj->setPassiveHostChecksAreSoft($this->passive_host_checks_are_soft); + + $copyObj->setEnablePredictiveHostDependencyChecks($this->enable_predictive_host_dependency_checks); + + $copyObj->setEnablePredictiveServiceDependencyChecks($this->enable_predictive_service_dependency_checks); + + $copyObj->setCachedHostCheckHorizon($this->cached_host_check_horizon); + + $copyObj->setCachedServiceCheckHorizon($this->cached_service_check_horizon); + + $copyObj->setUseLargeInstallationTweaks($this->use_large_installation_tweaks); + + $copyObj->setFreeChildProcessMemory($this->free_child_process_memory); + + $copyObj->setChildProcessesForkTwice($this->child_processes_fork_twice); + + $copyObj->setEnableEnvironmentMacros($this->enable_environment_macros); + + $copyObj->setAdditionalFreshnessLatency($this->additional_freshness_latency); + + $copyObj->setEnableEmbeddedPerl($this->enable_embedded_perl); + + $copyObj->setUseEmbeddedPerlImplicitly($this->use_embedded_perl_implicitly); + + $copyObj->setP1File($this->p1_file); + + $copyObj->setUseTimezone($this->use_timezone); + + $copyObj->setDebugFile($this->debug_file); + + $copyObj->setDebugLevel($this->debug_level); + + $copyObj->setDebugVerbosity($this->debug_verbosity); + + $copyObj->setMaxDebugFileSize($this->max_debug_file_size); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosMainConfiguration 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); + $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 NagiosMainConfigurationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosMainConfigurationPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByOcspCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setOcspCommand(NULL); + } else { + $this->setOcspCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByOcspCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByOcspCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByOcspCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByOcspCommand === null && ($this->ocsp_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->ocsp_command); + $this->aNagiosCommandRelatedByOcspCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByOcspCommand->addNagiosMainConfigurationsRelatedByOcspCommand($this); + */ + } + return $this->aNagiosCommandRelatedByOcspCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByOchpCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setOchpCommand(NULL); + } else { + $this->setOchpCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByOchpCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByOchpCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByOchpCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByOchpCommand === null && ($this->ochp_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->ochp_command); + $this->aNagiosCommandRelatedByOchpCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByOchpCommand->addNagiosMainConfigurationsRelatedByOchpCommand($this); + */ + } + return $this->aNagiosCommandRelatedByOchpCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByHostPerfdataCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setHostPerfdataCommand(NULL); + } else { + $this->setHostPerfdataCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByHostPerfdataCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByHostPerfdataCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByHostPerfdataCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByHostPerfdataCommand === null && ($this->host_perfdata_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->host_perfdata_command); + $this->aNagiosCommandRelatedByHostPerfdataCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByHostPerfdataCommand->addNagiosMainConfigurationsRelatedByHostPerfdataCommand($this); + */ + } + return $this->aNagiosCommandRelatedByHostPerfdataCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByServicePerfdataCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setServicePerfdataCommand(NULL); + } else { + $this->setServicePerfdataCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByServicePerfdataCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByServicePerfdataCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByServicePerfdataCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByServicePerfdataCommand === null && ($this->service_perfdata_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->service_perfdata_command); + $this->aNagiosCommandRelatedByServicePerfdataCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByServicePerfdataCommand->addNagiosMainConfigurationsRelatedByServicePerfdataCommand($this); + */ + } + return $this->aNagiosCommandRelatedByServicePerfdataCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByHostPerfdataFileProcessingCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setHostPerfdataFileProcessingCommand(NULL); + } else { + $this->setHostPerfdataFileProcessingCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByHostPerfdataFileProcessingCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand === null && ($this->host_perfdata_file_processing_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->host_perfdata_file_processing_command); + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand->addNagiosMainConfigurationsRelatedByHostPerfdataFileProcessingCommand($this); + */ + } + return $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByServicePerfdataFileProcessingCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setServicePerfdataFileProcessingCommand(NULL); + } else { + $this->setServicePerfdataFileProcessingCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByServicePerfdataFileProcessingCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand === null && ($this->service_perfdata_file_processing_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->service_perfdata_file_processing_command); + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand->addNagiosMainConfigurationsRelatedByServicePerfdataFileProcessingCommand($this); + */ + } + return $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByGlobalServiceEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setGlobalServiceEventHandler(NULL); + } else { + $this->setGlobalServiceEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByGlobalServiceEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByGlobalServiceEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByGlobalServiceEventHandler === null && ($this->global_service_event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->global_service_event_handler); + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByGlobalServiceEventHandler->addNagiosMainConfigurationsRelatedByGlobalServiceEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByGlobalServiceEventHandler; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosMainConfiguration The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByGlobalHostEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setGlobalHostEventHandler(NULL); + } else { + $this->setGlobalHostEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByGlobalHostEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosMainConfigurationRelatedByGlobalHostEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByGlobalHostEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByGlobalHostEventHandler === null && ($this->global_host_event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->global_host_event_handler); + $this->aNagiosCommandRelatedByGlobalHostEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByGlobalHostEventHandler->addNagiosMainConfigurationsRelatedByGlobalHostEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByGlobalHostEventHandler; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosCommandRelatedByOcspCommand = null; + $this->aNagiosCommandRelatedByOchpCommand = null; + $this->aNagiosCommandRelatedByHostPerfdataCommand = null; + $this->aNagiosCommandRelatedByServicePerfdataCommand = null; + $this->aNagiosCommandRelatedByHostPerfdataFileProcessingCommand = null; + $this->aNagiosCommandRelatedByServicePerfdataFileProcessingCommand = null; + $this->aNagiosCommandRelatedByGlobalServiceEventHandler = null; + $this->aNagiosCommandRelatedByGlobalHostEventHandler = null; + } + +} // BaseNagiosMainConfiguration diff --git a/classes/om/BaseNagiosMainConfigurationPeer.php b/classes/om/BaseNagiosMainConfigurationPeer.php new file mode 100755 index 0000000..56ae22a --- /dev/null +++ b/classes/om/BaseNagiosMainConfigurationPeer.php @@ -0,0 +1,3313 @@ + array ('Id', 'ConfigDir', 'LogFile', 'TempFile', 'StatusFile', 'StatusUpdateInterval', 'NagiosUser', 'NagiosGroup', 'EnableNotifications', 'ExecuteServiceChecks', 'AcceptPassiveServiceChecks', 'EnableEventHandlers', 'LogRotationMethod', 'LogArchivePath', 'CheckExternalCommands', 'CommandCheckInterval', 'CommandFile', 'LockFile', 'RetainStateInformation', 'StateRetentionFile', 'RetentionUpdateInterval', 'UseRetainedProgramState', 'UseSyslog', 'LogNotifications', 'LogServiceRetries', 'LogHostRetries', 'LogEventHandlers', 'LogInitialStates', 'LogExternalCommands', 'LogPassiveChecks', 'GlobalHostEventHandler', 'GlobalServiceEventHandler', 'ExternalCommandBufferSlots', 'SleepTime', 'ServiceInterleaveFactor', 'MaxConcurrentChecks', 'ServiceReaperFrequency', 'IntervalLength', 'UseAggressiveHostChecking', 'EnableFlapDetection', 'LowServiceFlapThreshold', 'HighServiceFlapThreshold', 'LowHostFlapThreshold', 'HighHostFlapThreshold', 'SoftStateDependencies', 'ServiceCheckTimeout', 'HostCheckTimeout', 'EventHandlerTimeout', 'NotificationTimeout', 'OcspTimeout', 'OhcpTimeout', 'PerfdataTimeout', 'ObsessOverServices', 'OcspCommand', 'ProcessPerformanceData', 'CheckForOrphanedServices', 'CheckServiceFreshness', 'FreshnessCheckInterval', 'DateFormat', 'IllegalObjectNameChars', 'IllegalMacroOutputChars', 'AdminEmail', 'AdminPager', 'ExecuteHostChecks', 'ServiceInterCheckDelayMethod', 'UseRetainedSchedulingInfo', 'AcceptPassiveHostChecks', 'MaxServiceCheckSpread', 'HostInterCheckDelayMethod', 'MaxHostCheckSpread', 'AutoRescheduleChecks', 'AutoReschedulingInterval', 'AutoReschedulingWindow', 'OchpTimeout', 'ObsessOverHosts', 'OchpCommand', 'CheckHostFreshness', 'HostFreshnessCheckInterval', 'ServiceFreshnessCheckInterval', 'UseRegexpMatching', 'UseTrueRegexpMatching', 'EventBrokerOptions', 'DaemonDumpsCore', 'HostPerfdataCommand', 'ServicePerfdataCommand', 'HostPerfdataFile', 'HostPerfdataFileTemplate', 'ServicePerfdataFile', 'ServicePerfdataFileTemplate', 'HostPerfdataFileMode', 'ServicePerfdataFileMode', 'HostPerfdataFileProcessingCommand', 'ServicePerfdataFileProcessingCommand', 'HostPerfdataFileProcessingInterval', 'ServicePerfdataFileProcessingInterval', 'ObjectCacheFile', 'PrecachedObjectFile', 'RetainedHostAttributeMask', 'RetainedServiceAttributeMask', 'RetainedProcessHostAttributeMask', 'RetainedProcessServiceAttributeMask', 'RetainedContactHostAttributeMask', 'RetainedContactServiceAttributeMask', 'CheckResultReaperFrequency', 'MaxCheckResultReaperTime', 'CheckResultPath', 'MaxCheckResultFileAge', 'TranslatePassiveHostChecks', 'PassiveHostChecksAreSoft', 'EnablePredictiveHostDependencyChecks', 'EnablePredictiveServiceDependencyChecks', 'CachedHostCheckHorizon', 'CachedServiceCheckHorizon', 'UseLargeInstallationTweaks', 'FreeChildProcessMemory', 'ChildProcessesForkTwice', 'EnableEnvironmentMacros', 'AdditionalFreshnessLatency', 'EnableEmbeddedPerl', 'UseEmbeddedPerlImplicitly', 'P1File', 'UseTimezone', 'DebugFile', 'DebugLevel', 'DebugVerbosity', 'MaxDebugFileSize', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'configDir', 'logFile', 'tempFile', 'statusFile', 'statusUpdateInterval', 'nagiosUser', 'nagiosGroup', 'enableNotifications', 'executeServiceChecks', 'acceptPassiveServiceChecks', 'enableEventHandlers', 'logRotationMethod', 'logArchivePath', 'checkExternalCommands', 'commandCheckInterval', 'commandFile', 'lockFile', 'retainStateInformation', 'stateRetentionFile', 'retentionUpdateInterval', 'useRetainedProgramState', 'useSyslog', 'logNotifications', 'logServiceRetries', 'logHostRetries', 'logEventHandlers', 'logInitialStates', 'logExternalCommands', 'logPassiveChecks', 'globalHostEventHandler', 'globalServiceEventHandler', 'externalCommandBufferSlots', 'sleepTime', 'serviceInterleaveFactor', 'maxConcurrentChecks', 'serviceReaperFrequency', 'intervalLength', 'useAggressiveHostChecking', 'enableFlapDetection', 'lowServiceFlapThreshold', 'highServiceFlapThreshold', 'lowHostFlapThreshold', 'highHostFlapThreshold', 'softStateDependencies', 'serviceCheckTimeout', 'hostCheckTimeout', 'eventHandlerTimeout', 'notificationTimeout', 'ocspTimeout', 'ohcpTimeout', 'perfdataTimeout', 'obsessOverServices', 'ocspCommand', 'processPerformanceData', 'checkForOrphanedServices', 'checkServiceFreshness', 'freshnessCheckInterval', 'dateFormat', 'illegalObjectNameChars', 'illegalMacroOutputChars', 'adminEmail', 'adminPager', 'executeHostChecks', 'serviceInterCheckDelayMethod', 'useRetainedSchedulingInfo', 'acceptPassiveHostChecks', 'maxServiceCheckSpread', 'hostInterCheckDelayMethod', 'maxHostCheckSpread', 'autoRescheduleChecks', 'autoReschedulingInterval', 'autoReschedulingWindow', 'ochpTimeout', 'obsessOverHosts', 'ochpCommand', 'checkHostFreshness', 'hostFreshnessCheckInterval', 'serviceFreshnessCheckInterval', 'useRegexpMatching', 'useTrueRegexpMatching', 'eventBrokerOptions', 'daemonDumpsCore', 'hostPerfdataCommand', 'servicePerfdataCommand', 'hostPerfdataFile', 'hostPerfdataFileTemplate', 'servicePerfdataFile', 'servicePerfdataFileTemplate', 'hostPerfdataFileMode', 'servicePerfdataFileMode', 'hostPerfdataFileProcessingCommand', 'servicePerfdataFileProcessingCommand', 'hostPerfdataFileProcessingInterval', 'servicePerfdataFileProcessingInterval', 'objectCacheFile', 'precachedObjectFile', 'retainedHostAttributeMask', 'retainedServiceAttributeMask', 'retainedProcessHostAttributeMask', 'retainedProcessServiceAttributeMask', 'retainedContactHostAttributeMask', 'retainedContactServiceAttributeMask', 'checkResultReaperFrequency', 'maxCheckResultReaperTime', 'checkResultPath', 'maxCheckResultFileAge', 'translatePassiveHostChecks', 'passiveHostChecksAreSoft', 'enablePredictiveHostDependencyChecks', 'enablePredictiveServiceDependencyChecks', 'cachedHostCheckHorizon', 'cachedServiceCheckHorizon', 'useLargeInstallationTweaks', 'freeChildProcessMemory', 'childProcessesForkTwice', 'enableEnvironmentMacros', 'additionalFreshnessLatency', 'enableEmbeddedPerl', 'useEmbeddedPerlImplicitly', 'p1File', 'useTimezone', 'debugFile', 'debugLevel', 'debugVerbosity', 'maxDebugFileSize', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::CONFIG_DIR, self::LOG_FILE, self::TEMP_FILE, self::STATUS_FILE, self::STATUS_UPDATE_INTERVAL, self::NAGIOS_USER, self::NAGIOS_GROUP, self::ENABLE_NOTIFICATIONS, self::EXECUTE_SERVICE_CHECKS, self::ACCEPT_PASSIVE_SERVICE_CHECKS, self::ENABLE_EVENT_HANDLERS, self::LOG_ROTATION_METHOD, self::LOG_ARCHIVE_PATH, self::CHECK_EXTERNAL_COMMANDS, self::COMMAND_CHECK_INTERVAL, self::COMMAND_FILE, self::LOCK_FILE, self::RETAIN_STATE_INFORMATION, self::STATE_RETENTION_FILE, self::RETENTION_UPDATE_INTERVAL, self::USE_RETAINED_PROGRAM_STATE, self::USE_SYSLOG, self::LOG_NOTIFICATIONS, self::LOG_SERVICE_RETRIES, self::LOG_HOST_RETRIES, self::LOG_EVENT_HANDLERS, self::LOG_INITIAL_STATES, self::LOG_EXTERNAL_COMMANDS, self::LOG_PASSIVE_CHECKS, self::GLOBAL_HOST_EVENT_HANDLER, self::GLOBAL_SERVICE_EVENT_HANDLER, self::EXTERNAL_COMMAND_BUFFER_SLOTS, self::SLEEP_TIME, self::SERVICE_INTERLEAVE_FACTOR, self::MAX_CONCURRENT_CHECKS, self::SERVICE_REAPER_FREQUENCY, self::INTERVAL_LENGTH, self::USE_AGGRESSIVE_HOST_CHECKING, self::ENABLE_FLAP_DETECTION, self::LOW_SERVICE_FLAP_THRESHOLD, self::HIGH_SERVICE_FLAP_THRESHOLD, self::LOW_HOST_FLAP_THRESHOLD, self::HIGH_HOST_FLAP_THRESHOLD, self::SOFT_STATE_DEPENDENCIES, self::SERVICE_CHECK_TIMEOUT, self::HOST_CHECK_TIMEOUT, self::EVENT_HANDLER_TIMEOUT, self::NOTIFICATION_TIMEOUT, self::OCSP_TIMEOUT, self::OHCP_TIMEOUT, self::PERFDATA_TIMEOUT, self::OBSESS_OVER_SERVICES, self::OCSP_COMMAND, self::PROCESS_PERFORMANCE_DATA, self::CHECK_FOR_ORPHANED_SERVICES, self::CHECK_SERVICE_FRESHNESS, self::FRESHNESS_CHECK_INTERVAL, self::DATE_FORMAT, self::ILLEGAL_OBJECT_NAME_CHARS, self::ILLEGAL_MACRO_OUTPUT_CHARS, self::ADMIN_EMAIL, self::ADMIN_PAGER, self::EXECUTE_HOST_CHECKS, self::SERVICE_INTER_CHECK_DELAY_METHOD, self::USE_RETAINED_SCHEDULING_INFO, self::ACCEPT_PASSIVE_HOST_CHECKS, self::MAX_SERVICE_CHECK_SPREAD, self::HOST_INTER_CHECK_DELAY_METHOD, self::MAX_HOST_CHECK_SPREAD, self::AUTO_RESCHEDULE_CHECKS, self::AUTO_RESCHEDULING_INTERVAL, self::AUTO_RESCHEDULING_WINDOW, self::OCHP_TIMEOUT, self::OBSESS_OVER_HOSTS, self::OCHP_COMMAND, self::CHECK_HOST_FRESHNESS, self::HOST_FRESHNESS_CHECK_INTERVAL, self::SERVICE_FRESHNESS_CHECK_INTERVAL, self::USE_REGEXP_MATCHING, self::USE_TRUE_REGEXP_MATCHING, self::EVENT_BROKER_OPTIONS, self::DAEMON_DUMPS_CORE, self::HOST_PERFDATA_COMMAND, self::SERVICE_PERFDATA_COMMAND, self::HOST_PERFDATA_FILE, self::HOST_PERFDATA_FILE_TEMPLATE, self::SERVICE_PERFDATA_FILE, self::SERVICE_PERFDATA_FILE_TEMPLATE, self::HOST_PERFDATA_FILE_MODE, self::SERVICE_PERFDATA_FILE_MODE, self::HOST_PERFDATA_FILE_PROCESSING_COMMAND, self::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND, self::HOST_PERFDATA_FILE_PROCESSING_INTERVAL, self::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL, self::OBJECT_CACHE_FILE, self::PRECACHED_OBJECT_FILE, self::RETAINED_HOST_ATTRIBUTE_MASK, self::RETAINED_SERVICE_ATTRIBUTE_MASK, self::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK, self::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK, self::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK, self::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK, self::CHECK_RESULT_REAPER_FREQUENCY, self::MAX_CHECK_RESULT_REAPER_TIME, self::CHECK_RESULT_PATH, self::MAX_CHECK_RESULT_FILE_AGE, self::TRANSLATE_PASSIVE_HOST_CHECKS, self::PASSIVE_HOST_CHECKS_ARE_SOFT, self::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS, self::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS, self::CACHED_HOST_CHECK_HORIZON, self::CACHED_SERVICE_CHECK_HORIZON, self::USE_LARGE_INSTALLATION_TWEAKS, self::FREE_CHILD_PROCESS_MEMORY, self::CHILD_PROCESSES_FORK_TWICE, self::ENABLE_ENVIRONMENT_MACROS, self::ADDITIONAL_FRESHNESS_LATENCY, self::ENABLE_EMBEDDED_PERL, self::USE_EMBEDDED_PERL_IMPLICITLY, self::P1_FILE, self::USE_TIMEZONE, self::DEBUG_FILE, self::DEBUG_LEVEL, self::DEBUG_VERBOSITY, self::MAX_DEBUG_FILE_SIZE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'config_dir', 'log_file', 'temp_file', 'status_file', 'status_update_interval', 'nagios_user', 'nagios_group', 'enable_notifications', 'execute_service_checks', 'accept_passive_service_checks', 'enable_event_handlers', 'log_rotation_method', 'log_archive_path', 'check_external_commands', 'command_check_interval', 'command_file', 'lock_file', 'retain_state_information', 'state_retention_file', 'retention_update_interval', 'use_retained_program_state', 'use_syslog', 'log_notifications', 'log_service_retries', 'log_host_retries', 'log_event_handlers', 'log_initial_states', 'log_external_commands', 'log_passive_checks', 'global_host_event_handler', 'global_service_event_handler', 'external_command_buffer_slots', 'sleep_time', 'service_interleave_factor', 'max_concurrent_checks', 'service_reaper_frequency', 'interval_length', 'use_aggressive_host_checking', 'enable_flap_detection', 'low_service_flap_threshold', 'high_service_flap_threshold', 'low_host_flap_threshold', 'high_host_flap_threshold', 'soft_state_dependencies', 'service_check_timeout', 'host_check_timeout', 'event_handler_timeout', 'notification_timeout', 'ocsp_timeout', 'ohcp_timeout', 'perfdata_timeout', 'obsess_over_services', 'ocsp_command', 'process_performance_data', 'check_for_orphaned_services', 'check_service_freshness', 'freshness_check_interval', 'date_format', 'illegal_object_name_chars', 'illegal_macro_output_chars', 'admin_email', 'admin_pager', 'execute_host_checks', 'service_inter_check_delay_method', 'use_retained_scheduling_info', 'accept_passive_host_checks', 'max_service_check_spread', 'host_inter_check_delay_method', 'max_host_check_spread', 'auto_reschedule_checks', 'auto_rescheduling_interval', 'auto_rescheduling_window', 'ochp_timeout', 'obsess_over_hosts', 'ochp_command', 'check_host_freshness', 'host_freshness_check_interval', 'service_freshness_check_interval', 'use_regexp_matching', 'use_true_regexp_matching', 'event_broker_options', 'daemon_dumps_core', 'host_perfdata_command', 'service_perfdata_command', 'host_perfdata_file', 'host_perfdata_file_template', 'service_perfdata_file', 'service_perfdata_file_template', 'host_perfdata_file_mode', 'service_perfdata_file_mode', 'host_perfdata_file_processing_command', 'service_perfdata_file_processing_command', 'host_perfdata_file_processing_interval', 'service_perfdata_file_processing_interval', 'object_cache_file', 'precached_object_file', 'retained_host_attribute_mask', 'retained_service_attribute_mask', 'retained_process_host_attribute_mask', 'retained_process_service_attribute_mask', 'retained_contact_host_attribute_mask', 'retained_contact_service_attribute_mask', 'check_result_reaper_frequency', 'max_check_result_reaper_time', 'check_result_path', 'max_check_result_file_age', 'translate_passive_host_checks', 'passive_host_checks_are_soft', 'enable_predictive_host_dependency_checks', 'enable_predictive_service_dependency_checks', 'cached_host_check_horizon', 'cached_service_check_horizon', 'use_large_installation_tweaks', 'free_child_process_memory', 'child_processes_fork_twice', 'enable_environment_macros', 'additional_freshness_latency', 'enable_embedded_perl', 'use_embedded_perl_implicitly', 'p1_file', 'use_timezone', 'debug_file', 'debug_level', 'debug_verbosity', 'max_debug_file_size', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, ) + ); + + /** + * 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, 'ConfigDir' => 1, 'LogFile' => 2, 'TempFile' => 3, 'StatusFile' => 4, 'StatusUpdateInterval' => 5, 'NagiosUser' => 6, 'NagiosGroup' => 7, 'EnableNotifications' => 8, 'ExecuteServiceChecks' => 9, 'AcceptPassiveServiceChecks' => 10, 'EnableEventHandlers' => 11, 'LogRotationMethod' => 12, 'LogArchivePath' => 13, 'CheckExternalCommands' => 14, 'CommandCheckInterval' => 15, 'CommandFile' => 16, 'LockFile' => 17, 'RetainStateInformation' => 18, 'StateRetentionFile' => 19, 'RetentionUpdateInterval' => 20, 'UseRetainedProgramState' => 21, 'UseSyslog' => 22, 'LogNotifications' => 23, 'LogServiceRetries' => 24, 'LogHostRetries' => 25, 'LogEventHandlers' => 26, 'LogInitialStates' => 27, 'LogExternalCommands' => 28, 'LogPassiveChecks' => 29, 'GlobalHostEventHandler' => 30, 'GlobalServiceEventHandler' => 31, 'ExternalCommandBufferSlots' => 32, 'SleepTime' => 33, 'ServiceInterleaveFactor' => 34, 'MaxConcurrentChecks' => 35, 'ServiceReaperFrequency' => 36, 'IntervalLength' => 37, 'UseAggressiveHostChecking' => 38, 'EnableFlapDetection' => 39, 'LowServiceFlapThreshold' => 40, 'HighServiceFlapThreshold' => 41, 'LowHostFlapThreshold' => 42, 'HighHostFlapThreshold' => 43, 'SoftStateDependencies' => 44, 'ServiceCheckTimeout' => 45, 'HostCheckTimeout' => 46, 'EventHandlerTimeout' => 47, 'NotificationTimeout' => 48, 'OcspTimeout' => 49, 'OhcpTimeout' => 50, 'PerfdataTimeout' => 51, 'ObsessOverServices' => 52, 'OcspCommand' => 53, 'ProcessPerformanceData' => 54, 'CheckForOrphanedServices' => 55, 'CheckServiceFreshness' => 56, 'FreshnessCheckInterval' => 57, 'DateFormat' => 58, 'IllegalObjectNameChars' => 59, 'IllegalMacroOutputChars' => 60, 'AdminEmail' => 61, 'AdminPager' => 62, 'ExecuteHostChecks' => 63, 'ServiceInterCheckDelayMethod' => 64, 'UseRetainedSchedulingInfo' => 65, 'AcceptPassiveHostChecks' => 66, 'MaxServiceCheckSpread' => 67, 'HostInterCheckDelayMethod' => 68, 'MaxHostCheckSpread' => 69, 'AutoRescheduleChecks' => 70, 'AutoReschedulingInterval' => 71, 'AutoReschedulingWindow' => 72, 'OchpTimeout' => 73, 'ObsessOverHosts' => 74, 'OchpCommand' => 75, 'CheckHostFreshness' => 76, 'HostFreshnessCheckInterval' => 77, 'ServiceFreshnessCheckInterval' => 78, 'UseRegexpMatching' => 79, 'UseTrueRegexpMatching' => 80, 'EventBrokerOptions' => 81, 'DaemonDumpsCore' => 82, 'HostPerfdataCommand' => 83, 'ServicePerfdataCommand' => 84, 'HostPerfdataFile' => 85, 'HostPerfdataFileTemplate' => 86, 'ServicePerfdataFile' => 87, 'ServicePerfdataFileTemplate' => 88, 'HostPerfdataFileMode' => 89, 'ServicePerfdataFileMode' => 90, 'HostPerfdataFileProcessingCommand' => 91, 'ServicePerfdataFileProcessingCommand' => 92, 'HostPerfdataFileProcessingInterval' => 93, 'ServicePerfdataFileProcessingInterval' => 94, 'ObjectCacheFile' => 95, 'PrecachedObjectFile' => 96, 'RetainedHostAttributeMask' => 97, 'RetainedServiceAttributeMask' => 98, 'RetainedProcessHostAttributeMask' => 99, 'RetainedProcessServiceAttributeMask' => 100, 'RetainedContactHostAttributeMask' => 101, 'RetainedContactServiceAttributeMask' => 102, 'CheckResultReaperFrequency' => 103, 'MaxCheckResultReaperTime' => 104, 'CheckResultPath' => 105, 'MaxCheckResultFileAge' => 106, 'TranslatePassiveHostChecks' => 107, 'PassiveHostChecksAreSoft' => 108, 'EnablePredictiveHostDependencyChecks' => 109, 'EnablePredictiveServiceDependencyChecks' => 110, 'CachedHostCheckHorizon' => 111, 'CachedServiceCheckHorizon' => 112, 'UseLargeInstallationTweaks' => 113, 'FreeChildProcessMemory' => 114, 'ChildProcessesForkTwice' => 115, 'EnableEnvironmentMacros' => 116, 'AdditionalFreshnessLatency' => 117, 'EnableEmbeddedPerl' => 118, 'UseEmbeddedPerlImplicitly' => 119, 'P1File' => 120, 'UseTimezone' => 121, 'DebugFile' => 122, 'DebugLevel' => 123, 'DebugVerbosity' => 124, 'MaxDebugFileSize' => 125, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'configDir' => 1, 'logFile' => 2, 'tempFile' => 3, 'statusFile' => 4, 'statusUpdateInterval' => 5, 'nagiosUser' => 6, 'nagiosGroup' => 7, 'enableNotifications' => 8, 'executeServiceChecks' => 9, 'acceptPassiveServiceChecks' => 10, 'enableEventHandlers' => 11, 'logRotationMethod' => 12, 'logArchivePath' => 13, 'checkExternalCommands' => 14, 'commandCheckInterval' => 15, 'commandFile' => 16, 'lockFile' => 17, 'retainStateInformation' => 18, 'stateRetentionFile' => 19, 'retentionUpdateInterval' => 20, 'useRetainedProgramState' => 21, 'useSyslog' => 22, 'logNotifications' => 23, 'logServiceRetries' => 24, 'logHostRetries' => 25, 'logEventHandlers' => 26, 'logInitialStates' => 27, 'logExternalCommands' => 28, 'logPassiveChecks' => 29, 'globalHostEventHandler' => 30, 'globalServiceEventHandler' => 31, 'externalCommandBufferSlots' => 32, 'sleepTime' => 33, 'serviceInterleaveFactor' => 34, 'maxConcurrentChecks' => 35, 'serviceReaperFrequency' => 36, 'intervalLength' => 37, 'useAggressiveHostChecking' => 38, 'enableFlapDetection' => 39, 'lowServiceFlapThreshold' => 40, 'highServiceFlapThreshold' => 41, 'lowHostFlapThreshold' => 42, 'highHostFlapThreshold' => 43, 'softStateDependencies' => 44, 'serviceCheckTimeout' => 45, 'hostCheckTimeout' => 46, 'eventHandlerTimeout' => 47, 'notificationTimeout' => 48, 'ocspTimeout' => 49, 'ohcpTimeout' => 50, 'perfdataTimeout' => 51, 'obsessOverServices' => 52, 'ocspCommand' => 53, 'processPerformanceData' => 54, 'checkForOrphanedServices' => 55, 'checkServiceFreshness' => 56, 'freshnessCheckInterval' => 57, 'dateFormat' => 58, 'illegalObjectNameChars' => 59, 'illegalMacroOutputChars' => 60, 'adminEmail' => 61, 'adminPager' => 62, 'executeHostChecks' => 63, 'serviceInterCheckDelayMethod' => 64, 'useRetainedSchedulingInfo' => 65, 'acceptPassiveHostChecks' => 66, 'maxServiceCheckSpread' => 67, 'hostInterCheckDelayMethod' => 68, 'maxHostCheckSpread' => 69, 'autoRescheduleChecks' => 70, 'autoReschedulingInterval' => 71, 'autoReschedulingWindow' => 72, 'ochpTimeout' => 73, 'obsessOverHosts' => 74, 'ochpCommand' => 75, 'checkHostFreshness' => 76, 'hostFreshnessCheckInterval' => 77, 'serviceFreshnessCheckInterval' => 78, 'useRegexpMatching' => 79, 'useTrueRegexpMatching' => 80, 'eventBrokerOptions' => 81, 'daemonDumpsCore' => 82, 'hostPerfdataCommand' => 83, 'servicePerfdataCommand' => 84, 'hostPerfdataFile' => 85, 'hostPerfdataFileTemplate' => 86, 'servicePerfdataFile' => 87, 'servicePerfdataFileTemplate' => 88, 'hostPerfdataFileMode' => 89, 'servicePerfdataFileMode' => 90, 'hostPerfdataFileProcessingCommand' => 91, 'servicePerfdataFileProcessingCommand' => 92, 'hostPerfdataFileProcessingInterval' => 93, 'servicePerfdataFileProcessingInterval' => 94, 'objectCacheFile' => 95, 'precachedObjectFile' => 96, 'retainedHostAttributeMask' => 97, 'retainedServiceAttributeMask' => 98, 'retainedProcessHostAttributeMask' => 99, 'retainedProcessServiceAttributeMask' => 100, 'retainedContactHostAttributeMask' => 101, 'retainedContactServiceAttributeMask' => 102, 'checkResultReaperFrequency' => 103, 'maxCheckResultReaperTime' => 104, 'checkResultPath' => 105, 'maxCheckResultFileAge' => 106, 'translatePassiveHostChecks' => 107, 'passiveHostChecksAreSoft' => 108, 'enablePredictiveHostDependencyChecks' => 109, 'enablePredictiveServiceDependencyChecks' => 110, 'cachedHostCheckHorizon' => 111, 'cachedServiceCheckHorizon' => 112, 'useLargeInstallationTweaks' => 113, 'freeChildProcessMemory' => 114, 'childProcessesForkTwice' => 115, 'enableEnvironmentMacros' => 116, 'additionalFreshnessLatency' => 117, 'enableEmbeddedPerl' => 118, 'useEmbeddedPerlImplicitly' => 119, 'p1File' => 120, 'useTimezone' => 121, 'debugFile' => 122, 'debugLevel' => 123, 'debugVerbosity' => 124, 'maxDebugFileSize' => 125, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CONFIG_DIR => 1, self::LOG_FILE => 2, self::TEMP_FILE => 3, self::STATUS_FILE => 4, self::STATUS_UPDATE_INTERVAL => 5, self::NAGIOS_USER => 6, self::NAGIOS_GROUP => 7, self::ENABLE_NOTIFICATIONS => 8, self::EXECUTE_SERVICE_CHECKS => 9, self::ACCEPT_PASSIVE_SERVICE_CHECKS => 10, self::ENABLE_EVENT_HANDLERS => 11, self::LOG_ROTATION_METHOD => 12, self::LOG_ARCHIVE_PATH => 13, self::CHECK_EXTERNAL_COMMANDS => 14, self::COMMAND_CHECK_INTERVAL => 15, self::COMMAND_FILE => 16, self::LOCK_FILE => 17, self::RETAIN_STATE_INFORMATION => 18, self::STATE_RETENTION_FILE => 19, self::RETENTION_UPDATE_INTERVAL => 20, self::USE_RETAINED_PROGRAM_STATE => 21, self::USE_SYSLOG => 22, self::LOG_NOTIFICATIONS => 23, self::LOG_SERVICE_RETRIES => 24, self::LOG_HOST_RETRIES => 25, self::LOG_EVENT_HANDLERS => 26, self::LOG_INITIAL_STATES => 27, self::LOG_EXTERNAL_COMMANDS => 28, self::LOG_PASSIVE_CHECKS => 29, self::GLOBAL_HOST_EVENT_HANDLER => 30, self::GLOBAL_SERVICE_EVENT_HANDLER => 31, self::EXTERNAL_COMMAND_BUFFER_SLOTS => 32, self::SLEEP_TIME => 33, self::SERVICE_INTERLEAVE_FACTOR => 34, self::MAX_CONCURRENT_CHECKS => 35, self::SERVICE_REAPER_FREQUENCY => 36, self::INTERVAL_LENGTH => 37, self::USE_AGGRESSIVE_HOST_CHECKING => 38, self::ENABLE_FLAP_DETECTION => 39, self::LOW_SERVICE_FLAP_THRESHOLD => 40, self::HIGH_SERVICE_FLAP_THRESHOLD => 41, self::LOW_HOST_FLAP_THRESHOLD => 42, self::HIGH_HOST_FLAP_THRESHOLD => 43, self::SOFT_STATE_DEPENDENCIES => 44, self::SERVICE_CHECK_TIMEOUT => 45, self::HOST_CHECK_TIMEOUT => 46, self::EVENT_HANDLER_TIMEOUT => 47, self::NOTIFICATION_TIMEOUT => 48, self::OCSP_TIMEOUT => 49, self::OHCP_TIMEOUT => 50, self::PERFDATA_TIMEOUT => 51, self::OBSESS_OVER_SERVICES => 52, self::OCSP_COMMAND => 53, self::PROCESS_PERFORMANCE_DATA => 54, self::CHECK_FOR_ORPHANED_SERVICES => 55, self::CHECK_SERVICE_FRESHNESS => 56, self::FRESHNESS_CHECK_INTERVAL => 57, self::DATE_FORMAT => 58, self::ILLEGAL_OBJECT_NAME_CHARS => 59, self::ILLEGAL_MACRO_OUTPUT_CHARS => 60, self::ADMIN_EMAIL => 61, self::ADMIN_PAGER => 62, self::EXECUTE_HOST_CHECKS => 63, self::SERVICE_INTER_CHECK_DELAY_METHOD => 64, self::USE_RETAINED_SCHEDULING_INFO => 65, self::ACCEPT_PASSIVE_HOST_CHECKS => 66, self::MAX_SERVICE_CHECK_SPREAD => 67, self::HOST_INTER_CHECK_DELAY_METHOD => 68, self::MAX_HOST_CHECK_SPREAD => 69, self::AUTO_RESCHEDULE_CHECKS => 70, self::AUTO_RESCHEDULING_INTERVAL => 71, self::AUTO_RESCHEDULING_WINDOW => 72, self::OCHP_TIMEOUT => 73, self::OBSESS_OVER_HOSTS => 74, self::OCHP_COMMAND => 75, self::CHECK_HOST_FRESHNESS => 76, self::HOST_FRESHNESS_CHECK_INTERVAL => 77, self::SERVICE_FRESHNESS_CHECK_INTERVAL => 78, self::USE_REGEXP_MATCHING => 79, self::USE_TRUE_REGEXP_MATCHING => 80, self::EVENT_BROKER_OPTIONS => 81, self::DAEMON_DUMPS_CORE => 82, self::HOST_PERFDATA_COMMAND => 83, self::SERVICE_PERFDATA_COMMAND => 84, self::HOST_PERFDATA_FILE => 85, self::HOST_PERFDATA_FILE_TEMPLATE => 86, self::SERVICE_PERFDATA_FILE => 87, self::SERVICE_PERFDATA_FILE_TEMPLATE => 88, self::HOST_PERFDATA_FILE_MODE => 89, self::SERVICE_PERFDATA_FILE_MODE => 90, self::HOST_PERFDATA_FILE_PROCESSING_COMMAND => 91, self::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND => 92, self::HOST_PERFDATA_FILE_PROCESSING_INTERVAL => 93, self::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL => 94, self::OBJECT_CACHE_FILE => 95, self::PRECACHED_OBJECT_FILE => 96, self::RETAINED_HOST_ATTRIBUTE_MASK => 97, self::RETAINED_SERVICE_ATTRIBUTE_MASK => 98, self::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK => 99, self::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK => 100, self::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK => 101, self::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK => 102, self::CHECK_RESULT_REAPER_FREQUENCY => 103, self::MAX_CHECK_RESULT_REAPER_TIME => 104, self::CHECK_RESULT_PATH => 105, self::MAX_CHECK_RESULT_FILE_AGE => 106, self::TRANSLATE_PASSIVE_HOST_CHECKS => 107, self::PASSIVE_HOST_CHECKS_ARE_SOFT => 108, self::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS => 109, self::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS => 110, self::CACHED_HOST_CHECK_HORIZON => 111, self::CACHED_SERVICE_CHECK_HORIZON => 112, self::USE_LARGE_INSTALLATION_TWEAKS => 113, self::FREE_CHILD_PROCESS_MEMORY => 114, self::CHILD_PROCESSES_FORK_TWICE => 115, self::ENABLE_ENVIRONMENT_MACROS => 116, self::ADDITIONAL_FRESHNESS_LATENCY => 117, self::ENABLE_EMBEDDED_PERL => 118, self::USE_EMBEDDED_PERL_IMPLICITLY => 119, self::P1_FILE => 120, self::USE_TIMEZONE => 121, self::DEBUG_FILE => 122, self::DEBUG_LEVEL => 123, self::DEBUG_VERBOSITY => 124, self::MAX_DEBUG_FILE_SIZE => 125, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'config_dir' => 1, 'log_file' => 2, 'temp_file' => 3, 'status_file' => 4, 'status_update_interval' => 5, 'nagios_user' => 6, 'nagios_group' => 7, 'enable_notifications' => 8, 'execute_service_checks' => 9, 'accept_passive_service_checks' => 10, 'enable_event_handlers' => 11, 'log_rotation_method' => 12, 'log_archive_path' => 13, 'check_external_commands' => 14, 'command_check_interval' => 15, 'command_file' => 16, 'lock_file' => 17, 'retain_state_information' => 18, 'state_retention_file' => 19, 'retention_update_interval' => 20, 'use_retained_program_state' => 21, 'use_syslog' => 22, 'log_notifications' => 23, 'log_service_retries' => 24, 'log_host_retries' => 25, 'log_event_handlers' => 26, 'log_initial_states' => 27, 'log_external_commands' => 28, 'log_passive_checks' => 29, 'global_host_event_handler' => 30, 'global_service_event_handler' => 31, 'external_command_buffer_slots' => 32, 'sleep_time' => 33, 'service_interleave_factor' => 34, 'max_concurrent_checks' => 35, 'service_reaper_frequency' => 36, 'interval_length' => 37, 'use_aggressive_host_checking' => 38, 'enable_flap_detection' => 39, 'low_service_flap_threshold' => 40, 'high_service_flap_threshold' => 41, 'low_host_flap_threshold' => 42, 'high_host_flap_threshold' => 43, 'soft_state_dependencies' => 44, 'service_check_timeout' => 45, 'host_check_timeout' => 46, 'event_handler_timeout' => 47, 'notification_timeout' => 48, 'ocsp_timeout' => 49, 'ohcp_timeout' => 50, 'perfdata_timeout' => 51, 'obsess_over_services' => 52, 'ocsp_command' => 53, 'process_performance_data' => 54, 'check_for_orphaned_services' => 55, 'check_service_freshness' => 56, 'freshness_check_interval' => 57, 'date_format' => 58, 'illegal_object_name_chars' => 59, 'illegal_macro_output_chars' => 60, 'admin_email' => 61, 'admin_pager' => 62, 'execute_host_checks' => 63, 'service_inter_check_delay_method' => 64, 'use_retained_scheduling_info' => 65, 'accept_passive_host_checks' => 66, 'max_service_check_spread' => 67, 'host_inter_check_delay_method' => 68, 'max_host_check_spread' => 69, 'auto_reschedule_checks' => 70, 'auto_rescheduling_interval' => 71, 'auto_rescheduling_window' => 72, 'ochp_timeout' => 73, 'obsess_over_hosts' => 74, 'ochp_command' => 75, 'check_host_freshness' => 76, 'host_freshness_check_interval' => 77, 'service_freshness_check_interval' => 78, 'use_regexp_matching' => 79, 'use_true_regexp_matching' => 80, 'event_broker_options' => 81, 'daemon_dumps_core' => 82, 'host_perfdata_command' => 83, 'service_perfdata_command' => 84, 'host_perfdata_file' => 85, 'host_perfdata_file_template' => 86, 'service_perfdata_file' => 87, 'service_perfdata_file_template' => 88, 'host_perfdata_file_mode' => 89, 'service_perfdata_file_mode' => 90, 'host_perfdata_file_processing_command' => 91, 'service_perfdata_file_processing_command' => 92, 'host_perfdata_file_processing_interval' => 93, 'service_perfdata_file_processing_interval' => 94, 'object_cache_file' => 95, 'precached_object_file' => 96, 'retained_host_attribute_mask' => 97, 'retained_service_attribute_mask' => 98, 'retained_process_host_attribute_mask' => 99, 'retained_process_service_attribute_mask' => 100, 'retained_contact_host_attribute_mask' => 101, 'retained_contact_service_attribute_mask' => 102, 'check_result_reaper_frequency' => 103, 'max_check_result_reaper_time' => 104, 'check_result_path' => 105, 'max_check_result_file_age' => 106, 'translate_passive_host_checks' => 107, 'passive_host_checks_are_soft' => 108, 'enable_predictive_host_dependency_checks' => 109, 'enable_predictive_service_dependency_checks' => 110, 'cached_host_check_horizon' => 111, 'cached_service_check_horizon' => 112, 'use_large_installation_tweaks' => 113, 'free_child_process_memory' => 114, 'child_processes_fork_twice' => 115, 'enable_environment_macros' => 116, 'additional_freshness_latency' => 117, 'enable_embedded_perl' => 118, 'use_embedded_perl_implicitly' => 119, 'p1_file' => 120, 'use_timezone' => 121, 'debug_file' => 122, 'debug_level' => 123, 'debug_verbosity' => 124, 'max_debug_file_size' => 125, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosMainConfigurationMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosMainConfigurationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosMainConfigurationPeer::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) + { + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ID); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CONFIG_DIR); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::TEMP_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::STATUS_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::STATUS_UPDATE_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::NAGIOS_USER); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::NAGIOS_GROUP); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_NOTIFICATIONS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::EXECUTE_SERVICE_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_SERVICE_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_EVENT_HANDLERS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_ROTATION_METHOD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_ARCHIVE_PATH); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_EXTERNAL_COMMANDS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::COMMAND_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::COMMAND_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOCK_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAIN_STATE_INFORMATION); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::STATE_RETENTION_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETENTION_UPDATE_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_RETAINED_PROGRAM_STATE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_SYSLOG); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_NOTIFICATIONS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_SERVICE_RETRIES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_HOST_RETRIES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_EVENT_HANDLERS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_INITIAL_STATES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_EXTERNAL_COMMANDS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOG_PASSIVE_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::EXTERNAL_COMMAND_BUFFER_SLOTS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SLEEP_TIME); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_INTERLEAVE_FACTOR); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_CONCURRENT_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_REAPER_FREQUENCY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::INTERVAL_LENGTH); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_AGGRESSIVE_HOST_CHECKING); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_FLAP_DETECTION); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOW_SERVICE_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HIGH_SERVICE_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::LOW_HOST_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HIGH_HOST_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SOFT_STATE_DEPENDENCIES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_CHECK_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_CHECK_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::EVENT_HANDLER_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::NOTIFICATION_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OCSP_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OHCP_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::PERFDATA_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OBSESS_OVER_SERVICES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OCSP_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::PROCESS_PERFORMANCE_DATA); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_FOR_ORPHANED_SERVICES); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_SERVICE_FRESHNESS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::FRESHNESS_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::DATE_FORMAT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ILLEGAL_OBJECT_NAME_CHARS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ILLEGAL_MACRO_OUTPUT_CHARS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ADMIN_EMAIL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ADMIN_PAGER); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::EXECUTE_HOST_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_INTER_CHECK_DELAY_METHOD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_RETAINED_SCHEDULING_INFO); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ACCEPT_PASSIVE_HOST_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_SERVICE_CHECK_SPREAD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_INTER_CHECK_DELAY_METHOD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_HOST_CHECK_SPREAD); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::AUTO_RESCHEDULE_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::AUTO_RESCHEDULING_WINDOW); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OCHP_TIMEOUT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OBSESS_OVER_HOSTS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OCHP_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_HOST_FRESHNESS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_FRESHNESS_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_FRESHNESS_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_REGEXP_MATCHING); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_TRUE_REGEXP_MATCHING); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::EVENT_BROKER_OPTIONS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::DAEMON_DUMPS_CORE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_TEMPLATE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_TEMPLATE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_MODE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_MODE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_INTERVAL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::OBJECT_CACHE_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::PRECACHED_OBJECT_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_HOST_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_SERVICE_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_PROCESS_HOST_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_PROCESS_SERVICE_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_CONTACT_HOST_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::RETAINED_CONTACT_SERVICE_ATTRIBUTE_MASK); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_RESULT_REAPER_FREQUENCY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_REAPER_TIME); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHECK_RESULT_PATH); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_CHECK_RESULT_FILE_AGE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::TRANSLATE_PASSIVE_HOST_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::PASSIVE_HOST_CHECKS_ARE_SOFT); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CACHED_HOST_CHECK_HORIZON); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CACHED_SERVICE_CHECK_HORIZON); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_LARGE_INSTALLATION_TWEAKS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::FREE_CHILD_PROCESS_MEMORY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::CHILD_PROCESSES_FORK_TWICE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_ENVIRONMENT_MACROS); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ADDITIONAL_FRESHNESS_LATENCY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::ENABLE_EMBEDDED_PERL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_EMBEDDED_PERL_IMPLICITLY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::P1_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::USE_TIMEZONE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::DEBUG_FILE); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::DEBUG_LEVEL); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::DEBUG_VERBOSITY); + + $criteria->addSelectColumn(NagiosMainConfigurationPeer::MAX_DEBUG_FILE_SIZE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosMainConfiguration + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosMainConfigurationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosMainConfigurationPeer::populateObjects(NagiosMainConfigurationPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosMainConfiguration $value A NagiosMainConfiguration object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosMainConfiguration $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosMainConfiguration object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosMainConfiguration) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosMainConfiguration object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosMainConfiguration Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosMainConfigurationPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosMainConfigurationPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosMainConfigurationPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByOcspCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByOcspCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::OCSP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByOchpCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByOchpCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::OCHP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByHostPerfdataCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByHostPerfdataCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByServicePerfdataCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByServicePerfdataCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByHostPerfdataFileProcessingCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByHostPerfdataFileProcessingCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByServicePerfdataFileProcessingCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByServicePerfdataFileProcessingCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByGlobalServiceEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByGlobalServiceEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByGlobalHostEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByGlobalHostEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByOcspCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::OCSP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByOcspCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByOchpCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::OCHP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByOchpCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByHostPerfdataCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByHostPerfdataCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByServicePerfdataCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByServicePerfdataCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByHostPerfdataFileProcessingCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByServicePerfdataFileProcessingCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByGlobalServiceEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByGlobalServiceEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByGlobalHostEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosMainConfiguration) to $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByGlobalHostEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosMainConfigurationPeer::OCSP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::OCHP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol9 = $startcol8 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol10 = $startcol9 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosMainConfigurationPeer::OCSP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::OCHP_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::HOST_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::SERVICE_PERFDATA_FILE_PROCESSING_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_SERVICE_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosMainConfigurationPeer::GLOBAL_HOST_EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosMainConfigurationRelatedByOcspCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosMainConfigurationRelatedByOchpCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key4 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosCommandPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosCommandPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj4 (NagiosCommand) + $obj4->addNagiosMainConfigurationRelatedByHostPerfdataCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosMainConfigurationRelatedByServicePerfdataCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key6 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosCommandPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosCommandPeer::addInstanceToPool($obj6, $key6); + } // if obj6 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj6 (NagiosCommand) + $obj6->addNagiosMainConfigurationRelatedByHostPerfdataFileProcessingCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key7 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosCommandPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosCommandPeer::addInstanceToPool($obj7, $key7); + } // if obj7 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj7 (NagiosCommand) + $obj7->addNagiosMainConfigurationRelatedByServicePerfdataFileProcessingCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key8 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol8); + if ($key8 !== null) { + $obj8 = NagiosCommandPeer::getInstanceFromPool($key8); + if (!$obj8) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj8 = new $cls(); + $obj8->hydrate($row, $startcol8); + NagiosCommandPeer::addInstanceToPool($obj8, $key8); + } // if obj8 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj8 (NagiosCommand) + $obj8->addNagiosMainConfigurationRelatedByGlobalServiceEventHandler($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key9 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol9); + if ($key9 !== null) { + $obj9 = NagiosCommandPeer::getInstanceFromPool($key9); + if (!$obj9) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj9 = new $cls(); + $obj9->hydrate($row, $startcol9); + NagiosCommandPeer::addInstanceToPool($obj9, $key9); + } // if obj9 loaded + + // Add the $obj1 (NagiosMainConfiguration) to the collection in $obj9 (NagiosCommand) + $obj9->addNagiosMainConfigurationRelatedByGlobalHostEventHandler($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByOcspCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByOcspCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByOchpCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByOchpCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByHostPerfdataCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByHostPerfdataCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByServicePerfdataCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByServicePerfdataCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByHostPerfdataFileProcessingCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByHostPerfdataFileProcessingCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByServicePerfdataFileProcessingCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByServicePerfdataFileProcessingCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByGlobalServiceEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByGlobalServiceEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByGlobalHostEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByGlobalHostEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosMainConfigurationPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosMainConfigurationPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByOcspCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByOcspCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByOchpCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByOchpCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByHostPerfdataCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByHostPerfdataCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByServicePerfdataCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByServicePerfdataCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByHostPerfdataFileProcessingCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByHostPerfdataFileProcessingCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByServicePerfdataFileProcessingCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByServicePerfdataFileProcessingCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByGlobalServiceEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByGlobalServiceEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByGlobalHostEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosMainConfiguration objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByGlobalHostEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosMainConfigurationPeer::addSelectColumns($c); + $startcol2 = (NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosMainConfigurationPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosMainConfigurationPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosMainConfigurationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosMainConfiguration or Criteria object. + * + * @param mixed $values Criteria or NagiosMainConfiguration object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosMainConfiguration object + } + + if ($criteria->containsKey(NagiosMainConfigurationPeer::ID) && $criteria->keyContainsValue(NagiosMainConfigurationPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosMainConfigurationPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosMainConfiguration or Criteria object. + * + * @param mixed $values Criteria or NagiosMainConfiguration object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosMainConfigurationPeer::ID); + $selectCriteria->add(NagiosMainConfigurationPeer::ID, $criteria->remove(NagiosMainConfigurationPeer::ID), $comparison); + + } else { // $values is NagiosMainConfiguration object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_main_configuration 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(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosMainConfigurationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosMainConfiguration or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosMainConfiguration object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosMainConfigurationPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosMainConfiguration) { + // invalidate the cache for this single object + NagiosMainConfigurationPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosMainConfigurationPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosMainConfigurationPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosMainConfiguration 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 NagiosMainConfiguration $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(NagiosMainConfiguration $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosMainConfigurationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosMainConfigurationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosMainConfigurationPeer::DATABASE_NAME, NagiosMainConfigurationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosMainConfiguration + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosMainConfigurationPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + $criteria->add(NagiosMainConfigurationPeer::ID, $pk); + + $v = NagiosMainConfigurationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosMainConfigurationPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosMainConfigurationPeer::DATABASE_NAME); + $criteria->add(NagiosMainConfigurationPeer::ID, $pks, Criteria::IN); + $objs = NagiosMainConfigurationPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosMainConfigurationPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosMainConfigurationPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosMainConfigurationPeer class: +// +// Propel::getDatabaseMap(NagiosMainConfigurationPeer::DATABASE_NAME)->addTableBuilder(NagiosMainConfigurationPeer::TABLE_NAME, NagiosMainConfigurationPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosMainConfigurationPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosMainConfigurationPeer::TABLE_NAME, BaseNagiosMainConfigurationPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosResource.php b/classes/om/BaseNagiosResource.php new file mode 100755 index 0000000..40e493b --- /dev/null +++ b/classes/om/BaseNagiosResource.php @@ -0,0 +1,2158 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [user1] column value. + * + * @return string + */ + public function getUser1() + { + return $this->user1; + } + + /** + * Get the [user2] column value. + * + * @return string + */ + public function getUser2() + { + return $this->user2; + } + + /** + * Get the [user3] column value. + * + * @return string + */ + public function getUser3() + { + return $this->user3; + } + + /** + * Get the [user4] column value. + * + * @return string + */ + public function getUser4() + { + return $this->user4; + } + + /** + * Get the [user5] column value. + * + * @return string + */ + public function getUser5() + { + return $this->user5; + } + + /** + * Get the [user6] column value. + * + * @return string + */ + public function getUser6() + { + return $this->user6; + } + + /** + * Get the [user7] column value. + * + * @return string + */ + public function getUser7() + { + return $this->user7; + } + + /** + * Get the [user8] column value. + * + * @return string + */ + public function getUser8() + { + return $this->user8; + } + + /** + * Get the [user9] column value. + * + * @return string + */ + public function getUser9() + { + return $this->user9; + } + + /** + * Get the [user10] column value. + * + * @return string + */ + public function getUser10() + { + return $this->user10; + } + + /** + * Get the [user11] column value. + * + * @return string + */ + public function getUser11() + { + return $this->user11; + } + + /** + * Get the [user12] column value. + * + * @return string + */ + public function getUser12() + { + return $this->user12; + } + + /** + * Get the [user13] column value. + * + * @return string + */ + public function getUser13() + { + return $this->user13; + } + + /** + * Get the [user14] column value. + * + * @return string + */ + public function getUser14() + { + return $this->user14; + } + + /** + * Get the [user15] column value. + * + * @return string + */ + public function getUser15() + { + return $this->user15; + } + + /** + * Get the [user16] column value. + * + * @return string + */ + public function getUser16() + { + return $this->user16; + } + + /** + * Get the [user17] column value. + * + * @return string + */ + public function getUser17() + { + return $this->user17; + } + + /** + * Get the [user18] column value. + * + * @return string + */ + public function getUser18() + { + return $this->user18; + } + + /** + * Get the [user19] column value. + * + * @return string + */ + public function getUser19() + { + return $this->user19; + } + + /** + * Get the [user20] column value. + * + * @return string + */ + public function getUser20() + { + return $this->user20; + } + + /** + * Get the [user21] column value. + * + * @return string + */ + public function getUser21() + { + return $this->user21; + } + + /** + * Get the [user22] column value. + * + * @return string + */ + public function getUser22() + { + return $this->user22; + } + + /** + * Get the [user23] column value. + * + * @return string + */ + public function getUser23() + { + return $this->user23; + } + + /** + * Get the [user24] column value. + * + * @return string + */ + public function getUser24() + { + return $this->user24; + } + + /** + * Get the [user25] column value. + * + * @return string + */ + public function getUser25() + { + return $this->user25; + } + + /** + * Get the [user26] column value. + * + * @return string + */ + public function getUser26() + { + return $this->user26; + } + + /** + * Get the [user27] column value. + * + * @return string + */ + public function getUser27() + { + return $this->user27; + } + + /** + * Get the [user28] column value. + * + * @return string + */ + public function getUser28() + { + return $this->user28; + } + + /** + * Get the [user29] column value. + * + * @return string + */ + public function getUser29() + { + return $this->user29; + } + + /** + * Get the [user30] column value. + * + * @return string + */ + public function getUser30() + { + return $this->user30; + } + + /** + * Get the [user31] column value. + * + * @return string + */ + public function getUser31() + { + return $this->user31; + } + + /** + * Get the [user32] column value. + * + * @return string + */ + public function getUser32() + { + return $this->user32; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosResourcePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [user1] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser1($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user1 !== $v) { + $this->user1 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER1; + } + + return $this; + } // setUser1() + + /** + * Set the value of [user2] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser2($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user2 !== $v) { + $this->user2 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER2; + } + + return $this; + } // setUser2() + + /** + * Set the value of [user3] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser3($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user3 !== $v) { + $this->user3 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER3; + } + + return $this; + } // setUser3() + + /** + * Set the value of [user4] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser4($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user4 !== $v) { + $this->user4 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER4; + } + + return $this; + } // setUser4() + + /** + * Set the value of [user5] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser5($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user5 !== $v) { + $this->user5 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER5; + } + + return $this; + } // setUser5() + + /** + * Set the value of [user6] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser6($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user6 !== $v) { + $this->user6 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER6; + } + + return $this; + } // setUser6() + + /** + * Set the value of [user7] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser7($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user7 !== $v) { + $this->user7 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER7; + } + + return $this; + } // setUser7() + + /** + * Set the value of [user8] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser8($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user8 !== $v) { + $this->user8 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER8; + } + + return $this; + } // setUser8() + + /** + * Set the value of [user9] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser9($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user9 !== $v) { + $this->user9 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER9; + } + + return $this; + } // setUser9() + + /** + * Set the value of [user10] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser10($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user10 !== $v) { + $this->user10 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER10; + } + + return $this; + } // setUser10() + + /** + * Set the value of [user11] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser11($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user11 !== $v) { + $this->user11 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER11; + } + + return $this; + } // setUser11() + + /** + * Set the value of [user12] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser12($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user12 !== $v) { + $this->user12 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER12; + } + + return $this; + } // setUser12() + + /** + * Set the value of [user13] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser13($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user13 !== $v) { + $this->user13 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER13; + } + + return $this; + } // setUser13() + + /** + * Set the value of [user14] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser14($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user14 !== $v) { + $this->user14 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER14; + } + + return $this; + } // setUser14() + + /** + * Set the value of [user15] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser15($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user15 !== $v) { + $this->user15 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER15; + } + + return $this; + } // setUser15() + + /** + * Set the value of [user16] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser16($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user16 !== $v) { + $this->user16 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER16; + } + + return $this; + } // setUser16() + + /** + * Set the value of [user17] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser17($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user17 !== $v) { + $this->user17 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER17; + } + + return $this; + } // setUser17() + + /** + * Set the value of [user18] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser18($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user18 !== $v) { + $this->user18 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER18; + } + + return $this; + } // setUser18() + + /** + * Set the value of [user19] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser19($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user19 !== $v) { + $this->user19 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER19; + } + + return $this; + } // setUser19() + + /** + * Set the value of [user20] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser20($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user20 !== $v) { + $this->user20 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER20; + } + + return $this; + } // setUser20() + + /** + * Set the value of [user21] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser21($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user21 !== $v) { + $this->user21 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER21; + } + + return $this; + } // setUser21() + + /** + * Set the value of [user22] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser22($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user22 !== $v) { + $this->user22 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER22; + } + + return $this; + } // setUser22() + + /** + * Set the value of [user23] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser23($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user23 !== $v) { + $this->user23 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER23; + } + + return $this; + } // setUser23() + + /** + * Set the value of [user24] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser24($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user24 !== $v) { + $this->user24 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER24; + } + + return $this; + } // setUser24() + + /** + * Set the value of [user25] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser25($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user25 !== $v) { + $this->user25 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER25; + } + + return $this; + } // setUser25() + + /** + * Set the value of [user26] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser26($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user26 !== $v) { + $this->user26 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER26; + } + + return $this; + } // setUser26() + + /** + * Set the value of [user27] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser27($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user27 !== $v) { + $this->user27 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER27; + } + + return $this; + } // setUser27() + + /** + * Set the value of [user28] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser28($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user28 !== $v) { + $this->user28 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER28; + } + + return $this; + } // setUser28() + + /** + * Set the value of [user29] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser29($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user29 !== $v) { + $this->user29 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER29; + } + + return $this; + } // setUser29() + + /** + * Set the value of [user30] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser30($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user30 !== $v) { + $this->user30 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER30; + } + + return $this; + } // setUser30() + + /** + * Set the value of [user31] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser31($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user31 !== $v) { + $this->user31 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER31; + } + + return $this; + } // setUser31() + + /** + * Set the value of [user32] column. + * + * @param string $v new value + * @return NagiosResource The current object (for fluent API support) + */ + public function setUser32($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->user32 !== $v) { + $this->user32 = $v; + $this->modifiedColumns[] = NagiosResourcePeer::USER32; + } + + return $this; + } // setUser32() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->user1 = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->user2 = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->user3 = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->user4 = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->user5 = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->user6 = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->user7 = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->user8 = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->user9 = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->user10 = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->user11 = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->user12 = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; + $this->user13 = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->user14 = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; + $this->user15 = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; + $this->user16 = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; + $this->user17 = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; + $this->user18 = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null; + $this->user19 = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; + $this->user20 = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; + $this->user21 = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null; + $this->user22 = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; + $this->user23 = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null; + $this->user24 = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null; + $this->user25 = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null; + $this->user26 = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null; + $this->user27 = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null; + $this->user28 = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null; + $this->user29 = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null; + $this->user30 = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null; + $this->user31 = ($row[$startcol + 31] !== null) ? (string) $row[$startcol + 31] : null; + $this->user32 = ($row[$startcol + 32] !== null) ? (string) $row[$startcol + 32] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 33; // 33 = NagiosResourcePeer::NUM_COLUMNS - NagiosResourcePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosResource object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosResourcePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosResourcePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosResourcePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosResourcePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosResourcePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosResourcePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosResourcePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosResourcePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getUser1(); + break; + case 2: + return $this->getUser2(); + break; + case 3: + return $this->getUser3(); + break; + case 4: + return $this->getUser4(); + break; + case 5: + return $this->getUser5(); + break; + case 6: + return $this->getUser6(); + break; + case 7: + return $this->getUser7(); + break; + case 8: + return $this->getUser8(); + break; + case 9: + return $this->getUser9(); + break; + case 10: + return $this->getUser10(); + break; + case 11: + return $this->getUser11(); + break; + case 12: + return $this->getUser12(); + break; + case 13: + return $this->getUser13(); + break; + case 14: + return $this->getUser14(); + break; + case 15: + return $this->getUser15(); + break; + case 16: + return $this->getUser16(); + break; + case 17: + return $this->getUser17(); + break; + case 18: + return $this->getUser18(); + break; + case 19: + return $this->getUser19(); + break; + case 20: + return $this->getUser20(); + break; + case 21: + return $this->getUser21(); + break; + case 22: + return $this->getUser22(); + break; + case 23: + return $this->getUser23(); + break; + case 24: + return $this->getUser24(); + break; + case 25: + return $this->getUser25(); + break; + case 26: + return $this->getUser26(); + break; + case 27: + return $this->getUser27(); + break; + case 28: + return $this->getUser28(); + break; + case 29: + return $this->getUser29(); + break; + case 30: + return $this->getUser30(); + break; + case 31: + return $this->getUser31(); + break; + case 32: + return $this->getUser32(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosResourcePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getUser1(), + $keys[2] => $this->getUser2(), + $keys[3] => $this->getUser3(), + $keys[4] => $this->getUser4(), + $keys[5] => $this->getUser5(), + $keys[6] => $this->getUser6(), + $keys[7] => $this->getUser7(), + $keys[8] => $this->getUser8(), + $keys[9] => $this->getUser9(), + $keys[10] => $this->getUser10(), + $keys[11] => $this->getUser11(), + $keys[12] => $this->getUser12(), + $keys[13] => $this->getUser13(), + $keys[14] => $this->getUser14(), + $keys[15] => $this->getUser15(), + $keys[16] => $this->getUser16(), + $keys[17] => $this->getUser17(), + $keys[18] => $this->getUser18(), + $keys[19] => $this->getUser19(), + $keys[20] => $this->getUser20(), + $keys[21] => $this->getUser21(), + $keys[22] => $this->getUser22(), + $keys[23] => $this->getUser23(), + $keys[24] => $this->getUser24(), + $keys[25] => $this->getUser25(), + $keys[26] => $this->getUser26(), + $keys[27] => $this->getUser27(), + $keys[28] => $this->getUser28(), + $keys[29] => $this->getUser29(), + $keys[30] => $this->getUser30(), + $keys[31] => $this->getUser31(), + $keys[32] => $this->getUser32(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosResourcePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setUser1($value); + break; + case 2: + $this->setUser2($value); + break; + case 3: + $this->setUser3($value); + break; + case 4: + $this->setUser4($value); + break; + case 5: + $this->setUser5($value); + break; + case 6: + $this->setUser6($value); + break; + case 7: + $this->setUser7($value); + break; + case 8: + $this->setUser8($value); + break; + case 9: + $this->setUser9($value); + break; + case 10: + $this->setUser10($value); + break; + case 11: + $this->setUser11($value); + break; + case 12: + $this->setUser12($value); + break; + case 13: + $this->setUser13($value); + break; + case 14: + $this->setUser14($value); + break; + case 15: + $this->setUser15($value); + break; + case 16: + $this->setUser16($value); + break; + case 17: + $this->setUser17($value); + break; + case 18: + $this->setUser18($value); + break; + case 19: + $this->setUser19($value); + break; + case 20: + $this->setUser20($value); + break; + case 21: + $this->setUser21($value); + break; + case 22: + $this->setUser22($value); + break; + case 23: + $this->setUser23($value); + break; + case 24: + $this->setUser24($value); + break; + case 25: + $this->setUser25($value); + break; + case 26: + $this->setUser26($value); + break; + case 27: + $this->setUser27($value); + break; + case 28: + $this->setUser28($value); + break; + case 29: + $this->setUser29($value); + break; + case 30: + $this->setUser30($value); + break; + case 31: + $this->setUser31($value); + break; + case 32: + $this->setUser32($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosResourcePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setUser1($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setUser2($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setUser3($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUser4($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUser5($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setUser6($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setUser7($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setUser8($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setUser9($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setUser10($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setUser11($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setUser12($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUser13($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setUser14($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setUser15($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setUser16($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setUser17($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setUser18($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setUser19($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setUser20($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setUser21($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setUser22($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setUser23($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setUser24($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setUser25($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setUser26($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setUser27($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setUser28($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setUser29($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setUser30($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setUser31($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setUser32($arr[$keys[32]]); + } + + /** + * 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(NagiosResourcePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosResourcePeer::ID)) $criteria->add(NagiosResourcePeer::ID, $this->id); + if ($this->isColumnModified(NagiosResourcePeer::USER1)) $criteria->add(NagiosResourcePeer::USER1, $this->user1); + if ($this->isColumnModified(NagiosResourcePeer::USER2)) $criteria->add(NagiosResourcePeer::USER2, $this->user2); + if ($this->isColumnModified(NagiosResourcePeer::USER3)) $criteria->add(NagiosResourcePeer::USER3, $this->user3); + if ($this->isColumnModified(NagiosResourcePeer::USER4)) $criteria->add(NagiosResourcePeer::USER4, $this->user4); + if ($this->isColumnModified(NagiosResourcePeer::USER5)) $criteria->add(NagiosResourcePeer::USER5, $this->user5); + if ($this->isColumnModified(NagiosResourcePeer::USER6)) $criteria->add(NagiosResourcePeer::USER6, $this->user6); + if ($this->isColumnModified(NagiosResourcePeer::USER7)) $criteria->add(NagiosResourcePeer::USER7, $this->user7); + if ($this->isColumnModified(NagiosResourcePeer::USER8)) $criteria->add(NagiosResourcePeer::USER8, $this->user8); + if ($this->isColumnModified(NagiosResourcePeer::USER9)) $criteria->add(NagiosResourcePeer::USER9, $this->user9); + if ($this->isColumnModified(NagiosResourcePeer::USER10)) $criteria->add(NagiosResourcePeer::USER10, $this->user10); + if ($this->isColumnModified(NagiosResourcePeer::USER11)) $criteria->add(NagiosResourcePeer::USER11, $this->user11); + if ($this->isColumnModified(NagiosResourcePeer::USER12)) $criteria->add(NagiosResourcePeer::USER12, $this->user12); + if ($this->isColumnModified(NagiosResourcePeer::USER13)) $criteria->add(NagiosResourcePeer::USER13, $this->user13); + if ($this->isColumnModified(NagiosResourcePeer::USER14)) $criteria->add(NagiosResourcePeer::USER14, $this->user14); + if ($this->isColumnModified(NagiosResourcePeer::USER15)) $criteria->add(NagiosResourcePeer::USER15, $this->user15); + if ($this->isColumnModified(NagiosResourcePeer::USER16)) $criteria->add(NagiosResourcePeer::USER16, $this->user16); + if ($this->isColumnModified(NagiosResourcePeer::USER17)) $criteria->add(NagiosResourcePeer::USER17, $this->user17); + if ($this->isColumnModified(NagiosResourcePeer::USER18)) $criteria->add(NagiosResourcePeer::USER18, $this->user18); + if ($this->isColumnModified(NagiosResourcePeer::USER19)) $criteria->add(NagiosResourcePeer::USER19, $this->user19); + if ($this->isColumnModified(NagiosResourcePeer::USER20)) $criteria->add(NagiosResourcePeer::USER20, $this->user20); + if ($this->isColumnModified(NagiosResourcePeer::USER21)) $criteria->add(NagiosResourcePeer::USER21, $this->user21); + if ($this->isColumnModified(NagiosResourcePeer::USER22)) $criteria->add(NagiosResourcePeer::USER22, $this->user22); + if ($this->isColumnModified(NagiosResourcePeer::USER23)) $criteria->add(NagiosResourcePeer::USER23, $this->user23); + if ($this->isColumnModified(NagiosResourcePeer::USER24)) $criteria->add(NagiosResourcePeer::USER24, $this->user24); + if ($this->isColumnModified(NagiosResourcePeer::USER25)) $criteria->add(NagiosResourcePeer::USER25, $this->user25); + if ($this->isColumnModified(NagiosResourcePeer::USER26)) $criteria->add(NagiosResourcePeer::USER26, $this->user26); + if ($this->isColumnModified(NagiosResourcePeer::USER27)) $criteria->add(NagiosResourcePeer::USER27, $this->user27); + if ($this->isColumnModified(NagiosResourcePeer::USER28)) $criteria->add(NagiosResourcePeer::USER28, $this->user28); + if ($this->isColumnModified(NagiosResourcePeer::USER29)) $criteria->add(NagiosResourcePeer::USER29, $this->user29); + if ($this->isColumnModified(NagiosResourcePeer::USER30)) $criteria->add(NagiosResourcePeer::USER30, $this->user30); + if ($this->isColumnModified(NagiosResourcePeer::USER31)) $criteria->add(NagiosResourcePeer::USER31, $this->user31); + if ($this->isColumnModified(NagiosResourcePeer::USER32)) $criteria->add(NagiosResourcePeer::USER32, $this->user32); + + 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(NagiosResourcePeer::DATABASE_NAME); + + $criteria->add(NagiosResourcePeer::ID, $this->id); + + 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 NagiosResource (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) + { + + $copyObj->setUser1($this->user1); + + $copyObj->setUser2($this->user2); + + $copyObj->setUser3($this->user3); + + $copyObj->setUser4($this->user4); + + $copyObj->setUser5($this->user5); + + $copyObj->setUser6($this->user6); + + $copyObj->setUser7($this->user7); + + $copyObj->setUser8($this->user8); + + $copyObj->setUser9($this->user9); + + $copyObj->setUser10($this->user10); + + $copyObj->setUser11($this->user11); + + $copyObj->setUser12($this->user12); + + $copyObj->setUser13($this->user13); + + $copyObj->setUser14($this->user14); + + $copyObj->setUser15($this->user15); + + $copyObj->setUser16($this->user16); + + $copyObj->setUser17($this->user17); + + $copyObj->setUser18($this->user18); + + $copyObj->setUser19($this->user19); + + $copyObj->setUser20($this->user20); + + $copyObj->setUser21($this->user21); + + $copyObj->setUser22($this->user22); + + $copyObj->setUser23($this->user23); + + $copyObj->setUser24($this->user24); + + $copyObj->setUser25($this->user25); + + $copyObj->setUser26($this->user26); + + $copyObj->setUser27($this->user27); + + $copyObj->setUser28($this->user28); + + $copyObj->setUser29($this->user29); + + $copyObj->setUser30($this->user30); + + $copyObj->setUser31($this->user31); + + $copyObj->setUser32($this->user32); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosResource 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); + $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 NagiosResourcePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosResourcePeer(); + } + return self::$peer; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + +} // BaseNagiosResource diff --git a/classes/om/BaseNagiosResourcePeer.php b/classes/om/BaseNagiosResourcePeer.php new file mode 100755 index 0000000..f03b582 --- /dev/null +++ b/classes/om/BaseNagiosResourcePeer.php @@ -0,0 +1,842 @@ + array ('Id', 'User1', 'User2', 'User3', 'User4', 'User5', 'User6', 'User7', 'User8', 'User9', 'User10', 'User11', 'User12', 'User13', 'User14', 'User15', 'User16', 'User17', 'User18', 'User19', 'User20', 'User21', 'User22', 'User23', 'User24', 'User25', 'User26', 'User27', 'User28', 'User29', 'User30', 'User31', 'User32', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8', 'user9', 'user10', 'user11', 'user12', 'user13', 'user14', 'user15', 'user16', 'user17', 'user18', 'user19', 'user20', 'user21', 'user22', 'user23', 'user24', 'user25', 'user26', 'user27', 'user28', 'user29', 'user30', 'user31', 'user32', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::USER1, self::USER2, self::USER3, self::USER4, self::USER5, self::USER6, self::USER7, self::USER8, self::USER9, self::USER10, self::USER11, self::USER12, self::USER13, self::USER14, self::USER15, self::USER16, self::USER17, self::USER18, self::USER19, self::USER20, self::USER21, self::USER22, self::USER23, self::USER24, self::USER25, self::USER26, self::USER27, self::USER28, self::USER29, self::USER30, self::USER31, self::USER32, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8', 'user9', 'user10', 'user11', 'user12', 'user13', 'user14', 'user15', 'user16', 'user17', 'user18', 'user19', 'user20', 'user21', 'user22', 'user23', 'user24', 'user25', 'user26', 'user27', 'user28', 'user29', 'user30', 'user31', 'user32', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, ) + ); + + /** + * 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, 'User1' => 1, 'User2' => 2, 'User3' => 3, 'User4' => 4, 'User5' => 5, 'User6' => 6, 'User7' => 7, 'User8' => 8, 'User9' => 9, 'User10' => 10, 'User11' => 11, 'User12' => 12, 'User13' => 13, 'User14' => 14, 'User15' => 15, 'User16' => 16, 'User17' => 17, 'User18' => 18, 'User19' => 19, 'User20' => 20, 'User21' => 21, 'User22' => 22, 'User23' => 23, 'User24' => 24, 'User25' => 25, 'User26' => 26, 'User27' => 27, 'User28' => 28, 'User29' => 29, 'User30' => 30, 'User31' => 31, 'User32' => 32, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'user1' => 1, 'user2' => 2, 'user3' => 3, 'user4' => 4, 'user5' => 5, 'user6' => 6, 'user7' => 7, 'user8' => 8, 'user9' => 9, 'user10' => 10, 'user11' => 11, 'user12' => 12, 'user13' => 13, 'user14' => 14, 'user15' => 15, 'user16' => 16, 'user17' => 17, 'user18' => 18, 'user19' => 19, 'user20' => 20, 'user21' => 21, 'user22' => 22, 'user23' => 23, 'user24' => 24, 'user25' => 25, 'user26' => 26, 'user27' => 27, 'user28' => 28, 'user29' => 29, 'user30' => 30, 'user31' => 31, 'user32' => 32, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::USER1 => 1, self::USER2 => 2, self::USER3 => 3, self::USER4 => 4, self::USER5 => 5, self::USER6 => 6, self::USER7 => 7, self::USER8 => 8, self::USER9 => 9, self::USER10 => 10, self::USER11 => 11, self::USER12 => 12, self::USER13 => 13, self::USER14 => 14, self::USER15 => 15, self::USER16 => 16, self::USER17 => 17, self::USER18 => 18, self::USER19 => 19, self::USER20 => 20, self::USER21 => 21, self::USER22 => 22, self::USER23 => 23, self::USER24 => 24, self::USER25 => 25, self::USER26 => 26, self::USER27 => 27, self::USER28 => 28, self::USER29 => 29, self::USER30 => 30, self::USER31 => 31, self::USER32 => 32, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user1' => 1, 'user2' => 2, 'user3' => 3, 'user4' => 4, 'user5' => 5, 'user6' => 6, 'user7' => 7, 'user8' => 8, 'user9' => 9, 'user10' => 10, 'user11' => 11, 'user12' => 12, 'user13' => 13, 'user14' => 14, 'user15' => 15, 'user16' => 16, 'user17' => 17, 'user18' => 18, 'user19' => 19, 'user20' => 20, 'user21' => 21, 'user22' => 22, 'user23' => 23, 'user24' => 24, 'user25' => 25, 'user26' => 26, 'user27' => 27, 'user28' => 28, 'user29' => 29, 'user30' => 30, 'user31' => 31, 'user32' => 32, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosResourceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosResourcePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosResourcePeer::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) + { + + $criteria->addSelectColumn(NagiosResourcePeer::ID); + + $criteria->addSelectColumn(NagiosResourcePeer::USER1); + + $criteria->addSelectColumn(NagiosResourcePeer::USER2); + + $criteria->addSelectColumn(NagiosResourcePeer::USER3); + + $criteria->addSelectColumn(NagiosResourcePeer::USER4); + + $criteria->addSelectColumn(NagiosResourcePeer::USER5); + + $criteria->addSelectColumn(NagiosResourcePeer::USER6); + + $criteria->addSelectColumn(NagiosResourcePeer::USER7); + + $criteria->addSelectColumn(NagiosResourcePeer::USER8); + + $criteria->addSelectColumn(NagiosResourcePeer::USER9); + + $criteria->addSelectColumn(NagiosResourcePeer::USER10); + + $criteria->addSelectColumn(NagiosResourcePeer::USER11); + + $criteria->addSelectColumn(NagiosResourcePeer::USER12); + + $criteria->addSelectColumn(NagiosResourcePeer::USER13); + + $criteria->addSelectColumn(NagiosResourcePeer::USER14); + + $criteria->addSelectColumn(NagiosResourcePeer::USER15); + + $criteria->addSelectColumn(NagiosResourcePeer::USER16); + + $criteria->addSelectColumn(NagiosResourcePeer::USER17); + + $criteria->addSelectColumn(NagiosResourcePeer::USER18); + + $criteria->addSelectColumn(NagiosResourcePeer::USER19); + + $criteria->addSelectColumn(NagiosResourcePeer::USER20); + + $criteria->addSelectColumn(NagiosResourcePeer::USER21); + + $criteria->addSelectColumn(NagiosResourcePeer::USER22); + + $criteria->addSelectColumn(NagiosResourcePeer::USER23); + + $criteria->addSelectColumn(NagiosResourcePeer::USER24); + + $criteria->addSelectColumn(NagiosResourcePeer::USER25); + + $criteria->addSelectColumn(NagiosResourcePeer::USER26); + + $criteria->addSelectColumn(NagiosResourcePeer::USER27); + + $criteria->addSelectColumn(NagiosResourcePeer::USER28); + + $criteria->addSelectColumn(NagiosResourcePeer::USER29); + + $criteria->addSelectColumn(NagiosResourcePeer::USER30); + + $criteria->addSelectColumn(NagiosResourcePeer::USER31); + + $criteria->addSelectColumn(NagiosResourcePeer::USER32); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosResourcePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosResourcePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosResource + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosResourcePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosResourcePeer::populateObjects(NagiosResourcePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosResourcePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosResource $value A NagiosResource object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosResource $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosResource object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosResource) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosResource object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosResource Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosResourcePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosResourcePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosResourcePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosResourcePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosResourcePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosResource or Criteria object. + * + * @param mixed $values Criteria or NagiosResource object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosResource object + } + + if ($criteria->containsKey(NagiosResourcePeer::ID) && $criteria->keyContainsValue(NagiosResourcePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosResourcePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosResource or Criteria object. + * + * @param mixed $values Criteria or NagiosResource object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosResourcePeer::ID); + $selectCriteria->add(NagiosResourcePeer::ID, $criteria->remove(NagiosResourcePeer::ID), $comparison); + + } else { // $values is NagiosResource object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_resource 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(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosResourcePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosResource or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosResource object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosResourcePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosResource) { + // invalidate the cache for this single object + NagiosResourcePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosResourcePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosResourcePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosResource 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 NagiosResource $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(NagiosResource $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosResourcePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosResourcePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosResourcePeer::DATABASE_NAME, NagiosResourcePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosResource + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosResourcePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosResourcePeer::DATABASE_NAME); + $criteria->add(NagiosResourcePeer::ID, $pk); + + $v = NagiosResourcePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosResourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosResourcePeer::DATABASE_NAME); + $criteria->add(NagiosResourcePeer::ID, $pks, Criteria::IN); + $objs = NagiosResourcePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosResourcePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosResourcePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosResourcePeer class: +// +// Propel::getDatabaseMap(NagiosResourcePeer::DATABASE_NAME)->addTableBuilder(NagiosResourcePeer::TABLE_NAME, NagiosResourcePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosResourcePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosResourcePeer::TABLE_NAME, BaseNagiosResourcePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosService.php b/classes/om/BaseNagiosService.php new file mode 100755 index 0000000..03782a3 --- /dev/null +++ b/classes/om/BaseNagiosService.php @@ -0,0 +1,6181 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [display_name] column value. + * + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Get the [host] column value. + * + * @return int + */ + public function getHost() + { + return $this->host; + } + + /** + * Get the [host_template] column value. + * + * @return int + */ + public function getHostTemplate() + { + return $this->host_template; + } + + /** + * Get the [hostgroup] column value. + * + * @return int + */ + public function getHostgroup() + { + return $this->hostgroup; + } + + /** + * Get the [initial_state] column value. + * + * @return string + */ + public function getInitialState() + { + return $this->initial_state; + } + + /** + * Get the [is_volatile] column value. + * + * @return boolean + */ + public function getIsVolatile() + { + return $this->is_volatile; + } + + /** + * Get the [check_command] column value. + * + * @return int + */ + public function getCheckCommand() + { + return $this->check_command; + } + + /** + * Get the [maximum_check_attempts] column value. + * + * @return int + */ + public function getMaximumCheckAttempts() + { + return $this->maximum_check_attempts; + } + + /** + * Get the [normal_check_interval] column value. + * + * @return int + */ + public function getNormalCheckInterval() + { + return $this->normal_check_interval; + } + + /** + * Get the [retry_interval] column value. + * + * @return int + */ + public function getRetryInterval() + { + return $this->retry_interval; + } + + /** + * Get the [first_notification_delay] column value. + * + * @return int + */ + public function getFirstNotificationDelay() + { + return $this->first_notification_delay; + } + + /** + * Get the [active_checks_enabled] column value. + * + * @return boolean + */ + public function getActiveChecksEnabled() + { + return $this->active_checks_enabled; + } + + /** + * Get the [passive_checks_enabled] column value. + * + * @return boolean + */ + public function getPassiveChecksEnabled() + { + return $this->passive_checks_enabled; + } + + /** + * Get the [check_period] column value. + * + * @return int + */ + public function getCheckPeriod() + { + return $this->check_period; + } + + /** + * Get the [parallelize_check] column value. + * + * @return boolean + */ + public function getParallelizeCheck() + { + return $this->parallelize_check; + } + + /** + * Get the [obsess_over_service] column value. + * + * @return boolean + */ + public function getObsessOverService() + { + return $this->obsess_over_service; + } + + /** + * Get the [check_freshness] column value. + * + * @return boolean + */ + public function getCheckFreshness() + { + return $this->check_freshness; + } + + /** + * Get the [freshness_threshold] column value. + * + * @return int + */ + public function getFreshnessThreshold() + { + return $this->freshness_threshold; + } + + /** + * Get the [event_handler] column value. + * + * @return int + */ + public function getEventHandler() + { + return $this->event_handler; + } + + /** + * Get the [event_handler_enabled] column value. + * + * @return boolean + */ + public function getEventHandlerEnabled() + { + return $this->event_handler_enabled; + } + + /** + * Get the [low_flap_threshold] column value. + * + * @return int + */ + public function getLowFlapThreshold() + { + return $this->low_flap_threshold; + } + + /** + * Get the [high_flap_threshold] column value. + * + * @return int + */ + public function getHighFlapThreshold() + { + return $this->high_flap_threshold; + } + + /** + * Get the [flap_detection_enabled] column value. + * + * @return boolean + */ + public function getFlapDetectionEnabled() + { + return $this->flap_detection_enabled; + } + + /** + * Get the [flap_detection_on_ok] column value. + * + * @return boolean + */ + public function getFlapDetectionOnOk() + { + return $this->flap_detection_on_ok; + } + + /** + * Get the [flap_detection_on_warning] column value. + * + * @return boolean + */ + public function getFlapDetectionOnWarning() + { + return $this->flap_detection_on_warning; + } + + /** + * Get the [flap_detection_on_critical] column value. + * + * @return boolean + */ + public function getFlapDetectionOnCritical() + { + return $this->flap_detection_on_critical; + } + + /** + * Get the [flap_detection_on_unknown] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUnknown() + { + return $this->flap_detection_on_unknown; + } + + /** + * Get the [process_perf_data] column value. + * + * @return boolean + */ + public function getProcessPerfData() + { + return $this->process_perf_data; + } + + /** + * Get the [retain_status_information] column value. + * + * @return boolean + */ + public function getRetainStatusInformation() + { + return $this->retain_status_information; + } + + /** + * Get the [retain_nonstatus_information] column value. + * + * @return boolean + */ + public function getRetainNonstatusInformation() + { + return $this->retain_nonstatus_information; + } + + /** + * Get the [notification_interval] column value. + * + * @return int + */ + public function getNotificationInterval() + { + return $this->notification_interval; + } + + /** + * Get the [notification_period] column value. + * + * @return int + */ + public function getNotificationPeriod() + { + return $this->notification_period; + } + + /** + * Get the [notification_on_warning] column value. + * + * @return boolean + */ + public function getNotificationOnWarning() + { + return $this->notification_on_warning; + } + + /** + * Get the [notification_on_unknown] column value. + * + * @return boolean + */ + public function getNotificationOnUnknown() + { + return $this->notification_on_unknown; + } + + /** + * Get the [notification_on_critical] column value. + * + * @return boolean + */ + public function getNotificationOnCritical() + { + return $this->notification_on_critical; + } + + /** + * Get the [notification_on_recovery] column value. + * + * @return boolean + */ + public function getNotificationOnRecovery() + { + return $this->notification_on_recovery; + } + + /** + * Get the [notification_on_flapping] column value. + * + * @return boolean + */ + public function getNotificationOnFlapping() + { + return $this->notification_on_flapping; + } + + /** + * Get the [notification_on_scheduled_downtime] column value. + * + * @return boolean + */ + public function getNotificationOnScheduledDowntime() + { + return $this->notification_on_scheduled_downtime; + } + + /** + * Get the [notifications_enabled] column value. + * + * @return boolean + */ + public function getNotificationsEnabled() + { + return $this->notifications_enabled; + } + + /** + * Get the [stalking_on_ok] column value. + * + * @return boolean + */ + public function getStalkingOnOk() + { + return $this->stalking_on_ok; + } + + /** + * Get the [stalking_on_warning] column value. + * + * @return boolean + */ + public function getStalkingOnWarning() + { + return $this->stalking_on_warning; + } + + /** + * Get the [stalking_on_unknown] column value. + * + * @return boolean + */ + public function getStalkingOnUnknown() + { + return $this->stalking_on_unknown; + } + + /** + * Get the [stalking_on_critical] column value. + * + * @return boolean + */ + public function getStalkingOnCritical() + { + return $this->stalking_on_critical; + } + + /** + * Get the [failure_prediction_enabled] column value. + * + * @return boolean + */ + public function getFailurePredictionEnabled() + { + return $this->failure_prediction_enabled; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Get the [icon_image] column value. + * + * @return string + */ + public function getIconImage() + { + return $this->icon_image; + } + + /** + * Get the [icon_image_alt] column value. + * + * @return string + */ + public function getIconImageAlt() + { + return $this->icon_image_alt; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServicePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = NagiosServicePeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [display_name] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setDisplayName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->display_name !== $v) { + $this->display_name = $v; + $this->modifiedColumns[] = NagiosServicePeer::DISPLAY_NAME; + } + + return $this; + } // setDisplayName() + + /** + * Set the value of [host] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host !== $v) { + $this->host = $v; + $this->modifiedColumns[] = NagiosServicePeer::HOST; + } + + if ($this->aNagiosHost !== null && $this->aNagiosHost->getId() !== $v) { + $this->aNagiosHost = null; + } + + return $this; + } // setHost() + + /** + * Set the value of [host_template] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setHostTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->host_template !== $v) { + $this->host_template = $v; + $this->modifiedColumns[] = NagiosServicePeer::HOST_TEMPLATE; + } + + if ($this->aNagiosHostTemplate !== null && $this->aNagiosHostTemplate->getId() !== $v) { + $this->aNagiosHostTemplate = null; + } + + return $this; + } // setHostTemplate() + + /** + * Set the value of [hostgroup] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setHostgroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->hostgroup !== $v) { + $this->hostgroup = $v; + $this->modifiedColumns[] = NagiosServicePeer::HOSTGROUP; + } + + if ($this->aNagiosHostgroup !== null && $this->aNagiosHostgroup->getId() !== $v) { + $this->aNagiosHostgroup = null; + } + + return $this; + } // setHostgroup() + + /** + * Set the value of [initial_state] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setInitialState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->initial_state !== $v) { + $this->initial_state = $v; + $this->modifiedColumns[] = NagiosServicePeer::INITIAL_STATE; + } + + return $this; + } // setInitialState() + + /** + * Set the value of [is_volatile] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setIsVolatile($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->is_volatile !== $v) { + $this->is_volatile = $v; + $this->modifiedColumns[] = NagiosServicePeer::IS_VOLATILE; + } + + return $this; + } // setIsVolatile() + + /** + * Set the value of [check_command] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setCheckCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_command !== $v) { + $this->check_command = $v; + $this->modifiedColumns[] = NagiosServicePeer::CHECK_COMMAND; + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->aNagiosCommandRelatedByCheckCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + + return $this; + } // setCheckCommand() + + /** + * Set the value of [maximum_check_attempts] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setMaximumCheckAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->maximum_check_attempts !== $v) { + $this->maximum_check_attempts = $v; + $this->modifiedColumns[] = NagiosServicePeer::MAXIMUM_CHECK_ATTEMPTS; + } + + return $this; + } // setMaximumCheckAttempts() + + /** + * Set the value of [normal_check_interval] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNormalCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->normal_check_interval !== $v) { + $this->normal_check_interval = $v; + $this->modifiedColumns[] = NagiosServicePeer::NORMAL_CHECK_INTERVAL; + } + + return $this; + } // setNormalCheckInterval() + + /** + * Set the value of [retry_interval] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setRetryInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retry_interval !== $v) { + $this->retry_interval = $v; + $this->modifiedColumns[] = NagiosServicePeer::RETRY_INTERVAL; + } + + return $this; + } // setRetryInterval() + + /** + * Set the value of [first_notification_delay] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFirstNotificationDelay($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->first_notification_delay !== $v) { + $this->first_notification_delay = $v; + $this->modifiedColumns[] = NagiosServicePeer::FIRST_NOTIFICATION_DELAY; + } + + return $this; + } // setFirstNotificationDelay() + + /** + * Set the value of [active_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setActiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->active_checks_enabled !== $v) { + $this->active_checks_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::ACTIVE_CHECKS_ENABLED; + } + + return $this; + } // setActiveChecksEnabled() + + /** + * Set the value of [passive_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setPassiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->passive_checks_enabled !== $v) { + $this->passive_checks_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::PASSIVE_CHECKS_ENABLED; + } + + return $this; + } // setPassiveChecksEnabled() + + /** + * Set the value of [check_period] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setCheckPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_period !== $v) { + $this->check_period = $v; + $this->modifiedColumns[] = NagiosServicePeer::CHECK_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->aNagiosTimeperiodRelatedByCheckPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + + return $this; + } // setCheckPeriod() + + /** + * Set the value of [parallelize_check] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setParallelizeCheck($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->parallelize_check !== $v) { + $this->parallelize_check = $v; + $this->modifiedColumns[] = NagiosServicePeer::PARALLELIZE_CHECK; + } + + return $this; + } // setParallelizeCheck() + + /** + * Set the value of [obsess_over_service] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setObsessOverService($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_service !== $v) { + $this->obsess_over_service = $v; + $this->modifiedColumns[] = NagiosServicePeer::OBSESS_OVER_SERVICE; + } + + return $this; + } // setObsessOverService() + + /** + * Set the value of [check_freshness] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setCheckFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_freshness !== $v) { + $this->check_freshness = $v; + $this->modifiedColumns[] = NagiosServicePeer::CHECK_FRESHNESS; + } + + return $this; + } // setCheckFreshness() + + /** + * Set the value of [freshness_threshold] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFreshnessThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->freshness_threshold !== $v) { + $this->freshness_threshold = $v; + $this->modifiedColumns[] = NagiosServicePeer::FRESHNESS_THRESHOLD; + } + + return $this; + } // setFreshnessThreshold() + + /** + * Set the value of [event_handler] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->event_handler !== $v) { + $this->event_handler = $v; + $this->modifiedColumns[] = NagiosServicePeer::EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->aNagiosCommandRelatedByEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + + return $this; + } // setEventHandler() + + /** + * Set the value of [event_handler_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setEventHandlerEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->event_handler_enabled !== $v) { + $this->event_handler_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::EVENT_HANDLER_ENABLED; + } + + return $this; + } // setEventHandlerEnabled() + + /** + * Set the value of [low_flap_threshold] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setLowFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->low_flap_threshold !== $v) { + $this->low_flap_threshold = $v; + $this->modifiedColumns[] = NagiosServicePeer::LOW_FLAP_THRESHOLD; + } + + return $this; + } // setLowFlapThreshold() + + /** + * Set the value of [high_flap_threshold] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setHighFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->high_flap_threshold !== $v) { + $this->high_flap_threshold = $v; + $this->modifiedColumns[] = NagiosServicePeer::HIGH_FLAP_THRESHOLD; + } + + return $this; + } // setHighFlapThreshold() + + /** + * Set the value of [flap_detection_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFlapDetectionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_enabled !== $v) { + $this->flap_detection_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::FLAP_DETECTION_ENABLED; + } + + return $this; + } // setFlapDetectionEnabled() + + /** + * Set the value of [flap_detection_on_ok] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFlapDetectionOnOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_ok !== $v) { + $this->flap_detection_on_ok = $v; + $this->modifiedColumns[] = NagiosServicePeer::FLAP_DETECTION_ON_OK; + } + + return $this; + } // setFlapDetectionOnOk() + + /** + * Set the value of [flap_detection_on_warning] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFlapDetectionOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_warning !== $v) { + $this->flap_detection_on_warning = $v; + $this->modifiedColumns[] = NagiosServicePeer::FLAP_DETECTION_ON_WARNING; + } + + return $this; + } // setFlapDetectionOnWarning() + + /** + * Set the value of [flap_detection_on_critical] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFlapDetectionOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_critical !== $v) { + $this->flap_detection_on_critical = $v; + $this->modifiedColumns[] = NagiosServicePeer::FLAP_DETECTION_ON_CRITICAL; + } + + return $this; + } // setFlapDetectionOnCritical() + + /** + * Set the value of [flap_detection_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFlapDetectionOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_unknown !== $v) { + $this->flap_detection_on_unknown = $v; + $this->modifiedColumns[] = NagiosServicePeer::FLAP_DETECTION_ON_UNKNOWN; + } + + return $this; + } // setFlapDetectionOnUnknown() + + /** + * Set the value of [process_perf_data] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setProcessPerfData($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->process_perf_data !== $v) { + $this->process_perf_data = $v; + $this->modifiedColumns[] = NagiosServicePeer::PROCESS_PERF_DATA; + } + + return $this; + } // setProcessPerfData() + + /** + * Set the value of [retain_status_information] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setRetainStatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_status_information !== $v) { + $this->retain_status_information = $v; + $this->modifiedColumns[] = NagiosServicePeer::RETAIN_STATUS_INFORMATION; + } + + return $this; + } // setRetainStatusInformation() + + /** + * Set the value of [retain_nonstatus_information] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setRetainNonstatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_nonstatus_information !== $v) { + $this->retain_nonstatus_information = $v; + $this->modifiedColumns[] = NagiosServicePeer::RETAIN_NONSTATUS_INFORMATION; + } + + return $this; + } // setRetainNonstatusInformation() + + /** + * Set the value of [notification_interval] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_interval !== $v) { + $this->notification_interval = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_INTERVAL; + } + + return $this; + } // setNotificationInterval() + + /** + * Set the value of [notification_period] column. + * + * @param int $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_period !== $v) { + $this->notification_period = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + + return $this; + } // setNotificationPeriod() + + /** + * Set the value of [notification_on_warning] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_warning !== $v) { + $this->notification_on_warning = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_WARNING; + } + + return $this; + } // setNotificationOnWarning() + + /** + * Set the value of [notification_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_unknown !== $v) { + $this->notification_on_unknown = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_UNKNOWN; + } + + return $this; + } // setNotificationOnUnknown() + + /** + * Set the value of [notification_on_critical] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_critical !== $v) { + $this->notification_on_critical = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_CRITICAL; + } + + return $this; + } // setNotificationOnCritical() + + /** + * Set the value of [notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_recovery !== $v) { + $this->notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setNotificationOnRecovery() + + /** + * Set the value of [notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_flapping !== $v) { + $this->notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setNotificationOnFlapping() + + /** + * Set the value of [notification_on_scheduled_downtime] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationOnScheduledDowntime($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_scheduled_downtime !== $v) { + $this->notification_on_scheduled_downtime = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME; + } + + return $this; + } // setNotificationOnScheduledDowntime() + + /** + * Set the value of [notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notifications_enabled !== $v) { + $this->notifications_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTIFICATIONS_ENABLED; + } + + return $this; + } // setNotificationsEnabled() + + /** + * Set the value of [stalking_on_ok] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setStalkingOnOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_ok !== $v) { + $this->stalking_on_ok = $v; + $this->modifiedColumns[] = NagiosServicePeer::STALKING_ON_OK; + } + + return $this; + } // setStalkingOnOk() + + /** + * Set the value of [stalking_on_warning] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setStalkingOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_warning !== $v) { + $this->stalking_on_warning = $v; + $this->modifiedColumns[] = NagiosServicePeer::STALKING_ON_WARNING; + } + + return $this; + } // setStalkingOnWarning() + + /** + * Set the value of [stalking_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setStalkingOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_unknown !== $v) { + $this->stalking_on_unknown = $v; + $this->modifiedColumns[] = NagiosServicePeer::STALKING_ON_UNKNOWN; + } + + return $this; + } // setStalkingOnUnknown() + + /** + * Set the value of [stalking_on_critical] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setStalkingOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_critical !== $v) { + $this->stalking_on_critical = $v; + $this->modifiedColumns[] = NagiosServicePeer::STALKING_ON_CRITICAL; + } + + return $this; + } // setStalkingOnCritical() + + /** + * Set the value of [failure_prediction_enabled] column. + * + * @param boolean $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setFailurePredictionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->failure_prediction_enabled !== $v) { + $this->failure_prediction_enabled = $v; + $this->modifiedColumns[] = NagiosServicePeer::FAILURE_PREDICTION_ENABLED; + } + + return $this; + } // setFailurePredictionEnabled() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosServicePeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosServicePeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Set the value of [icon_image] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setIconImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image !== $v) { + $this->icon_image = $v; + $this->modifiedColumns[] = NagiosServicePeer::ICON_IMAGE; + } + + return $this; + } // setIconImage() + + /** + * Set the value of [icon_image_alt] column. + * + * @param string $v new value + * @return NagiosService The current object (for fluent API support) + */ + public function setIconImageAlt($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image_alt !== $v) { + $this->icon_image_alt = $v; + $this->modifiedColumns[] = NagiosServicePeer::ICON_IMAGE_ALT; + } + + return $this; + } // setIconImageAlt() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->description = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->display_name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->host = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->host_template = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->hostgroup = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->initial_state = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->is_volatile = ($row[$startcol + 7] !== null) ? (boolean) $row[$startcol + 7] : null; + $this->check_command = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->maximum_check_attempts = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->normal_check_interval = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->retry_interval = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; + $this->first_notification_delay = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null; + $this->active_checks_enabled = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->passive_checks_enabled = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->check_period = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null; + $this->parallelize_check = ($row[$startcol + 16] !== null) ? (boolean) $row[$startcol + 16] : null; + $this->obsess_over_service = ($row[$startcol + 17] !== null) ? (boolean) $row[$startcol + 17] : null; + $this->check_freshness = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; + $this->freshness_threshold = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null; + $this->event_handler = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null; + $this->event_handler_enabled = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->low_flap_threshold = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null; + $this->high_flap_threshold = ($row[$startcol + 23] !== null) ? (int) $row[$startcol + 23] : null; + $this->flap_detection_enabled = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; + $this->flap_detection_on_ok = ($row[$startcol + 25] !== null) ? (boolean) $row[$startcol + 25] : null; + $this->flap_detection_on_warning = ($row[$startcol + 26] !== null) ? (boolean) $row[$startcol + 26] : null; + $this->flap_detection_on_critical = ($row[$startcol + 27] !== null) ? (boolean) $row[$startcol + 27] : null; + $this->flap_detection_on_unknown = ($row[$startcol + 28] !== null) ? (boolean) $row[$startcol + 28] : null; + $this->process_perf_data = ($row[$startcol + 29] !== null) ? (boolean) $row[$startcol + 29] : null; + $this->retain_status_information = ($row[$startcol + 30] !== null) ? (boolean) $row[$startcol + 30] : null; + $this->retain_nonstatus_information = ($row[$startcol + 31] !== null) ? (boolean) $row[$startcol + 31] : null; + $this->notification_interval = ($row[$startcol + 32] !== null) ? (int) $row[$startcol + 32] : null; + $this->notification_period = ($row[$startcol + 33] !== null) ? (int) $row[$startcol + 33] : null; + $this->notification_on_warning = ($row[$startcol + 34] !== null) ? (boolean) $row[$startcol + 34] : null; + $this->notification_on_unknown = ($row[$startcol + 35] !== null) ? (boolean) $row[$startcol + 35] : null; + $this->notification_on_critical = ($row[$startcol + 36] !== null) ? (boolean) $row[$startcol + 36] : null; + $this->notification_on_recovery = ($row[$startcol + 37] !== null) ? (boolean) $row[$startcol + 37] : null; + $this->notification_on_flapping = ($row[$startcol + 38] !== null) ? (boolean) $row[$startcol + 38] : null; + $this->notification_on_scheduled_downtime = ($row[$startcol + 39] !== null) ? (boolean) $row[$startcol + 39] : null; + $this->notifications_enabled = ($row[$startcol + 40] !== null) ? (boolean) $row[$startcol + 40] : null; + $this->stalking_on_ok = ($row[$startcol + 41] !== null) ? (boolean) $row[$startcol + 41] : null; + $this->stalking_on_warning = ($row[$startcol + 42] !== null) ? (boolean) $row[$startcol + 42] : null; + $this->stalking_on_unknown = ($row[$startcol + 43] !== null) ? (boolean) $row[$startcol + 43] : null; + $this->stalking_on_critical = ($row[$startcol + 44] !== null) ? (boolean) $row[$startcol + 44] : null; + $this->failure_prediction_enabled = ($row[$startcol + 45] !== null) ? (boolean) $row[$startcol + 45] : null; + $this->notes = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; + $this->notes_url = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; + $this->action_url = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null; + $this->icon_image = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null; + $this->icon_image_alt = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 51; // 51 = NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosService object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosHost !== null && $this->host !== $this->aNagiosHost->getId()) { + $this->aNagiosHost = null; + } + if ($this->aNagiosHostTemplate !== null && $this->host_template !== $this->aNagiosHostTemplate->getId()) { + $this->aNagiosHostTemplate = null; + } + if ($this->aNagiosHostgroup !== null && $this->hostgroup !== $this->aNagiosHostgroup->getId()) { + $this->aNagiosHostgroup = null; + } + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->check_command !== $this->aNagiosCommandRelatedByCheckCommand->getId()) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->check_period !== $this->aNagiosTimeperiodRelatedByCheckPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->event_handler !== $this->aNagiosCommandRelatedByEventHandler->getId()) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->notification_period !== $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServicePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHostgroup = null; + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + $this->collNagiosServiceCheckCommandParameters = null; + $this->lastNagiosServiceCheckCommandParameterCriteria = null; + + $this->collNagiosServiceGroupMembers = null; + $this->lastNagiosServiceGroupMemberCriteria = null; + + $this->collNagiosServiceContactMembers = null; + $this->lastNagiosServiceContactMemberCriteria = null; + + $this->collNagiosServiceContactGroupMembers = null; + $this->lastNagiosServiceContactGroupMemberCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosDependencyTargets = null; + $this->lastNagiosDependencyTargetCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + $this->collNagiosServiceTemplateInheritances = null; + $this->lastNagiosServiceTemplateInheritanceCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServicePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServicePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosHost !== null) { + if ($this->aNagiosHost->isModified() || $this->aNagiosHost->isNew()) { + $affectedRows += $this->aNagiosHost->save($con); + } + $this->setNagiosHost($this->aNagiosHost); + } + + if ($this->aNagiosHostTemplate !== null) { + if ($this->aNagiosHostTemplate->isModified() || $this->aNagiosHostTemplate->isNew()) { + $affectedRows += $this->aNagiosHostTemplate->save($con); + } + $this->setNagiosHostTemplate($this->aNagiosHostTemplate); + } + + if ($this->aNagiosHostgroup !== null) { + if ($this->aNagiosHostgroup->isModified() || $this->aNagiosHostgroup->isNew()) { + $affectedRows += $this->aNagiosHostgroup->save($con); + } + $this->setNagiosHostgroup($this->aNagiosHostgroup); + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null) { + if ($this->aNagiosCommandRelatedByCheckCommand->isModified() || $this->aNagiosCommandRelatedByCheckCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByCheckCommand->save($con); + } + $this->setNagiosCommandRelatedByCheckCommand($this->aNagiosCommandRelatedByCheckCommand); + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if ($this->aNagiosCommandRelatedByEventHandler->isModified() || $this->aNagiosCommandRelatedByEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByEventHandler->save($con); + } + $this->setNagiosCommandRelatedByEventHandler($this->aNagiosCommandRelatedByEventHandler); + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod->isModified() || $this->aNagiosTimeperiodRelatedByCheckPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByCheckPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByCheckPeriod($this->aNagiosTimeperiodRelatedByCheckPeriod); + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByNotificationPeriod($this->aNagiosTimeperiodRelatedByNotificationPeriod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServicePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServicePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServicePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosServiceCheckCommandParameters !== null) { + foreach ($this->collNagiosServiceCheckCommandParameters as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplateInheritances !== null) { + foreach ($this->collNagiosServiceTemplateInheritances as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosHost !== null) { + if (!$this->aNagiosHost->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHost->getValidationFailures()); + } + } + + if ($this->aNagiosHostTemplate !== null) { + if (!$this->aNagiosHostTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosHostgroup !== null) { + if (!$this->aNagiosHostgroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosHostgroup->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null) { + if (!$this->aNagiosCommandRelatedByCheckCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByCheckCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByEventHandler->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByCheckPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByCheckPeriod->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByNotificationPeriod->getValidationFailures()); + } + } + + + if (($retval = NagiosServicePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosServiceCheckCommandParameters !== null) { + foreach ($this->collNagiosServiceCheckCommandParameters as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencyTargets !== null) { + foreach ($this->collNagiosDependencyTargets as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplateInheritances !== null) { + foreach ($this->collNagiosServiceTemplateInheritances as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServicePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDescription(); + break; + case 2: + return $this->getDisplayName(); + break; + case 3: + return $this->getHost(); + break; + case 4: + return $this->getHostTemplate(); + break; + case 5: + return $this->getHostgroup(); + break; + case 6: + return $this->getInitialState(); + break; + case 7: + return $this->getIsVolatile(); + break; + case 8: + return $this->getCheckCommand(); + break; + case 9: + return $this->getMaximumCheckAttempts(); + break; + case 10: + return $this->getNormalCheckInterval(); + break; + case 11: + return $this->getRetryInterval(); + break; + case 12: + return $this->getFirstNotificationDelay(); + break; + case 13: + return $this->getActiveChecksEnabled(); + break; + case 14: + return $this->getPassiveChecksEnabled(); + break; + case 15: + return $this->getCheckPeriod(); + break; + case 16: + return $this->getParallelizeCheck(); + break; + case 17: + return $this->getObsessOverService(); + break; + case 18: + return $this->getCheckFreshness(); + break; + case 19: + return $this->getFreshnessThreshold(); + break; + case 20: + return $this->getEventHandler(); + break; + case 21: + return $this->getEventHandlerEnabled(); + break; + case 22: + return $this->getLowFlapThreshold(); + break; + case 23: + return $this->getHighFlapThreshold(); + break; + case 24: + return $this->getFlapDetectionEnabled(); + break; + case 25: + return $this->getFlapDetectionOnOk(); + break; + case 26: + return $this->getFlapDetectionOnWarning(); + break; + case 27: + return $this->getFlapDetectionOnCritical(); + break; + case 28: + return $this->getFlapDetectionOnUnknown(); + break; + case 29: + return $this->getProcessPerfData(); + break; + case 30: + return $this->getRetainStatusInformation(); + break; + case 31: + return $this->getRetainNonstatusInformation(); + break; + case 32: + return $this->getNotificationInterval(); + break; + case 33: + return $this->getNotificationPeriod(); + break; + case 34: + return $this->getNotificationOnWarning(); + break; + case 35: + return $this->getNotificationOnUnknown(); + break; + case 36: + return $this->getNotificationOnCritical(); + break; + case 37: + return $this->getNotificationOnRecovery(); + break; + case 38: + return $this->getNotificationOnFlapping(); + break; + case 39: + return $this->getNotificationOnScheduledDowntime(); + break; + case 40: + return $this->getNotificationsEnabled(); + break; + case 41: + return $this->getStalkingOnOk(); + break; + case 42: + return $this->getStalkingOnWarning(); + break; + case 43: + return $this->getStalkingOnUnknown(); + break; + case 44: + return $this->getStalkingOnCritical(); + break; + case 45: + return $this->getFailurePredictionEnabled(); + break; + case 46: + return $this->getNotes(); + break; + case 47: + return $this->getNotesUrl(); + break; + case 48: + return $this->getActionUrl(); + break; + case 49: + return $this->getIconImage(); + break; + case 50: + return $this->getIconImageAlt(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServicePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDescription(), + $keys[2] => $this->getDisplayName(), + $keys[3] => $this->getHost(), + $keys[4] => $this->getHostTemplate(), + $keys[5] => $this->getHostgroup(), + $keys[6] => $this->getInitialState(), + $keys[7] => $this->getIsVolatile(), + $keys[8] => $this->getCheckCommand(), + $keys[9] => $this->getMaximumCheckAttempts(), + $keys[10] => $this->getNormalCheckInterval(), + $keys[11] => $this->getRetryInterval(), + $keys[12] => $this->getFirstNotificationDelay(), + $keys[13] => $this->getActiveChecksEnabled(), + $keys[14] => $this->getPassiveChecksEnabled(), + $keys[15] => $this->getCheckPeriod(), + $keys[16] => $this->getParallelizeCheck(), + $keys[17] => $this->getObsessOverService(), + $keys[18] => $this->getCheckFreshness(), + $keys[19] => $this->getFreshnessThreshold(), + $keys[20] => $this->getEventHandler(), + $keys[21] => $this->getEventHandlerEnabled(), + $keys[22] => $this->getLowFlapThreshold(), + $keys[23] => $this->getHighFlapThreshold(), + $keys[24] => $this->getFlapDetectionEnabled(), + $keys[25] => $this->getFlapDetectionOnOk(), + $keys[26] => $this->getFlapDetectionOnWarning(), + $keys[27] => $this->getFlapDetectionOnCritical(), + $keys[28] => $this->getFlapDetectionOnUnknown(), + $keys[29] => $this->getProcessPerfData(), + $keys[30] => $this->getRetainStatusInformation(), + $keys[31] => $this->getRetainNonstatusInformation(), + $keys[32] => $this->getNotificationInterval(), + $keys[33] => $this->getNotificationPeriod(), + $keys[34] => $this->getNotificationOnWarning(), + $keys[35] => $this->getNotificationOnUnknown(), + $keys[36] => $this->getNotificationOnCritical(), + $keys[37] => $this->getNotificationOnRecovery(), + $keys[38] => $this->getNotificationOnFlapping(), + $keys[39] => $this->getNotificationOnScheduledDowntime(), + $keys[40] => $this->getNotificationsEnabled(), + $keys[41] => $this->getStalkingOnOk(), + $keys[42] => $this->getStalkingOnWarning(), + $keys[43] => $this->getStalkingOnUnknown(), + $keys[44] => $this->getStalkingOnCritical(), + $keys[45] => $this->getFailurePredictionEnabled(), + $keys[46] => $this->getNotes(), + $keys[47] => $this->getNotesUrl(), + $keys[48] => $this->getActionUrl(), + $keys[49] => $this->getIconImage(), + $keys[50] => $this->getIconImageAlt(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServicePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDescription($value); + break; + case 2: + $this->setDisplayName($value); + break; + case 3: + $this->setHost($value); + break; + case 4: + $this->setHostTemplate($value); + break; + case 5: + $this->setHostgroup($value); + break; + case 6: + $this->setInitialState($value); + break; + case 7: + $this->setIsVolatile($value); + break; + case 8: + $this->setCheckCommand($value); + break; + case 9: + $this->setMaximumCheckAttempts($value); + break; + case 10: + $this->setNormalCheckInterval($value); + break; + case 11: + $this->setRetryInterval($value); + break; + case 12: + $this->setFirstNotificationDelay($value); + break; + case 13: + $this->setActiveChecksEnabled($value); + break; + case 14: + $this->setPassiveChecksEnabled($value); + break; + case 15: + $this->setCheckPeriod($value); + break; + case 16: + $this->setParallelizeCheck($value); + break; + case 17: + $this->setObsessOverService($value); + break; + case 18: + $this->setCheckFreshness($value); + break; + case 19: + $this->setFreshnessThreshold($value); + break; + case 20: + $this->setEventHandler($value); + break; + case 21: + $this->setEventHandlerEnabled($value); + break; + case 22: + $this->setLowFlapThreshold($value); + break; + case 23: + $this->setHighFlapThreshold($value); + break; + case 24: + $this->setFlapDetectionEnabled($value); + break; + case 25: + $this->setFlapDetectionOnOk($value); + break; + case 26: + $this->setFlapDetectionOnWarning($value); + break; + case 27: + $this->setFlapDetectionOnCritical($value); + break; + case 28: + $this->setFlapDetectionOnUnknown($value); + break; + case 29: + $this->setProcessPerfData($value); + break; + case 30: + $this->setRetainStatusInformation($value); + break; + case 31: + $this->setRetainNonstatusInformation($value); + break; + case 32: + $this->setNotificationInterval($value); + break; + case 33: + $this->setNotificationPeriod($value); + break; + case 34: + $this->setNotificationOnWarning($value); + break; + case 35: + $this->setNotificationOnUnknown($value); + break; + case 36: + $this->setNotificationOnCritical($value); + break; + case 37: + $this->setNotificationOnRecovery($value); + break; + case 38: + $this->setNotificationOnFlapping($value); + break; + case 39: + $this->setNotificationOnScheduledDowntime($value); + break; + case 40: + $this->setNotificationsEnabled($value); + break; + case 41: + $this->setStalkingOnOk($value); + break; + case 42: + $this->setStalkingOnWarning($value); + break; + case 43: + $this->setStalkingOnUnknown($value); + break; + case 44: + $this->setStalkingOnCritical($value); + break; + case 45: + $this->setFailurePredictionEnabled($value); + break; + case 46: + $this->setNotes($value); + break; + case 47: + $this->setNotesUrl($value); + break; + case 48: + $this->setActionUrl($value); + break; + case 49: + $this->setIconImage($value); + break; + case 50: + $this->setIconImageAlt($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServicePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDescription($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDisplayName($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setHost($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setHostTemplate($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHostgroup($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setInitialState($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setIsVolatile($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setCheckCommand($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setMaximumCheckAttempts($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setNormalCheckInterval($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setRetryInterval($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setFirstNotificationDelay($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setActiveChecksEnabled($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setPassiveChecksEnabled($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setCheckPeriod($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setParallelizeCheck($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setObsessOverService($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setCheckFreshness($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setFreshnessThreshold($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setEventHandler($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setEventHandlerEnabled($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setLowFlapThreshold($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setHighFlapThreshold($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setFlapDetectionEnabled($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setFlapDetectionOnOk($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setFlapDetectionOnWarning($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setFlapDetectionOnCritical($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setFlapDetectionOnUnknown($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setProcessPerfData($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setRetainStatusInformation($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setRetainNonstatusInformation($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setNotificationInterval($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setNotificationPeriod($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setNotificationOnWarning($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setNotificationOnUnknown($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setNotificationOnCritical($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setNotificationOnRecovery($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setNotificationOnFlapping($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setNotificationOnScheduledDowntime($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setNotificationsEnabled($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setStalkingOnOk($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setStalkingOnWarning($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setStalkingOnUnknown($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setStalkingOnCritical($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setFailurePredictionEnabled($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setNotes($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setNotesUrl($arr[$keys[47]]); + if (array_key_exists($keys[48], $arr)) $this->setActionUrl($arr[$keys[48]]); + if (array_key_exists($keys[49], $arr)) $this->setIconImage($arr[$keys[49]]); + if (array_key_exists($keys[50], $arr)) $this->setIconImageAlt($arr[$keys[50]]); + } + + /** + * 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(NagiosServicePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServicePeer::ID)) $criteria->add(NagiosServicePeer::ID, $this->id); + if ($this->isColumnModified(NagiosServicePeer::DESCRIPTION)) $criteria->add(NagiosServicePeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(NagiosServicePeer::DISPLAY_NAME)) $criteria->add(NagiosServicePeer::DISPLAY_NAME, $this->display_name); + if ($this->isColumnModified(NagiosServicePeer::HOST)) $criteria->add(NagiosServicePeer::HOST, $this->host); + if ($this->isColumnModified(NagiosServicePeer::HOST_TEMPLATE)) $criteria->add(NagiosServicePeer::HOST_TEMPLATE, $this->host_template); + if ($this->isColumnModified(NagiosServicePeer::HOSTGROUP)) $criteria->add(NagiosServicePeer::HOSTGROUP, $this->hostgroup); + if ($this->isColumnModified(NagiosServicePeer::INITIAL_STATE)) $criteria->add(NagiosServicePeer::INITIAL_STATE, $this->initial_state); + if ($this->isColumnModified(NagiosServicePeer::IS_VOLATILE)) $criteria->add(NagiosServicePeer::IS_VOLATILE, $this->is_volatile); + if ($this->isColumnModified(NagiosServicePeer::CHECK_COMMAND)) $criteria->add(NagiosServicePeer::CHECK_COMMAND, $this->check_command); + if ($this->isColumnModified(NagiosServicePeer::MAXIMUM_CHECK_ATTEMPTS)) $criteria->add(NagiosServicePeer::MAXIMUM_CHECK_ATTEMPTS, $this->maximum_check_attempts); + if ($this->isColumnModified(NagiosServicePeer::NORMAL_CHECK_INTERVAL)) $criteria->add(NagiosServicePeer::NORMAL_CHECK_INTERVAL, $this->normal_check_interval); + if ($this->isColumnModified(NagiosServicePeer::RETRY_INTERVAL)) $criteria->add(NagiosServicePeer::RETRY_INTERVAL, $this->retry_interval); + if ($this->isColumnModified(NagiosServicePeer::FIRST_NOTIFICATION_DELAY)) $criteria->add(NagiosServicePeer::FIRST_NOTIFICATION_DELAY, $this->first_notification_delay); + if ($this->isColumnModified(NagiosServicePeer::ACTIVE_CHECKS_ENABLED)) $criteria->add(NagiosServicePeer::ACTIVE_CHECKS_ENABLED, $this->active_checks_enabled); + if ($this->isColumnModified(NagiosServicePeer::PASSIVE_CHECKS_ENABLED)) $criteria->add(NagiosServicePeer::PASSIVE_CHECKS_ENABLED, $this->passive_checks_enabled); + if ($this->isColumnModified(NagiosServicePeer::CHECK_PERIOD)) $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->check_period); + if ($this->isColumnModified(NagiosServicePeer::PARALLELIZE_CHECK)) $criteria->add(NagiosServicePeer::PARALLELIZE_CHECK, $this->parallelize_check); + if ($this->isColumnModified(NagiosServicePeer::OBSESS_OVER_SERVICE)) $criteria->add(NagiosServicePeer::OBSESS_OVER_SERVICE, $this->obsess_over_service); + if ($this->isColumnModified(NagiosServicePeer::CHECK_FRESHNESS)) $criteria->add(NagiosServicePeer::CHECK_FRESHNESS, $this->check_freshness); + if ($this->isColumnModified(NagiosServicePeer::FRESHNESS_THRESHOLD)) $criteria->add(NagiosServicePeer::FRESHNESS_THRESHOLD, $this->freshness_threshold); + if ($this->isColumnModified(NagiosServicePeer::EVENT_HANDLER)) $criteria->add(NagiosServicePeer::EVENT_HANDLER, $this->event_handler); + if ($this->isColumnModified(NagiosServicePeer::EVENT_HANDLER_ENABLED)) $criteria->add(NagiosServicePeer::EVENT_HANDLER_ENABLED, $this->event_handler_enabled); + if ($this->isColumnModified(NagiosServicePeer::LOW_FLAP_THRESHOLD)) $criteria->add(NagiosServicePeer::LOW_FLAP_THRESHOLD, $this->low_flap_threshold); + if ($this->isColumnModified(NagiosServicePeer::HIGH_FLAP_THRESHOLD)) $criteria->add(NagiosServicePeer::HIGH_FLAP_THRESHOLD, $this->high_flap_threshold); + if ($this->isColumnModified(NagiosServicePeer::FLAP_DETECTION_ENABLED)) $criteria->add(NagiosServicePeer::FLAP_DETECTION_ENABLED, $this->flap_detection_enabled); + if ($this->isColumnModified(NagiosServicePeer::FLAP_DETECTION_ON_OK)) $criteria->add(NagiosServicePeer::FLAP_DETECTION_ON_OK, $this->flap_detection_on_ok); + if ($this->isColumnModified(NagiosServicePeer::FLAP_DETECTION_ON_WARNING)) $criteria->add(NagiosServicePeer::FLAP_DETECTION_ON_WARNING, $this->flap_detection_on_warning); + if ($this->isColumnModified(NagiosServicePeer::FLAP_DETECTION_ON_CRITICAL)) $criteria->add(NagiosServicePeer::FLAP_DETECTION_ON_CRITICAL, $this->flap_detection_on_critical); + if ($this->isColumnModified(NagiosServicePeer::FLAP_DETECTION_ON_UNKNOWN)) $criteria->add(NagiosServicePeer::FLAP_DETECTION_ON_UNKNOWN, $this->flap_detection_on_unknown); + if ($this->isColumnModified(NagiosServicePeer::PROCESS_PERF_DATA)) $criteria->add(NagiosServicePeer::PROCESS_PERF_DATA, $this->process_perf_data); + if ($this->isColumnModified(NagiosServicePeer::RETAIN_STATUS_INFORMATION)) $criteria->add(NagiosServicePeer::RETAIN_STATUS_INFORMATION, $this->retain_status_information); + if ($this->isColumnModified(NagiosServicePeer::RETAIN_NONSTATUS_INFORMATION)) $criteria->add(NagiosServicePeer::RETAIN_NONSTATUS_INFORMATION, $this->retain_nonstatus_information); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_INTERVAL)) $criteria->add(NagiosServicePeer::NOTIFICATION_INTERVAL, $this->notification_interval); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_PERIOD)) $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->notification_period); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_WARNING)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_WARNING, $this->notification_on_warning); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_UNKNOWN)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_UNKNOWN, $this->notification_on_unknown); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_CRITICAL)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_CRITICAL, $this->notification_on_critical); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_RECOVERY, $this->notification_on_recovery); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_FLAPPING, $this->notification_on_flapping); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME)) $criteria->add(NagiosServicePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME, $this->notification_on_scheduled_downtime); + if ($this->isColumnModified(NagiosServicePeer::NOTIFICATIONS_ENABLED)) $criteria->add(NagiosServicePeer::NOTIFICATIONS_ENABLED, $this->notifications_enabled); + if ($this->isColumnModified(NagiosServicePeer::STALKING_ON_OK)) $criteria->add(NagiosServicePeer::STALKING_ON_OK, $this->stalking_on_ok); + if ($this->isColumnModified(NagiosServicePeer::STALKING_ON_WARNING)) $criteria->add(NagiosServicePeer::STALKING_ON_WARNING, $this->stalking_on_warning); + if ($this->isColumnModified(NagiosServicePeer::STALKING_ON_UNKNOWN)) $criteria->add(NagiosServicePeer::STALKING_ON_UNKNOWN, $this->stalking_on_unknown); + if ($this->isColumnModified(NagiosServicePeer::STALKING_ON_CRITICAL)) $criteria->add(NagiosServicePeer::STALKING_ON_CRITICAL, $this->stalking_on_critical); + if ($this->isColumnModified(NagiosServicePeer::FAILURE_PREDICTION_ENABLED)) $criteria->add(NagiosServicePeer::FAILURE_PREDICTION_ENABLED, $this->failure_prediction_enabled); + if ($this->isColumnModified(NagiosServicePeer::NOTES)) $criteria->add(NagiosServicePeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosServicePeer::NOTES_URL)) $criteria->add(NagiosServicePeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosServicePeer::ACTION_URL)) $criteria->add(NagiosServicePeer::ACTION_URL, $this->action_url); + if ($this->isColumnModified(NagiosServicePeer::ICON_IMAGE)) $criteria->add(NagiosServicePeer::ICON_IMAGE, $this->icon_image); + if ($this->isColumnModified(NagiosServicePeer::ICON_IMAGE_ALT)) $criteria->add(NagiosServicePeer::ICON_IMAGE_ALT, $this->icon_image_alt); + + 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(NagiosServicePeer::DATABASE_NAME); + + $criteria->add(NagiosServicePeer::ID, $this->id); + + 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 NagiosService (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) + { + + $copyObj->setDescription($this->description); + + $copyObj->setDisplayName($this->display_name); + + $copyObj->setHost($this->host); + + $copyObj->setHostTemplate($this->host_template); + + $copyObj->setHostgroup($this->hostgroup); + + $copyObj->setInitialState($this->initial_state); + + $copyObj->setIsVolatile($this->is_volatile); + + $copyObj->setCheckCommand($this->check_command); + + $copyObj->setMaximumCheckAttempts($this->maximum_check_attempts); + + $copyObj->setNormalCheckInterval($this->normal_check_interval); + + $copyObj->setRetryInterval($this->retry_interval); + + $copyObj->setFirstNotificationDelay($this->first_notification_delay); + + $copyObj->setActiveChecksEnabled($this->active_checks_enabled); + + $copyObj->setPassiveChecksEnabled($this->passive_checks_enabled); + + $copyObj->setCheckPeriod($this->check_period); + + $copyObj->setParallelizeCheck($this->parallelize_check); + + $copyObj->setObsessOverService($this->obsess_over_service); + + $copyObj->setCheckFreshness($this->check_freshness); + + $copyObj->setFreshnessThreshold($this->freshness_threshold); + + $copyObj->setEventHandler($this->event_handler); + + $copyObj->setEventHandlerEnabled($this->event_handler_enabled); + + $copyObj->setLowFlapThreshold($this->low_flap_threshold); + + $copyObj->setHighFlapThreshold($this->high_flap_threshold); + + $copyObj->setFlapDetectionEnabled($this->flap_detection_enabled); + + $copyObj->setFlapDetectionOnOk($this->flap_detection_on_ok); + + $copyObj->setFlapDetectionOnWarning($this->flap_detection_on_warning); + + $copyObj->setFlapDetectionOnCritical($this->flap_detection_on_critical); + + $copyObj->setFlapDetectionOnUnknown($this->flap_detection_on_unknown); + + $copyObj->setProcessPerfData($this->process_perf_data); + + $copyObj->setRetainStatusInformation($this->retain_status_information); + + $copyObj->setRetainNonstatusInformation($this->retain_nonstatus_information); + + $copyObj->setNotificationInterval($this->notification_interval); + + $copyObj->setNotificationPeriod($this->notification_period); + + $copyObj->setNotificationOnWarning($this->notification_on_warning); + + $copyObj->setNotificationOnUnknown($this->notification_on_unknown); + + $copyObj->setNotificationOnCritical($this->notification_on_critical); + + $copyObj->setNotificationOnRecovery($this->notification_on_recovery); + + $copyObj->setNotificationOnFlapping($this->notification_on_flapping); + + $copyObj->setNotificationOnScheduledDowntime($this->notification_on_scheduled_downtime); + + $copyObj->setNotificationsEnabled($this->notifications_enabled); + + $copyObj->setStalkingOnOk($this->stalking_on_ok); + + $copyObj->setStalkingOnWarning($this->stalking_on_warning); + + $copyObj->setStalkingOnUnknown($this->stalking_on_unknown); + + $copyObj->setStalkingOnCritical($this->stalking_on_critical); + + $copyObj->setFailurePredictionEnabled($this->failure_prediction_enabled); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + $copyObj->setIconImage($this->icon_image); + + $copyObj->setIconImageAlt($this->icon_image_alt); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosServiceCheckCommandParameters() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceCheckCommandParameter($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencyTargets() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependencyTarget($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplateInheritances() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateInheritance($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosService 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); + $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 NagiosServicePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServicePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosHost object. + * + * @param NagiosHost $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHost(NagiosHost $v = null) + { + if ($v === null) { + $this->setHost(NULL); + } else { + $this->setHost($v->getId()); + } + + $this->aNagiosHost = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHost object, it will not be re-added. + if ($v !== null) { + $v->addNagiosService($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHost object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHost The associated NagiosHost object. + * @throws PropelException + */ + public function getNagiosHost(PropelPDO $con = null) + { + if ($this->aNagiosHost === null && ($this->host !== null)) { + $c = new Criteria(NagiosHostPeer::DATABASE_NAME); + $c->add(NagiosHostPeer::ID, $this->host); + $this->aNagiosHost = NagiosHostPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHost->addNagiosServices($this); + */ + } + return $this->aNagiosHost; + } + + /** + * Declares an association between this object and a NagiosHostTemplate object. + * + * @param NagiosHostTemplate $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostTemplate(NagiosHostTemplate $v = null) + { + if ($v === null) { + $this->setHostTemplate(NULL); + } else { + $this->setHostTemplate($v->getId()); + } + + $this->aNagiosHostTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosService($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostTemplate The associated NagiosHostTemplate object. + * @throws PropelException + */ + public function getNagiosHostTemplate(PropelPDO $con = null) + { + if ($this->aNagiosHostTemplate === null && ($this->host_template !== null)) { + $c = new Criteria(NagiosHostTemplatePeer::DATABASE_NAME); + $c->add(NagiosHostTemplatePeer::ID, $this->host_template); + $this->aNagiosHostTemplate = NagiosHostTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostTemplate->addNagiosServices($this); + */ + } + return $this->aNagiosHostTemplate; + } + + /** + * Declares an association between this object and a NagiosHostgroup object. + * + * @param NagiosHostgroup $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosHostgroup(NagiosHostgroup $v = null) + { + if ($v === null) { + $this->setHostgroup(NULL); + } else { + $this->setHostgroup($v->getId()); + } + + $this->aNagiosHostgroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosHostgroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosService($this); + } + + return $this; + } + + + /** + * Get the associated NagiosHostgroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosHostgroup The associated NagiosHostgroup object. + * @throws PropelException + */ + public function getNagiosHostgroup(PropelPDO $con = null) + { + if ($this->aNagiosHostgroup === null && ($this->hostgroup !== null)) { + $c = new Criteria(NagiosHostgroupPeer::DATABASE_NAME); + $c->add(NagiosHostgroupPeer::ID, $this->hostgroup); + $this->aNagiosHostgroup = NagiosHostgroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosHostgroup->addNagiosServices($this); + */ + } + return $this->aNagiosHostgroup; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByCheckCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setCheckCommand(NULL); + } else { + $this->setCheckCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByCheckCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceRelatedByCheckCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByCheckCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByCheckCommand === null && ($this->check_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->check_command); + $this->aNagiosCommandRelatedByCheckCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByCheckCommand->addNagiosServicesRelatedByCheckCommand($this); + */ + } + return $this->aNagiosCommandRelatedByCheckCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setEventHandler(NULL); + } else { + $this->setEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceRelatedByEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByEventHandler === null && ($this->event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->event_handler); + $this->aNagiosCommandRelatedByEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByEventHandler->addNagiosServicesRelatedByEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByEventHandler; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByCheckPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setCheckPeriod(NULL); + } else { + $this->setCheckPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByCheckPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceRelatedByCheckPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByCheckPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod === null && ($this->check_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->check_period); + $this->aNagiosTimeperiodRelatedByCheckPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByCheckPeriod->addNagiosServicesRelatedByCheckPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByCheckPeriod; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosService The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setNotificationPeriod(NULL); + } else { + $this->setNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceRelatedByNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod === null && ($this->notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->notification_period); + $this->aNagiosTimeperiodRelatedByNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByNotificationPeriod->addNagiosServicesRelatedByNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosServiceCheckCommandParameters collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceCheckCommandParameters() + */ + public function clearNagiosServiceCheckCommandParameters() + { + $this->collNagiosServiceCheckCommandParameters = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceCheckCommandParameters collection (array). + * + * By default this just sets the collNagiosServiceCheckCommandParameters collection to an empty array (like clearcollNagiosServiceCheckCommandParameters()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceCheckCommandParameters() + { + $this->collNagiosServiceCheckCommandParameters = array(); + } + + /** + * Gets an array of NagiosServiceCheckCommandParameter objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosServiceCheckCommandParameters from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceCheckCommandParameter[] + * @throws PropelException + */ + public function getNagiosServiceCheckCommandParameters($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosServiceCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::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. + + + $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceCheckCommandParameterCriteria = $criteria; + return $this->collNagiosServiceCheckCommandParameters; + } + + /** + * Returns the number of related NagiosServiceCheckCommandParameter objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceCheckCommandParameter objects. + * @throws PropelException + */ + public function countNagiosServiceCheckCommandParameters(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + $count = NagiosServiceCheckCommandParameterPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $count = NagiosServiceCheckCommandParameterPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceCheckCommandParameters); + } + } else { + $count = count($this->collNagiosServiceCheckCommandParameters); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceCheckCommandParameter object to this object + * through the NagiosServiceCheckCommandParameter foreign key attribute. + * + * @param NagiosServiceCheckCommandParameter $l NagiosServiceCheckCommandParameter + * @return void + * @throws PropelException + */ + public function addNagiosServiceCheckCommandParameter(NagiosServiceCheckCommandParameter $l) + { + if ($this->collNagiosServiceCheckCommandParameters === null) { + $this->initNagiosServiceCheckCommandParameters(); + } + if (!in_array($l, $this->collNagiosServiceCheckCommandParameters, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceCheckCommandParameters, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceCheckCommandParameters 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 NagiosService. + */ + public function getNagiosServiceCheckCommandParametersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosServiceCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCheckCommandParameterCriteria = $criteria; + + return $this->collNagiosServiceCheckCommandParameters; + } + + /** + * Clears out the collNagiosServiceGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceGroupMembers() + */ + public function clearNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceGroupMembers collection to an empty array (like clearcollNagiosServiceGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosServiceGroupMembers from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::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. + + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + return $this->collNagiosServiceGroupMembers; + } + + /** + * Returns the number of related NagiosServiceGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + $count = NagiosServiceGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceGroupMember object to this object + * through the NagiosServiceGroupMember foreign key attribute. + * + * @param NagiosServiceGroupMember $l NagiosServiceGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceGroupMember(NagiosServiceGroupMember $l) + { + if ($this->collNagiosServiceGroupMembers === null) { + $this->initNagiosServiceGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceGroupMembers, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosService. + */ + public function getNagiosServiceGroupMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosService. + */ + public function getNagiosServiceGroupMembersJoinNagiosServiceGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceGroup($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + /** + * Clears out the collNagiosServiceContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactMembers() + */ + public function clearNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactMembers collection (array). + * + * By default this just sets the collNagiosServiceContactMembers collection to an empty array (like clearcollNagiosServiceContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosServiceContactMembers from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactMember[] + * @throws PropelException + */ + public function getNagiosServiceContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::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. + + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + return $this->collNagiosServiceContactMembers; + } + + /** + * Returns the number of related NagiosServiceContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + $count = NagiosServiceContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactMember object to this object + * through the NagiosServiceContactMember foreign key attribute. + * + * @param NagiosServiceContactMember $l NagiosServiceContactMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactMember(NagiosServiceContactMember $l) + { + if ($this->collNagiosServiceContactMembers === null) { + $this->initNagiosServiceContactMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactMembers, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosService. + */ + public function getNagiosServiceContactMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosService. + */ + public function getNagiosServiceContactMembersJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + /** + * Clears out the collNagiosServiceContactGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactGroupMembers() + */ + public function clearNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceContactGroupMembers collection to an empty array (like clearcollNagiosServiceContactGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosServiceContactGroupMembers from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceContactGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::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. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Returns the number of related NagiosServiceContactGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + $count = NagiosServiceContactGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactGroupMember object to this object + * through the NagiosServiceContactGroupMember foreign key attribute. + * + * @param NagiosServiceContactGroupMember $l NagiosServiceContactGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactGroupMember(NagiosServiceContactGroupMember $l) + { + if ($this->collNagiosServiceContactGroupMembers === null) { + $this->initNagiosServiceContactGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactGroupMembers, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosService. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosService. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosService. + */ + public function getNagiosDependencysJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosService. + */ + public function getNagiosDependencysJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosService. + */ + public function getNagiosDependencysJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosService. + */ + public function getNagiosDependencysJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosService. + */ + public function getNagiosDependencysJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosDependencyTargets collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencyTargets() + */ + public function clearNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencyTargets collection (array). + * + * By default this just sets the collNagiosDependencyTargets collection to an empty array (like clearcollNagiosDependencyTargets()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencyTargets() + { + $this->collNagiosDependencyTargets = array(); + } + + /** + * Gets an array of NagiosDependencyTarget objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosDependencyTargets from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependencyTarget[] + * @throws PropelException + */ + public function getNagiosDependencyTargets($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::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. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + NagiosDependencyTargetPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + return $this->collNagiosDependencyTargets; + } + + /** + * Returns the number of related NagiosDependencyTarget objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependencyTarget objects. + * @throws PropelException + */ + public function countNagiosDependencyTargets(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + $count = NagiosDependencyTargetPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $count = NagiosDependencyTargetPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencyTargets); + } + } else { + $count = count($this->collNagiosDependencyTargets); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependencyTarget object to this object + * through the NagiosDependencyTarget foreign key attribute. + * + * @param NagiosDependencyTarget $l NagiosDependencyTarget + * @return void + * @throws PropelException + */ + public function addNagiosDependencyTarget(NagiosDependencyTarget $l) + { + if ($this->collNagiosDependencyTargets === null) { + $this->initNagiosDependencyTargets(); + } + if (!in_array($l, $this->collNagiosDependencyTargets, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencyTargets, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosService. + */ + public function getNagiosDependencyTargetsJoinNagiosDependency($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosDependency($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosService. + */ + public function getNagiosDependencyTargetsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosDependencyTargets 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 NagiosService. + */ + public function getNagiosDependencyTargetsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencyTargets === null) { + if ($this->isNew()) { + $this->collNagiosDependencyTargets = array(); + } else { + + $criteria->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyTargetPeer::TARGET_SERVICE, $this->id); + + if (!isset($this->lastNagiosDependencyTargetCriteria) || !$this->lastNagiosDependencyTargetCriteria->equals($criteria)) { + $this->collNagiosDependencyTargets = NagiosDependencyTargetPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyTargetCriteria = $criteria; + + return $this->collNagiosDependencyTargets; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosService. + */ + public function getNagiosEscalationsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosService. + */ + public function getNagiosEscalationsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosService. + */ + public function getNagiosEscalationsJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosService. + */ + public function getNagiosEscalationsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosService. + */ + public function getNagiosEscalationsJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Clears out the collNagiosServiceTemplateInheritances collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplateInheritances() + */ + public function clearNagiosServiceTemplateInheritances() + { + $this->collNagiosServiceTemplateInheritances = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplateInheritances collection (array). + * + * By default this just sets the collNagiosServiceTemplateInheritances collection to an empty array (like clearcollNagiosServiceTemplateInheritances()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplateInheritances() + { + $this->collNagiosServiceTemplateInheritances = array(); + } + + /** + * Gets an array of NagiosServiceTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosService has previously been saved, it will retrieve + * related NagiosServiceTemplateInheritances from storage. If this NagiosService is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosServiceTemplateInheritances($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritances = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::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. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateInheritanceCriteria) || !$this->lastNagiosServiceTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateInheritanceCriteria = $criteria; + return $this->collNagiosServiceTemplateInheritances; + } + + /** + * Returns the number of related NagiosServiceTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosServiceTemplateInheritances(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplateInheritances === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + $count = NagiosServiceTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceCriteria) || !$this->lastNagiosServiceTemplateInheritanceCriteria->equals($criteria)) { + $count = NagiosServiceTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplateInheritances); + } + } else { + $count = count($this->collNagiosServiceTemplateInheritances); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplateInheritance object to this object + * through the NagiosServiceTemplateInheritance foreign key attribute. + * + * @param NagiosServiceTemplateInheritance $l NagiosServiceTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateInheritance(NagiosServiceTemplateInheritance $l) + { + if ($this->collNagiosServiceTemplateInheritances === null) { + $this->initNagiosServiceTemplateInheritances(); + } + if (!in_array($l, $this->collNagiosServiceTemplateInheritances, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplateInheritances, $l); + $l->setNagiosService($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceTemplateInheritances 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 NagiosService. + */ + public function getNagiosServiceTemplateInheritancesJoinNagiosServiceTemplateRelatedBySourceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritances = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosServiceTemplateRelatedBySourceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceCriteria) || !$this->lastNagiosServiceTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosServiceTemplateRelatedBySourceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateInheritanceCriteria = $criteria; + + return $this->collNagiosServiceTemplateInheritances; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosService is new, it will return + * an empty collection; or if this NagiosService has previously + * been saved, it will retrieve related NagiosServiceTemplateInheritances 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 NagiosService. + */ + public function getNagiosServiceTemplateInheritancesJoinNagiosServiceTemplateRelatedByTargetTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritances === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritances = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosServiceTemplateRelatedByTargetTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceCriteria) || !$this->lastNagiosServiceTemplateInheritanceCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritances = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosServiceTemplateRelatedByTargetTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateInheritanceCriteria = $criteria; + + return $this->collNagiosServiceTemplateInheritances; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosServiceCheckCommandParameters) { + foreach ((array) $this->collNagiosServiceCheckCommandParameters as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceGroupMembers) { + foreach ((array) $this->collNagiosServiceGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactMembers) { + foreach ((array) $this->collNagiosServiceContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactGroupMembers) { + foreach ((array) $this->collNagiosServiceContactGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencyTargets) { + foreach ((array) $this->collNagiosDependencyTargets as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplateInheritances) { + foreach ((array) $this->collNagiosServiceTemplateInheritances as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosServiceCheckCommandParameters = null; + $this->collNagiosServiceGroupMembers = null; + $this->collNagiosServiceContactMembers = null; + $this->collNagiosServiceContactGroupMembers = null; + $this->collNagiosDependencys = null; + $this->collNagiosDependencyTargets = null; + $this->collNagiosEscalations = null; + $this->collNagiosServiceTemplateInheritances = null; + $this->aNagiosHost = null; + $this->aNagiosHostTemplate = null; + $this->aNagiosHostgroup = null; + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + +} // BaseNagiosService diff --git a/classes/om/BaseNagiosServiceCheckCommandParameter.php b/classes/om/BaseNagiosServiceCheckCommandParameter.php new file mode 100755 index 0000000..ad916ab --- /dev/null +++ b/classes/om/BaseNagiosServiceCheckCommandParameter.php @@ -0,0 +1,933 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [template] column value. + * + * @return int + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Get the [parameter] column value. + * + * @return string + */ + public function getParameter() + { + return $this->parameter; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceCheckCommandParameterPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosServiceCheckCommandParameterPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [template] column. + * + * @param int $v new value + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + */ + public function setTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->template !== $v) { + $this->template = $v; + $this->modifiedColumns[] = NagiosServiceCheckCommandParameterPeer::TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setTemplate() + + /** + * Set the value of [parameter] column. + * + * @param string $v new value + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + */ + public function setParameter($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->parameter !== $v) { + $this->parameter = $v; + $this->modifiedColumns[] = NagiosServiceCheckCommandParameterPeer::PARAMETER; + } + + return $this; + } // setParameter() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->service = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->parameter = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceCheckCommandParameter object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceCheckCommandParameterPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceCheckCommandParameterPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceCheckCommandParameterPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceCheckCommandParameterPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceCheckCommandParameterPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceCheckCommandParameterPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceCheckCommandParameterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getService(); + break; + case 2: + return $this->getTemplate(); + break; + case 3: + return $this->getParameter(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceCheckCommandParameterPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getService(), + $keys[2] => $this->getTemplate(), + $keys[3] => $this->getParameter(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceCheckCommandParameterPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setService($value); + break; + case 2: + $this->setTemplate($value); + break; + case 3: + $this->setParameter($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceCheckCommandParameterPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setService($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setParameter($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(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceCheckCommandParameterPeer::ID)) $criteria->add(NagiosServiceCheckCommandParameterPeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceCheckCommandParameterPeer::SERVICE)) $criteria->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosServiceCheckCommandParameterPeer::TEMPLATE)) $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->template); + if ($this->isColumnModified(NagiosServiceCheckCommandParameterPeer::PARAMETER)) $criteria->add(NagiosServiceCheckCommandParameterPeer::PARAMETER, $this->parameter); + + 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(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + + $criteria->add(NagiosServiceCheckCommandParameterPeer::ID, $this->id); + + 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 NagiosServiceCheckCommandParameter (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) + { + + $copyObj->setService($this->service); + + $copyObj->setTemplate($this->template); + + $copyObj->setParameter($this->parameter); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceCheckCommandParameter 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); + $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 NagiosServiceCheckCommandParameterPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceCheckCommandParameterPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceCheckCommandParameter($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosServiceCheckCommandParameters($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceCheckCommandParameter The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setTemplate(NULL); + } else { + $this->setTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceCheckCommandParameter($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosServiceCheckCommandParameters($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + } + +} // BaseNagiosServiceCheckCommandParameter diff --git a/classes/om/BaseNagiosServiceCheckCommandParameterPeer.php b/classes/om/BaseNagiosServiceCheckCommandParameterPeer.php new file mode 100755 index 0000000..f71893c --- /dev/null +++ b/classes/om/BaseNagiosServiceCheckCommandParameterPeer.php @@ -0,0 +1,1321 @@ + array ('Id', 'Service', 'Template', 'Parameter', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'service', 'template', 'parameter', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SERVICE, self::TEMPLATE, self::PARAMETER, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'service', 'template', 'parameter', ), + 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, 'Service' => 1, 'Template' => 2, 'Parameter' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'parameter' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SERVICE => 1, self::TEMPLATE => 2, self::PARAMETER => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'parameter' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceCheckCommandParameterMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceCheckCommandParameterPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceCheckCommandParameterPeer::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) + { + + $criteria->addSelectColumn(NagiosServiceCheckCommandParameterPeer::ID); + + $criteria->addSelectColumn(NagiosServiceCheckCommandParameterPeer::SERVICE); + + $criteria->addSelectColumn(NagiosServiceCheckCommandParameterPeer::TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceCheckCommandParameterPeer::PARAMETER); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceCheckCommandParameter + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceCheckCommandParameterPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceCheckCommandParameterPeer::populateObjects(NagiosServiceCheckCommandParameterPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceCheckCommandParameter $value A NagiosServiceCheckCommandParameter object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceCheckCommandParameter $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceCheckCommandParameter object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceCheckCommandParameter) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceCheckCommandParameter object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceCheckCommandParameter Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceCheckCommandParameterPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceCheckCommandParameter objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($c); + $startcol = (NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to $obj2 (NagiosService) + $obj2->addNagiosServiceCheckCommandParameter($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceCheckCommandParameter objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($c); + $startcol = (NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceCheckCommandParameter($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceCheckCommandParameter objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceCheckCommandParameter($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceCheckCommandParameter($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceCheckCommandParameter objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosServiceTemplate rows + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to the collection in $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceCheckCommandParameter($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceCheckCommandParameter objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceCheckCommandParameter objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceCheckCommandParameterPeer::NUM_COLUMNS - NagiosServiceCheckCommandParameterPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceCheckCommandParameterPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceCheckCommandParameterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceCheckCommandParameterPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceCheckCommandParameterPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceCheckCommandParameter) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceCheckCommandParameter($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceCheckCommandParameterPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceCheckCommandParameter or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceCheckCommandParameter object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceCheckCommandParameter object + } + + if ($criteria->containsKey(NagiosServiceCheckCommandParameterPeer::ID) && $criteria->keyContainsValue(NagiosServiceCheckCommandParameterPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceCheckCommandParameterPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceCheckCommandParameter or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceCheckCommandParameter object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceCheckCommandParameterPeer::ID); + $selectCriteria->add(NagiosServiceCheckCommandParameterPeer::ID, $criteria->remove(NagiosServiceCheckCommandParameterPeer::ID), $comparison); + + } else { // $values is NagiosServiceCheckCommandParameter object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_check_command_parameter 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(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceCheckCommandParameterPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceCheckCommandParameter or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceCheckCommandParameter object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceCheckCommandParameterPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceCheckCommandParameter) { + // invalidate the cache for this single object + NagiosServiceCheckCommandParameterPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceCheckCommandParameterPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceCheckCommandParameterPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosServiceCheckCommandParameter 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 NagiosServiceCheckCommandParameter $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(NagiosServiceCheckCommandParameter $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceCheckCommandParameterPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, NagiosServiceCheckCommandParameterPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceCheckCommandParameter + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceCheckCommandParameterPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + $criteria->add(NagiosServiceCheckCommandParameterPeer::ID, $pk); + + $v = NagiosServiceCheckCommandParameterPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + $criteria->add(NagiosServiceCheckCommandParameterPeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceCheckCommandParameterPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceCheckCommandParameterPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceCheckCommandParameterPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceCheckCommandParameterPeer class: +// +// Propel::getDatabaseMap(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME)->addTableBuilder(NagiosServiceCheckCommandParameterPeer::TABLE_NAME, NagiosServiceCheckCommandParameterPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceCheckCommandParameterPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceCheckCommandParameterPeer::TABLE_NAME, BaseNagiosServiceCheckCommandParameterPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceContactGroupMember.php b/classes/om/BaseNagiosServiceContactGroupMember.php new file mode 100755 index 0000000..c5a2dba --- /dev/null +++ b/classes/om/BaseNagiosServiceContactGroupMember.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [template] column value. + * + * @return int + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Get the [contact_group] column value. + * + * @return int + */ + public function getContactGroup() + { + return $this->contact_group; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceContactGroupMemberPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosServiceContactGroupMemberPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [template] column. + * + * @param int $v new value + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + */ + public function setTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->template !== $v) { + $this->template = $v; + $this->modifiedColumns[] = NagiosServiceContactGroupMemberPeer::TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setTemplate() + + /** + * Set the value of [contact_group] column. + * + * @param int $v new value + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + */ + public function setContactGroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact_group !== $v) { + $this->contact_group = $v; + $this->modifiedColumns[] = NagiosServiceContactGroupMemberPeer::CONTACT_GROUP; + } + + if ($this->aNagiosContactGroup !== null && $this->aNagiosContactGroup->getId() !== $v) { + $this->aNagiosContactGroup = null; + } + + return $this; + } // setContactGroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->service = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->contact_group = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceContactGroupMember object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + if ($this->aNagiosContactGroup !== null && $this->contact_group !== $this->aNagiosContactGroup->getId()) { + $this->aNagiosContactGroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceContactGroupMemberPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosContactGroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceContactGroupMemberPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->aNagiosContactGroup !== null) { + if ($this->aNagiosContactGroup->isModified() || $this->aNagiosContactGroup->isNew()) { + $affectedRows += $this->aNagiosContactGroup->save($con); + } + $this->setNagiosContactGroup($this->aNagiosContactGroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceContactGroupMemberPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceContactGroupMemberPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceContactGroupMemberPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosContactGroup !== null) { + if (!$this->aNagiosContactGroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContactGroup->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceContactGroupMemberPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceContactGroupMemberPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getService(); + break; + case 2: + return $this->getTemplate(); + break; + case 3: + return $this->getContactGroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceContactGroupMemberPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getService(), + $keys[2] => $this->getTemplate(), + $keys[3] => $this->getContactGroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceContactGroupMemberPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setService($value); + break; + case 2: + $this->setTemplate($value); + break; + case 3: + $this->setContactGroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceContactGroupMemberPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setService($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setContactGroup($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(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceContactGroupMemberPeer::ID)) $criteria->add(NagiosServiceContactGroupMemberPeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceContactGroupMemberPeer::SERVICE)) $criteria->add(NagiosServiceContactGroupMemberPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosServiceContactGroupMemberPeer::TEMPLATE)) $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->template); + if ($this->isColumnModified(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP)) $criteria->add(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP, $this->contact_group); + + 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(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + $criteria->add(NagiosServiceContactGroupMemberPeer::ID, $this->id); + + 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 NagiosServiceContactGroupMember (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) + { + + $copyObj->setService($this->service); + + $copyObj->setTemplate($this->template); + + $copyObj->setContactGroup($this->contact_group); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceContactGroupMember 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); + $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 NagiosServiceContactGroupMemberPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceContactGroupMemberPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosServiceContactGroupMembers($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setTemplate(NULL); + } else { + $this->setTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosServiceContactGroupMembers($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Declares an association between this object and a NagiosContactGroup object. + * + * @param NagiosContactGroup $v + * @return NagiosServiceContactGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContactGroup(NagiosContactGroup $v = null) + { + if ($v === null) { + $this->setContactGroup(NULL); + } else { + $this->setContactGroup($v->getId()); + } + + $this->aNagiosContactGroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContactGroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContactGroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContactGroup The associated NagiosContactGroup object. + * @throws PropelException + */ + public function getNagiosContactGroup(PropelPDO $con = null) + { + if ($this->aNagiosContactGroup === null && ($this->contact_group !== null)) { + $c = new Criteria(NagiosContactGroupPeer::DATABASE_NAME); + $c->add(NagiosContactGroupPeer::ID, $this->contact_group); + $this->aNagiosContactGroup = NagiosContactGroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContactGroup->addNagiosServiceContactGroupMembers($this); + */ + } + return $this->aNagiosContactGroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosContactGroup = null; + } + +} // BaseNagiosServiceContactGroupMember diff --git a/classes/om/BaseNagiosServiceContactGroupMemberPeer.php b/classes/om/BaseNagiosServiceContactGroupMemberPeer.php new file mode 100755 index 0000000..655ad73 --- /dev/null +++ b/classes/om/BaseNagiosServiceContactGroupMemberPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Service', 'Template', 'ContactGroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'service', 'template', 'contactGroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SERVICE, self::TEMPLATE, self::CONTACT_GROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'service', 'template', 'contact_group', ), + 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, 'Service' => 1, 'Template' => 2, 'ContactGroup' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'contactGroup' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SERVICE => 1, self::TEMPLATE => 2, self::CONTACT_GROUP => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'contact_group' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceContactGroupMemberMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceContactGroupMemberPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceContactGroupMemberPeer::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) + { + + $criteria->addSelectColumn(NagiosServiceContactGroupMemberPeer::ID); + + $criteria->addSelectColumn(NagiosServiceContactGroupMemberPeer::SERVICE); + + $criteria->addSelectColumn(NagiosServiceContactGroupMemberPeer::TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceContactGroupMember + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceContactGroupMemberPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceContactGroupMemberPeer::populateObjects(NagiosServiceContactGroupMemberPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceContactGroupMember $value A NagiosServiceContactGroupMember object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceContactGroupMember $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceContactGroupMember object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceContactGroupMember) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceContactGroupMember object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceContactGroupMember Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceContactGroupMemberPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to $obj2 (NagiosService) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with their NagiosContactGroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactGroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactGroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to $obj2 (NagiosContactGroup) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactGroupMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceContactGroupMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosContactGroup rows + + $key4 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosContactGroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosContactGroupPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj4 (NagiosContactGroup) + $obj4->addNagiosServiceContactGroupMember($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContactGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContactGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosServiceTemplate rows + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactGroupPeer::NUM_COLUMNS - NagiosContactGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::CONTACT_GROUP,), array(NagiosContactGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContactGroup rows + + $key3 = NagiosContactGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj3 (NagiosContactGroup) + $obj3->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactGroupMember objects pre-filled with all related objects except NagiosContactGroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContactGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactGroupMemberPeer::NUM_COLUMNS - NagiosServiceContactGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactGroupMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceContactGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceContactGroupMemberPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceContactGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceContactGroupMember object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceContactGroupMember object + } + + if ($criteria->containsKey(NagiosServiceContactGroupMemberPeer::ID) && $criteria->keyContainsValue(NagiosServiceContactGroupMemberPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceContactGroupMemberPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceContactGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceContactGroupMember object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceContactGroupMemberPeer::ID); + $selectCriteria->add(NagiosServiceContactGroupMemberPeer::ID, $criteria->remove(NagiosServiceContactGroupMemberPeer::ID), $comparison); + + } else { // $values is NagiosServiceContactGroupMember object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_contact_group_member 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(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceContactGroupMemberPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceContactGroupMember or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceContactGroupMember object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceContactGroupMemberPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceContactGroupMember) { + // invalidate the cache for this single object + NagiosServiceContactGroupMemberPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceContactGroupMemberPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceContactGroupMemberPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosServiceContactGroupMember 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 NagiosServiceContactGroupMember $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(NagiosServiceContactGroupMember $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceContactGroupMemberPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, NagiosServiceContactGroupMemberPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceContactGroupMember + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceContactGroupMemberPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceContactGroupMemberPeer::ID, $pk); + + $v = NagiosServiceContactGroupMemberPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceContactGroupMemberPeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceContactGroupMemberPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceContactGroupMemberPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceContactGroupMemberPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceContactGroupMemberPeer class: +// +// Propel::getDatabaseMap(NagiosServiceContactGroupMemberPeer::DATABASE_NAME)->addTableBuilder(NagiosServiceContactGroupMemberPeer::TABLE_NAME, NagiosServiceContactGroupMemberPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceContactGroupMemberPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceContactGroupMemberPeer::TABLE_NAME, BaseNagiosServiceContactGroupMemberPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceContactMember.php b/classes/om/BaseNagiosServiceContactMember.php new file mode 100755 index 0000000..1bf8204 --- /dev/null +++ b/classes/om/BaseNagiosServiceContactMember.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [template] column value. + * + * @return int + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Get the [contact] column value. + * + * @return int + */ + public function getContact() + { + return $this->contact; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceContactMember The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceContactMemberPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosServiceContactMember The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosServiceContactMemberPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [template] column. + * + * @param int $v new value + * @return NagiosServiceContactMember The current object (for fluent API support) + */ + public function setTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->template !== $v) { + $this->template = $v; + $this->modifiedColumns[] = NagiosServiceContactMemberPeer::TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setTemplate() + + /** + * Set the value of [contact] column. + * + * @param int $v new value + * @return NagiosServiceContactMember The current object (for fluent API support) + */ + public function setContact($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->contact !== $v) { + $this->contact = $v; + $this->modifiedColumns[] = NagiosServiceContactMemberPeer::CONTACT; + } + + if ($this->aNagiosContact !== null && $this->aNagiosContact->getId() !== $v) { + $this->aNagiosContact = null; + } + + return $this; + } // setContact() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->service = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->contact = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceContactMember object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + if ($this->aNagiosContact !== null && $this->contact !== $this->aNagiosContact->getId()) { + $this->aNagiosContact = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceContactMemberPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosContact = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceContactMemberPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceContactMemberPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->aNagiosContact !== null) { + if ($this->aNagiosContact->isModified() || $this->aNagiosContact->isNew()) { + $affectedRows += $this->aNagiosContact->save($con); + } + $this->setNagiosContact($this->aNagiosContact); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceContactMemberPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceContactMemberPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceContactMemberPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosContact !== null) { + if (!$this->aNagiosContact->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosContact->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceContactMemberPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceContactMemberPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getService(); + break; + case 2: + return $this->getTemplate(); + break; + case 3: + return $this->getContact(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceContactMemberPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getService(), + $keys[2] => $this->getTemplate(), + $keys[3] => $this->getContact(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceContactMemberPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setService($value); + break; + case 2: + $this->setTemplate($value); + break; + case 3: + $this->setContact($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceContactMemberPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setService($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setContact($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(NagiosServiceContactMemberPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceContactMemberPeer::ID)) $criteria->add(NagiosServiceContactMemberPeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceContactMemberPeer::SERVICE)) $criteria->add(NagiosServiceContactMemberPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosServiceContactMemberPeer::TEMPLATE)) $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->template); + if ($this->isColumnModified(NagiosServiceContactMemberPeer::CONTACT)) $criteria->add(NagiosServiceContactMemberPeer::CONTACT, $this->contact); + + 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(NagiosServiceContactMemberPeer::DATABASE_NAME); + + $criteria->add(NagiosServiceContactMemberPeer::ID, $this->id); + + 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 NagiosServiceContactMember (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) + { + + $copyObj->setService($this->service); + + $copyObj->setTemplate($this->template); + + $copyObj->setContact($this->contact); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceContactMember 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); + $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 NagiosServiceContactMemberPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceContactMemberPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosServiceContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosServiceContactMembers($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setTemplate(NULL); + } else { + $this->setTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosServiceContactMembers($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Declares an association between this object and a NagiosContact object. + * + * @param NagiosContact $v + * @return NagiosServiceContactMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosContact(NagiosContact $v = null) + { + if ($v === null) { + $this->setContact(NULL); + } else { + $this->setContact($v->getId()); + } + + $this->aNagiosContact = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosContact object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceContactMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosContact object + * + * @param PropelPDO Optional Connection object. + * @return NagiosContact The associated NagiosContact object. + * @throws PropelException + */ + public function getNagiosContact(PropelPDO $con = null) + { + if ($this->aNagiosContact === null && ($this->contact !== null)) { + $c = new Criteria(NagiosContactPeer::DATABASE_NAME); + $c->add(NagiosContactPeer::ID, $this->contact); + $this->aNagiosContact = NagiosContactPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosContact->addNagiosServiceContactMembers($this); + */ + } + return $this->aNagiosContact; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosContact = null; + } + +} // BaseNagiosServiceContactMember diff --git a/classes/om/BaseNagiosServiceContactMemberPeer.php b/classes/om/BaseNagiosServiceContactMemberPeer.php new file mode 100755 index 0000000..c85226c --- /dev/null +++ b/classes/om/BaseNagiosServiceContactMemberPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Service', 'Template', 'Contact', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'service', 'template', 'contact', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SERVICE, self::TEMPLATE, self::CONTACT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'service', 'template', 'contact', ), + 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, 'Service' => 1, 'Template' => 2, 'Contact' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'contact' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SERVICE => 1, self::TEMPLATE => 2, self::CONTACT => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'contact' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceContactMemberMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceContactMemberPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceContactMemberPeer::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) + { + + $criteria->addSelectColumn(NagiosServiceContactMemberPeer::ID); + + $criteria->addSelectColumn(NagiosServiceContactMemberPeer::SERVICE); + + $criteria->addSelectColumn(NagiosServiceContactMemberPeer::TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceContactMemberPeer::CONTACT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceContactMember + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceContactMemberPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceContactMemberPeer::populateObjects(NagiosServiceContactMemberPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceContactMember $value A NagiosServiceContactMember object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceContactMember $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceContactMember object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceContactMember) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceContactMember object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceContactMember Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceContactMemberPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceContactMemberPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceContactMemberPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to $obj2 (NagiosService) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with their NagiosContact objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosContactPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosContactPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosContactPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosContactPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to $obj2 (NagiosContact) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceContactMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosContact rows + + $key4 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosContactPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosContactPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj4 (NagiosContact) + $obj4->addNagiosServiceContactMember($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosContact table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosContact(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceContactMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosServiceTemplate rows + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContact rows + + $key3 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj3 (NagiosContact) + $obj3->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosContactPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosContactPeer::NUM_COLUMNS - NagiosContactPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactMemberPeer::CONTACT,), array(NagiosContactPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosContact rows + + $key3 = NagiosContactPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosContactPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosContactPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosContactPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj3 (NagiosContact) + $obj3->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceContactMember objects pre-filled with all related objects except NagiosContact. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceContactMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosContact(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceContactMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceContactMemberPeer::NUM_COLUMNS - NagiosServiceContactMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceContactMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceContactMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceContactMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceContactMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceContactMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceContactMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceContactMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceContactMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceContactMemberPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceContactMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceContactMember object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceContactMember object + } + + if ($criteria->containsKey(NagiosServiceContactMemberPeer::ID) && $criteria->keyContainsValue(NagiosServiceContactMemberPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceContactMemberPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceContactMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceContactMember object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceContactMemberPeer::ID); + $selectCriteria->add(NagiosServiceContactMemberPeer::ID, $criteria->remove(NagiosServiceContactMemberPeer::ID), $comparison); + + } else { // $values is NagiosServiceContactMember object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_contact_member 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(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceContactMemberPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceContactMember or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceContactMember object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceContactMemberPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceContactMember) { + // invalidate the cache for this single object + NagiosServiceContactMemberPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceContactMemberPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceContactMemberPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosServiceContactMember 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 NagiosServiceContactMember $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(NagiosServiceContactMember $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceContactMemberPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceContactMemberPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceContactMemberPeer::DATABASE_NAME, NagiosServiceContactMemberPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceContactMember + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceContactMemberPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceContactMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceContactMemberPeer::ID, $pk); + + $v = NagiosServiceContactMemberPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceContactMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceContactMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceContactMemberPeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceContactMemberPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceContactMemberPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceContactMemberPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceContactMemberPeer class: +// +// Propel::getDatabaseMap(NagiosServiceContactMemberPeer::DATABASE_NAME)->addTableBuilder(NagiosServiceContactMemberPeer::TABLE_NAME, NagiosServiceContactMemberPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceContactMemberPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceContactMemberPeer::TABLE_NAME, BaseNagiosServiceContactMemberPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceGroup.php b/classes/om/BaseNagiosServiceGroup.php new file mode 100755 index 0000000..76b114b --- /dev/null +++ b/classes/om/BaseNagiosServiceGroup.php @@ -0,0 +1,1159 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosServiceGroup The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosServiceGroupPeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->notes = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->notes_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->action_url = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 6; // 6 = NagiosServiceGroupPeer::NUM_COLUMNS - NagiosServiceGroupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceGroup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceGroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collNagiosServiceGroupMembers = null; + $this->lastNagiosServiceGroupMemberCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceGroupPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceGroupPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceGroupPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceGroupPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceGroupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosServiceGroupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + case 3: + return $this->getNotes(); + break; + case 4: + return $this->getNotesUrl(); + break; + case 5: + return $this->getActionUrl(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceGroupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + $keys[3] => $this->getNotes(), + $keys[4] => $this->getNotesUrl(), + $keys[5] => $this->getActionUrl(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceGroupPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($value); + break; + case 3: + $this->setNotes($value); + break; + case 4: + $this->setNotesUrl($value); + break; + case 5: + $this->setActionUrl($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceGroupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setNotes($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setNotesUrl($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setActionUrl($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(NagiosServiceGroupPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceGroupPeer::ID)) $criteria->add(NagiosServiceGroupPeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceGroupPeer::NAME)) $criteria->add(NagiosServiceGroupPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosServiceGroupPeer::ALIAS)) $criteria->add(NagiosServiceGroupPeer::ALIAS, $this->alias); + if ($this->isColumnModified(NagiosServiceGroupPeer::NOTES)) $criteria->add(NagiosServiceGroupPeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosServiceGroupPeer::NOTES_URL)) $criteria->add(NagiosServiceGroupPeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosServiceGroupPeer::ACTION_URL)) $criteria->add(NagiosServiceGroupPeer::ACTION_URL, $this->action_url); + + 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(NagiosServiceGroupPeer::DATABASE_NAME); + + $criteria->add(NagiosServiceGroupPeer::ID, $this->id); + + 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 NagiosServiceGroup (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosServiceGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceGroupMember($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceGroup 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); + $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 NagiosServiceGroupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceGroupPeer(); + } + return self::$peer; + } + + /** + * Clears out the collNagiosServiceGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceGroupMembers() + */ + public function clearNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceGroupMembers collection to an empty array (like clearcollNagiosServiceGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceGroup has previously been saved, it will retrieve + * related NagiosServiceGroupMembers from storage. If this NagiosServiceGroup is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::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. + + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + return $this->collNagiosServiceGroupMembers; + } + + /** + * Returns the number of related NagiosServiceGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + $count = NagiosServiceGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceGroupMember object to this object + * through the NagiosServiceGroupMember foreign key attribute. + * + * @param NagiosServiceGroupMember $l NagiosServiceGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceGroupMember(NagiosServiceGroupMember $l) + { + if ($this->collNagiosServiceGroupMembers === null) { + $this->initNagiosServiceGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceGroupMembers, $l); + $l->setNagiosServiceGroup($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceGroup is new, it will return + * an empty collection; or if this NagiosServiceGroup has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosServiceGroup. + */ + public function getNagiosServiceGroupMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceGroup is new, it will return + * an empty collection; or if this NagiosServiceGroup has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosServiceGroup. + */ + public function getNagiosServiceGroupMembersJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosServiceGroupMembers) { + foreach ((array) $this->collNagiosServiceGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosServiceGroupMembers = null; + } + +} // BaseNagiosServiceGroup diff --git a/classes/om/BaseNagiosServiceGroupMember.php b/classes/om/BaseNagiosServiceGroupMember.php new file mode 100755 index 0000000..a0e30a6 --- /dev/null +++ b/classes/om/BaseNagiosServiceGroupMember.php @@ -0,0 +1,1011 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [service] column value. + * + * @return int + */ + public function getService() + { + return $this->service; + } + + /** + * Get the [template] column value. + * + * @return int + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Get the [service_group] column value. + * + * @return int + */ + public function getServiceGroup() + { + return $this->service_group; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceGroupMember The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceGroupMemberPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [service] column. + * + * @param int $v new value + * @return NagiosServiceGroupMember The current object (for fluent API support) + */ + public function setService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service !== $v) { + $this->service = $v; + $this->modifiedColumns[] = NagiosServiceGroupMemberPeer::SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setService() + + /** + * Set the value of [template] column. + * + * @param int $v new value + * @return NagiosServiceGroupMember The current object (for fluent API support) + */ + public function setTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->template !== $v) { + $this->template = $v; + $this->modifiedColumns[] = NagiosServiceGroupMemberPeer::TEMPLATE; + } + + if ($this->aNagiosServiceTemplate !== null && $this->aNagiosServiceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplate = null; + } + + return $this; + } // setTemplate() + + /** + * Set the value of [service_group] column. + * + * @param int $v new value + * @return NagiosServiceGroupMember The current object (for fluent API support) + */ + public function setServiceGroup($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->service_group !== $v) { + $this->service_group = $v; + $this->modifiedColumns[] = NagiosServiceGroupMemberPeer::SERVICE_GROUP; + } + + if ($this->aNagiosServiceGroup !== null && $this->aNagiosServiceGroup->getId() !== $v) { + $this->aNagiosServiceGroup = null; + } + + return $this; + } // setServiceGroup() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->service = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->service_group = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceGroupMember object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosService !== null && $this->service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosServiceTemplate !== null && $this->template !== $this->aNagiosServiceTemplate->getId()) { + $this->aNagiosServiceTemplate = null; + } + if ($this->aNagiosServiceGroup !== null && $this->service_group !== $this->aNagiosServiceGroup->getId()) { + $this->aNagiosServiceGroup = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceGroupMemberPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosServiceGroup = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceGroupMemberPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceGroupMemberPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosServiceTemplate !== null) { + if ($this->aNagiosServiceTemplate->isModified() || $this->aNagiosServiceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplate->save($con); + } + $this->setNagiosServiceTemplate($this->aNagiosServiceTemplate); + } + + if ($this->aNagiosServiceGroup !== null) { + if ($this->aNagiosServiceGroup->isModified() || $this->aNagiosServiceGroup->isNew()) { + $affectedRows += $this->aNagiosServiceGroup->save($con); + } + $this->setNagiosServiceGroup($this->aNagiosServiceGroup); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceGroupMemberPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceGroupMemberPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceGroupMemberPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplate !== null) { + if (!$this->aNagiosServiceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosServiceGroup !== null) { + if (!$this->aNagiosServiceGroup->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceGroup->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceGroupMemberPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceGroupMemberPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getService(); + break; + case 2: + return $this->getTemplate(); + break; + case 3: + return $this->getServiceGroup(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceGroupMemberPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getService(), + $keys[2] => $this->getTemplate(), + $keys[3] => $this->getServiceGroup(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceGroupMemberPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setService($value); + break; + case 2: + $this->setTemplate($value); + break; + case 3: + $this->setServiceGroup($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceGroupMemberPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setService($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setServiceGroup($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(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceGroupMemberPeer::ID)) $criteria->add(NagiosServiceGroupMemberPeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceGroupMemberPeer::SERVICE)) $criteria->add(NagiosServiceGroupMemberPeer::SERVICE, $this->service); + if ($this->isColumnModified(NagiosServiceGroupMemberPeer::TEMPLATE)) $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->template); + if ($this->isColumnModified(NagiosServiceGroupMemberPeer::SERVICE_GROUP)) $criteria->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $this->service_group); + + 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(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + $criteria->add(NagiosServiceGroupMemberPeer::ID, $this->id); + + 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 NagiosServiceGroupMember (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) + { + + $copyObj->setService($this->service); + + $copyObj->setTemplate($this->template); + + $copyObj->setServiceGroup($this->service_group); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceGroupMember 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); + $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 NagiosServiceGroupMemberPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceGroupMemberPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosServiceGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setService(NULL); + } else { + $this->setService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosServiceGroupMembers($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setTemplate(NULL); + } else { + $this->setTemplate($v->getId()); + } + + $this->aNagiosServiceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplate === null && ($this->template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->template); + $this->aNagiosServiceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplate->addNagiosServiceGroupMembers($this); + */ + } + return $this->aNagiosServiceTemplate; + } + + /** + * Declares an association between this object and a NagiosServiceGroup object. + * + * @param NagiosServiceGroup $v + * @return NagiosServiceGroupMember The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceGroup(NagiosServiceGroup $v = null) + { + if ($v === null) { + $this->setServiceGroup(NULL); + } else { + $this->setServiceGroup($v->getId()); + } + + $this->aNagiosServiceGroup = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceGroup object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceGroupMember($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceGroup object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceGroup The associated NagiosServiceGroup object. + * @throws PropelException + */ + public function getNagiosServiceGroup(PropelPDO $con = null) + { + if ($this->aNagiosServiceGroup === null && ($this->service_group !== null)) { + $c = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + $c->add(NagiosServiceGroupPeer::ID, $this->service_group); + $this->aNagiosServiceGroup = NagiosServiceGroupPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceGroup->addNagiosServiceGroupMembers($this); + */ + } + return $this->aNagiosServiceGroup; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosService = null; + $this->aNagiosServiceTemplate = null; + $this->aNagiosServiceGroup = null; + } + +} // BaseNagiosServiceGroupMember diff --git a/classes/om/BaseNagiosServiceGroupMemberPeer.php b/classes/om/BaseNagiosServiceGroupMemberPeer.php new file mode 100755 index 0000000..6eb2d5f --- /dev/null +++ b/classes/om/BaseNagiosServiceGroupMemberPeer.php @@ -0,0 +1,1664 @@ + array ('Id', 'Service', 'Template', 'ServiceGroup', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'service', 'template', 'serviceGroup', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SERVICE, self::TEMPLATE, self::SERVICE_GROUP, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'service', 'template', 'service_group', ), + 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, 'Service' => 1, 'Template' => 2, 'ServiceGroup' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'serviceGroup' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SERVICE => 1, self::TEMPLATE => 2, self::SERVICE_GROUP => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'service' => 1, 'template' => 2, 'service_group' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceGroupMemberMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceGroupMemberPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceGroupMemberPeer::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) + { + + $criteria->addSelectColumn(NagiosServiceGroupMemberPeer::ID); + + $criteria->addSelectColumn(NagiosServiceGroupMemberPeer::SERVICE); + + $criteria->addSelectColumn(NagiosServiceGroupMemberPeer::TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceGroupMemberPeer::SERVICE_GROUP); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceGroupMember + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceGroupMemberPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceGroupMemberPeer::populateObjects(NagiosServiceGroupMemberPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceGroupMember $value A NagiosServiceGroupMember object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceGroupMember $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceGroupMember object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceGroupMember) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceGroupMember object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceGroupMember Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceGroupMemberPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceGroupMemberPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceGroupMemberPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to $obj2 (NagiosService) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with their NagiosServiceGroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceGroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceGroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceGroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceGroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceGroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to $obj2 (NagiosServiceGroup) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceGroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceGroupPeer::NUM_COLUMNS - NagiosServiceGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceGroupMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceGroupMember($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceGroup rows + + $key4 = NagiosServiceGroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceGroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceGroupPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj4 (NagiosServiceGroup) + $obj4->addNagiosServiceGroupMember($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceGroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceGroupPeer::NUM_COLUMNS - NagiosServiceGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosServiceTemplate rows + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceGroup rows + + $key3 = NagiosServiceGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj3 (NagiosServiceGroup) + $obj3->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with all related objects except NagiosServiceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceGroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceGroupPeer::NUM_COLUMNS - NagiosServiceGroupPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE_GROUP,), array(NagiosServiceGroupPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceGroup rows + + $key3 = NagiosServiceGroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceGroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceGroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceGroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj3 (NagiosServiceGroup) + $obj3->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceGroupMember objects pre-filled with all related objects except NagiosServiceGroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceGroupMember objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceGroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceGroupMemberPeer::addSelectColumns($c); + $startcol2 = (NagiosServiceGroupMemberPeer::NUM_COLUMNS - NagiosServiceGroupMemberPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceGroupMemberPeer::SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceGroupMemberPeer::TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceGroupMemberPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceGroupMemberPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceGroupMemberPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceGroupMemberPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceGroupMember) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceGroupMember($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceGroupMemberPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceGroupMember object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceGroupMember object + } + + if ($criteria->containsKey(NagiosServiceGroupMemberPeer::ID) && $criteria->keyContainsValue(NagiosServiceGroupMemberPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceGroupMemberPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceGroupMember or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceGroupMember object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceGroupMemberPeer::ID); + $selectCriteria->add(NagiosServiceGroupMemberPeer::ID, $criteria->remove(NagiosServiceGroupMemberPeer::ID), $comparison); + + } else { // $values is NagiosServiceGroupMember object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_group_member 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(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceGroupMemberPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceGroupMember or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceGroupMember object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceGroupMemberPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceGroupMember) { + // invalidate the cache for this single object + NagiosServiceGroupMemberPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceGroupMemberPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceGroupMemberPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosServiceGroupMember 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 NagiosServiceGroupMember $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(NagiosServiceGroupMember $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceGroupMemberPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceGroupMemberPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceGroupMemberPeer::DATABASE_NAME, NagiosServiceGroupMemberPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceGroupMember + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceGroupMemberPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceGroupMemberPeer::ID, $pk); + + $v = NagiosServiceGroupMemberPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupMemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceGroupMemberPeer::DATABASE_NAME); + $criteria->add(NagiosServiceGroupMemberPeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceGroupMemberPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceGroupMemberPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceGroupMemberPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceGroupMemberPeer class: +// +// Propel::getDatabaseMap(NagiosServiceGroupMemberPeer::DATABASE_NAME)->addTableBuilder(NagiosServiceGroupMemberPeer::TABLE_NAME, NagiosServiceGroupMemberPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceGroupMemberPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceGroupMemberPeer::TABLE_NAME, BaseNagiosServiceGroupMemberPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceGroupPeer.php b/classes/om/BaseNagiosServiceGroupPeer.php new file mode 100755 index 0000000..14461ce --- /dev/null +++ b/classes/om/BaseNagiosServiceGroupPeer.php @@ -0,0 +1,753 @@ + array ('Id', 'Name', 'Alias', 'Notes', 'NotesUrl', 'ActionUrl', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', 'notes', 'notesUrl', 'actionUrl', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, self::NOTES, self::NOTES_URL, self::ACTION_URL, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', 'notes', 'notes_url', 'action_url', ), + 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, 'Name' => 1, 'Alias' => 2, 'Notes' => 3, 'NotesUrl' => 4, 'ActionUrl' => 5, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'notes' => 3, 'notesUrl' => 4, 'actionUrl' => 5, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, self::NOTES => 3, self::NOTES_URL => 4, self::ACTION_URL => 5, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, 'notes' => 3, 'notes_url' => 4, 'action_url' => 5, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceGroupMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceGroupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceGroupPeer::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) + { + + $criteria->addSelectColumn(NagiosServiceGroupPeer::ID); + + $criteria->addSelectColumn(NagiosServiceGroupPeer::NAME); + + $criteria->addSelectColumn(NagiosServiceGroupPeer::ALIAS); + + $criteria->addSelectColumn(NagiosServiceGroupPeer::NOTES); + + $criteria->addSelectColumn(NagiosServiceGroupPeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosServiceGroupPeer::ACTION_URL); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceGroupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceGroupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceGroup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceGroupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceGroupPeer::populateObjects(NagiosServiceGroupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceGroupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceGroup $value A NagiosServiceGroup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceGroup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceGroup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceGroup) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceGroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceGroup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceGroupPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceGroupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceGroupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceGroupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosServiceGroupPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceGroup or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceGroup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceGroup object + } + + if ($criteria->containsKey(NagiosServiceGroupPeer::ID) && $criteria->keyContainsValue(NagiosServiceGroupPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceGroupPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceGroup or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceGroup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceGroupPeer::ID); + $selectCriteria->add(NagiosServiceGroupPeer::ID, $criteria->remove(NagiosServiceGroupPeer::ID), $comparison); + + } else { // $values is NagiosServiceGroup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_group 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(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosServiceGroupPeer::doOnDeleteCascade(new Criteria(NagiosServiceGroupPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceGroupPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceGroup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceGroup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceGroupPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceGroup) { + // invalidate the cache for this single object + NagiosServiceGroupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceGroupPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceGroupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosServiceGroupPeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosServiceGroupPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosServiceGroupPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosServiceGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceGroupMemberPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosServiceGroupPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosServiceGroupMember objects + $c = new Criteria(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceGroupMemberPeer::SERVICE_GROUP, $obj->getId()); + $affectedRows += NagiosServiceGroupMemberPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosServiceGroup 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 NagiosServiceGroup $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(NagiosServiceGroup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceGroupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceGroupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceGroupPeer::DATABASE_NAME, NagiosServiceGroupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceGroup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceGroupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + $criteria->add(NagiosServiceGroupPeer::ID, $pk); + + $v = NagiosServiceGroupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceGroupPeer::DATABASE_NAME); + $criteria->add(NagiosServiceGroupPeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceGroupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceGroupPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceGroupPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceGroupPeer class: +// +// Propel::getDatabaseMap(NagiosServiceGroupPeer::DATABASE_NAME)->addTableBuilder(NagiosServiceGroupPeer::TABLE_NAME, NagiosServiceGroupPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceGroupPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceGroupPeer::TABLE_NAME, BaseNagiosServiceGroupPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServicePeer.php b/classes/om/BaseNagiosServicePeer.php new file mode 100755 index 0000000..61c1a68 --- /dev/null +++ b/classes/om/BaseNagiosServicePeer.php @@ -0,0 +1,3796 @@ + array ('Id', 'Description', 'DisplayName', 'Host', 'HostTemplate', 'Hostgroup', 'InitialState', 'IsVolatile', 'CheckCommand', 'MaximumCheckAttempts', 'NormalCheckInterval', 'RetryInterval', 'FirstNotificationDelay', 'ActiveChecksEnabled', 'PassiveChecksEnabled', 'CheckPeriod', 'ParallelizeCheck', 'ObsessOverService', 'CheckFreshness', 'FreshnessThreshold', 'EventHandler', 'EventHandlerEnabled', 'LowFlapThreshold', 'HighFlapThreshold', 'FlapDetectionEnabled', 'FlapDetectionOnOk', 'FlapDetectionOnWarning', 'FlapDetectionOnCritical', 'FlapDetectionOnUnknown', 'ProcessPerfData', 'RetainStatusInformation', 'RetainNonstatusInformation', 'NotificationInterval', 'NotificationPeriod', 'NotificationOnWarning', 'NotificationOnUnknown', 'NotificationOnCritical', 'NotificationOnRecovery', 'NotificationOnFlapping', 'NotificationOnScheduledDowntime', 'NotificationsEnabled', 'StalkingOnOk', 'StalkingOnWarning', 'StalkingOnUnknown', 'StalkingOnCritical', 'FailurePredictionEnabled', 'Notes', 'NotesUrl', 'ActionUrl', 'IconImage', 'IconImageAlt', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'description', 'displayName', 'host', 'hostTemplate', 'hostgroup', 'initialState', 'isVolatile', 'checkCommand', 'maximumCheckAttempts', 'normalCheckInterval', 'retryInterval', 'firstNotificationDelay', 'activeChecksEnabled', 'passiveChecksEnabled', 'checkPeriod', 'parallelizeCheck', 'obsessOverService', 'checkFreshness', 'freshnessThreshold', 'eventHandler', 'eventHandlerEnabled', 'lowFlapThreshold', 'highFlapThreshold', 'flapDetectionEnabled', 'flapDetectionOnOk', 'flapDetectionOnWarning', 'flapDetectionOnCritical', 'flapDetectionOnUnknown', 'processPerfData', 'retainStatusInformation', 'retainNonstatusInformation', 'notificationInterval', 'notificationPeriod', 'notificationOnWarning', 'notificationOnUnknown', 'notificationOnCritical', 'notificationOnRecovery', 'notificationOnFlapping', 'notificationOnScheduledDowntime', 'notificationsEnabled', 'stalkingOnOk', 'stalkingOnWarning', 'stalkingOnUnknown', 'stalkingOnCritical', 'failurePredictionEnabled', 'notes', 'notesUrl', 'actionUrl', 'iconImage', 'iconImageAlt', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DESCRIPTION, self::DISPLAY_NAME, self::HOST, self::HOST_TEMPLATE, self::HOSTGROUP, self::INITIAL_STATE, self::IS_VOLATILE, self::CHECK_COMMAND, self::MAXIMUM_CHECK_ATTEMPTS, self::NORMAL_CHECK_INTERVAL, self::RETRY_INTERVAL, self::FIRST_NOTIFICATION_DELAY, self::ACTIVE_CHECKS_ENABLED, self::PASSIVE_CHECKS_ENABLED, self::CHECK_PERIOD, self::PARALLELIZE_CHECK, self::OBSESS_OVER_SERVICE, self::CHECK_FRESHNESS, self::FRESHNESS_THRESHOLD, self::EVENT_HANDLER, self::EVENT_HANDLER_ENABLED, self::LOW_FLAP_THRESHOLD, self::HIGH_FLAP_THRESHOLD, self::FLAP_DETECTION_ENABLED, self::FLAP_DETECTION_ON_OK, self::FLAP_DETECTION_ON_WARNING, self::FLAP_DETECTION_ON_CRITICAL, self::FLAP_DETECTION_ON_UNKNOWN, self::PROCESS_PERF_DATA, self::RETAIN_STATUS_INFORMATION, self::RETAIN_NONSTATUS_INFORMATION, self::NOTIFICATION_INTERVAL, self::NOTIFICATION_PERIOD, self::NOTIFICATION_ON_WARNING, self::NOTIFICATION_ON_UNKNOWN, self::NOTIFICATION_ON_CRITICAL, self::NOTIFICATION_ON_RECOVERY, self::NOTIFICATION_ON_FLAPPING, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME, self::NOTIFICATIONS_ENABLED, self::STALKING_ON_OK, self::STALKING_ON_WARNING, self::STALKING_ON_UNKNOWN, self::STALKING_ON_CRITICAL, self::FAILURE_PREDICTION_ENABLED, self::NOTES, self::NOTES_URL, self::ACTION_URL, self::ICON_IMAGE, self::ICON_IMAGE_ALT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'description', 'display_name', 'host', 'host_template', 'hostgroup', 'initial_state', 'is_volatile', 'check_command', 'maximum_check_attempts', 'normal_check_interval', 'retry_interval', 'first_notification_delay', 'active_checks_enabled', 'passive_checks_enabled', 'check_period', 'parallelize_check', 'obsess_over_service', 'check_freshness', 'freshness_threshold', 'event_handler', 'event_handler_enabled', 'low_flap_threshold', 'high_flap_threshold', 'flap_detection_enabled', 'flap_detection_on_ok', 'flap_detection_on_warning', 'flap_detection_on_critical', 'flap_detection_on_unknown', 'process_perf_data', 'retain_status_information', 'retain_nonstatus_information', 'notification_interval', 'notification_period', 'notification_on_warning', 'notification_on_unknown', 'notification_on_critical', 'notification_on_recovery', 'notification_on_flapping', 'notification_on_scheduled_downtime', 'notifications_enabled', 'stalking_on_ok', 'stalking_on_warning', 'stalking_on_unknown', 'stalking_on_critical', 'failure_prediction_enabled', 'notes', 'notes_url', 'action_url', 'icon_image', 'icon_image_alt', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, ) + ); + + /** + * 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, 'Description' => 1, 'DisplayName' => 2, 'Host' => 3, 'HostTemplate' => 4, 'Hostgroup' => 5, 'InitialState' => 6, 'IsVolatile' => 7, 'CheckCommand' => 8, 'MaximumCheckAttempts' => 9, 'NormalCheckInterval' => 10, 'RetryInterval' => 11, 'FirstNotificationDelay' => 12, 'ActiveChecksEnabled' => 13, 'PassiveChecksEnabled' => 14, 'CheckPeriod' => 15, 'ParallelizeCheck' => 16, 'ObsessOverService' => 17, 'CheckFreshness' => 18, 'FreshnessThreshold' => 19, 'EventHandler' => 20, 'EventHandlerEnabled' => 21, 'LowFlapThreshold' => 22, 'HighFlapThreshold' => 23, 'FlapDetectionEnabled' => 24, 'FlapDetectionOnOk' => 25, 'FlapDetectionOnWarning' => 26, 'FlapDetectionOnCritical' => 27, 'FlapDetectionOnUnknown' => 28, 'ProcessPerfData' => 29, 'RetainStatusInformation' => 30, 'RetainNonstatusInformation' => 31, 'NotificationInterval' => 32, 'NotificationPeriod' => 33, 'NotificationOnWarning' => 34, 'NotificationOnUnknown' => 35, 'NotificationOnCritical' => 36, 'NotificationOnRecovery' => 37, 'NotificationOnFlapping' => 38, 'NotificationOnScheduledDowntime' => 39, 'NotificationsEnabled' => 40, 'StalkingOnOk' => 41, 'StalkingOnWarning' => 42, 'StalkingOnUnknown' => 43, 'StalkingOnCritical' => 44, 'FailurePredictionEnabled' => 45, 'Notes' => 46, 'NotesUrl' => 47, 'ActionUrl' => 48, 'IconImage' => 49, 'IconImageAlt' => 50, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'description' => 1, 'displayName' => 2, 'host' => 3, 'hostTemplate' => 4, 'hostgroup' => 5, 'initialState' => 6, 'isVolatile' => 7, 'checkCommand' => 8, 'maximumCheckAttempts' => 9, 'normalCheckInterval' => 10, 'retryInterval' => 11, 'firstNotificationDelay' => 12, 'activeChecksEnabled' => 13, 'passiveChecksEnabled' => 14, 'checkPeriod' => 15, 'parallelizeCheck' => 16, 'obsessOverService' => 17, 'checkFreshness' => 18, 'freshnessThreshold' => 19, 'eventHandler' => 20, 'eventHandlerEnabled' => 21, 'lowFlapThreshold' => 22, 'highFlapThreshold' => 23, 'flapDetectionEnabled' => 24, 'flapDetectionOnOk' => 25, 'flapDetectionOnWarning' => 26, 'flapDetectionOnCritical' => 27, 'flapDetectionOnUnknown' => 28, 'processPerfData' => 29, 'retainStatusInformation' => 30, 'retainNonstatusInformation' => 31, 'notificationInterval' => 32, 'notificationPeriod' => 33, 'notificationOnWarning' => 34, 'notificationOnUnknown' => 35, 'notificationOnCritical' => 36, 'notificationOnRecovery' => 37, 'notificationOnFlapping' => 38, 'notificationOnScheduledDowntime' => 39, 'notificationsEnabled' => 40, 'stalkingOnOk' => 41, 'stalkingOnWarning' => 42, 'stalkingOnUnknown' => 43, 'stalkingOnCritical' => 44, 'failurePredictionEnabled' => 45, 'notes' => 46, 'notesUrl' => 47, 'actionUrl' => 48, 'iconImage' => 49, 'iconImageAlt' => 50, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DESCRIPTION => 1, self::DISPLAY_NAME => 2, self::HOST => 3, self::HOST_TEMPLATE => 4, self::HOSTGROUP => 5, self::INITIAL_STATE => 6, self::IS_VOLATILE => 7, self::CHECK_COMMAND => 8, self::MAXIMUM_CHECK_ATTEMPTS => 9, self::NORMAL_CHECK_INTERVAL => 10, self::RETRY_INTERVAL => 11, self::FIRST_NOTIFICATION_DELAY => 12, self::ACTIVE_CHECKS_ENABLED => 13, self::PASSIVE_CHECKS_ENABLED => 14, self::CHECK_PERIOD => 15, self::PARALLELIZE_CHECK => 16, self::OBSESS_OVER_SERVICE => 17, self::CHECK_FRESHNESS => 18, self::FRESHNESS_THRESHOLD => 19, self::EVENT_HANDLER => 20, self::EVENT_HANDLER_ENABLED => 21, self::LOW_FLAP_THRESHOLD => 22, self::HIGH_FLAP_THRESHOLD => 23, self::FLAP_DETECTION_ENABLED => 24, self::FLAP_DETECTION_ON_OK => 25, self::FLAP_DETECTION_ON_WARNING => 26, self::FLAP_DETECTION_ON_CRITICAL => 27, self::FLAP_DETECTION_ON_UNKNOWN => 28, self::PROCESS_PERF_DATA => 29, self::RETAIN_STATUS_INFORMATION => 30, self::RETAIN_NONSTATUS_INFORMATION => 31, self::NOTIFICATION_INTERVAL => 32, self::NOTIFICATION_PERIOD => 33, self::NOTIFICATION_ON_WARNING => 34, self::NOTIFICATION_ON_UNKNOWN => 35, self::NOTIFICATION_ON_CRITICAL => 36, self::NOTIFICATION_ON_RECOVERY => 37, self::NOTIFICATION_ON_FLAPPING => 38, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME => 39, self::NOTIFICATIONS_ENABLED => 40, self::STALKING_ON_OK => 41, self::STALKING_ON_WARNING => 42, self::STALKING_ON_UNKNOWN => 43, self::STALKING_ON_CRITICAL => 44, self::FAILURE_PREDICTION_ENABLED => 45, self::NOTES => 46, self::NOTES_URL => 47, self::ACTION_URL => 48, self::ICON_IMAGE => 49, self::ICON_IMAGE_ALT => 50, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'description' => 1, 'display_name' => 2, 'host' => 3, 'host_template' => 4, 'hostgroup' => 5, 'initial_state' => 6, 'is_volatile' => 7, 'check_command' => 8, 'maximum_check_attempts' => 9, 'normal_check_interval' => 10, 'retry_interval' => 11, 'first_notification_delay' => 12, 'active_checks_enabled' => 13, 'passive_checks_enabled' => 14, 'check_period' => 15, 'parallelize_check' => 16, 'obsess_over_service' => 17, 'check_freshness' => 18, 'freshness_threshold' => 19, 'event_handler' => 20, 'event_handler_enabled' => 21, 'low_flap_threshold' => 22, 'high_flap_threshold' => 23, 'flap_detection_enabled' => 24, 'flap_detection_on_ok' => 25, 'flap_detection_on_warning' => 26, 'flap_detection_on_critical' => 27, 'flap_detection_on_unknown' => 28, 'process_perf_data' => 29, 'retain_status_information' => 30, 'retain_nonstatus_information' => 31, 'notification_interval' => 32, 'notification_period' => 33, 'notification_on_warning' => 34, 'notification_on_unknown' => 35, 'notification_on_critical' => 36, 'notification_on_recovery' => 37, 'notification_on_flapping' => 38, 'notification_on_scheduled_downtime' => 39, 'notifications_enabled' => 40, 'stalking_on_ok' => 41, 'stalking_on_warning' => 42, 'stalking_on_unknown' => 43, 'stalking_on_critical' => 44, 'failure_prediction_enabled' => 45, 'notes' => 46, 'notes_url' => 47, 'action_url' => 48, 'icon_image' => 49, 'icon_image_alt' => 50, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServicePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServicePeer::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) + { + + $criteria->addSelectColumn(NagiosServicePeer::ID); + + $criteria->addSelectColumn(NagiosServicePeer::DESCRIPTION); + + $criteria->addSelectColumn(NagiosServicePeer::DISPLAY_NAME); + + $criteria->addSelectColumn(NagiosServicePeer::HOST); + + $criteria->addSelectColumn(NagiosServicePeer::HOST_TEMPLATE); + + $criteria->addSelectColumn(NagiosServicePeer::HOSTGROUP); + + $criteria->addSelectColumn(NagiosServicePeer::INITIAL_STATE); + + $criteria->addSelectColumn(NagiosServicePeer::IS_VOLATILE); + + $criteria->addSelectColumn(NagiosServicePeer::CHECK_COMMAND); + + $criteria->addSelectColumn(NagiosServicePeer::MAXIMUM_CHECK_ATTEMPTS); + + $criteria->addSelectColumn(NagiosServicePeer::NORMAL_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosServicePeer::RETRY_INTERVAL); + + $criteria->addSelectColumn(NagiosServicePeer::FIRST_NOTIFICATION_DELAY); + + $criteria->addSelectColumn(NagiosServicePeer::ACTIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::PASSIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::CHECK_PERIOD); + + $criteria->addSelectColumn(NagiosServicePeer::PARALLELIZE_CHECK); + + $criteria->addSelectColumn(NagiosServicePeer::OBSESS_OVER_SERVICE); + + $criteria->addSelectColumn(NagiosServicePeer::CHECK_FRESHNESS); + + $criteria->addSelectColumn(NagiosServicePeer::FRESHNESS_THRESHOLD); + + $criteria->addSelectColumn(NagiosServicePeer::EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosServicePeer::EVENT_HANDLER_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::LOW_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosServicePeer::HIGH_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosServicePeer::FLAP_DETECTION_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::FLAP_DETECTION_ON_OK); + + $criteria->addSelectColumn(NagiosServicePeer::FLAP_DETECTION_ON_WARNING); + + $criteria->addSelectColumn(NagiosServicePeer::FLAP_DETECTION_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServicePeer::FLAP_DETECTION_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServicePeer::PROCESS_PERF_DATA); + + $criteria->addSelectColumn(NagiosServicePeer::RETAIN_STATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosServicePeer::RETAIN_NONSTATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_INTERVAL); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_WARNING); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME); + + $criteria->addSelectColumn(NagiosServicePeer::NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::STALKING_ON_OK); + + $criteria->addSelectColumn(NagiosServicePeer::STALKING_ON_WARNING); + + $criteria->addSelectColumn(NagiosServicePeer::STALKING_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServicePeer::STALKING_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServicePeer::FAILURE_PREDICTION_ENABLED); + + $criteria->addSelectColumn(NagiosServicePeer::NOTES); + + $criteria->addSelectColumn(NagiosServicePeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosServicePeer::ACTION_URL); + + $criteria->addSelectColumn(NagiosServicePeer::ICON_IMAGE); + + $criteria->addSelectColumn(NagiosServicePeer::ICON_IMAGE_ALT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosService + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServicePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServicePeer::populateObjects(NagiosServicePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServicePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosService $value A NagiosService object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosService $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosService object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosService) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosService object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosService Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServicePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServicePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServicePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosHost objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosHostTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosHostTemplate) + $obj2->addNagiosService($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosHostgroup objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosHostgroupPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosHostgroupPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosHostgroupPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosHostgroup) + $obj2->addNagiosService($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosCommand) + $obj2->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosCommand) + $obj2->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosService) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol9 = $startcol8 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + } // if joined row not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosService($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByCheckCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key6 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosCommandPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosCommandPeer::addInstanceToPool($obj6, $key6); + } // if obj6 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosCommand) + $obj6->addNagiosServiceRelatedByEventHandler($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if obj7 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosServiceRelatedByCheckPeriod($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key8 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol8); + if ($key8 !== null) { + $obj8 = NagiosTimeperiodPeer::getInstanceFromPool($key8); + if (!$obj8) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj8 = new $cls(); + $obj8->hydrate($row, $startcol8); + NagiosTimeperiodPeer::addInstanceToPool($obj8, $key8); + } // if obj8 loaded + + // Add the $obj1 (NagiosService) to the collection in $obj8 (NagiosTimeperiod) + $obj8->addNagiosServiceRelatedByNotificationPeriod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHost table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHost(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosHostgroup table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosHostgroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServicePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServicePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosHost. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHost(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHostTemplate rows + + $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHostTemplate) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key3 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostgroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostgroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostgroup) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key4 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosCommandPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosCommandPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosCommand) + $obj4->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if $obj7 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosHostTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key3 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostgroupPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostgroupPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostgroup) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key4 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosCommandPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosCommandPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosCommand) + $obj4->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if $obj7 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosHostgroup. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosHostgroup(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol8 = $startcol7 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key4 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosCommandPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosCommandPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosCommand) + $obj4->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key7 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol7); + if ($key7 !== null) { + $obj7 = NagiosTimeperiodPeer::getInstanceFromPool($key7); + if (!$obj7) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj7 = new $cls(); + $obj7->hydrate($row, $startcol7); + NagiosTimeperiodPeer::addInstanceToPool($obj7, $key7); + } // if $obj7 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj7 (NagiosTimeperiod) + $obj7->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosCommandRelatedByCheckCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key5 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosTimeperiodPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosTimeperiodPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosTimeperiod) + $obj5->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosCommandRelatedByEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key5 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosTimeperiodPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosTimeperiodPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosTimeperiod) + $obj5->addNagiosServiceRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key6 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosTimeperiodPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosTimeperiodPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosTimeperiod) + $obj6->addNagiosServiceRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosTimeperiodRelatedByCheckPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key6 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosCommandPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosCommandPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosCommand) + $obj6->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosService objects pre-filled with all related objects except NagiosTimeperiodRelatedByNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosService objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServicePeer::addSelectColumns($c); + $startcol2 = (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosHostgroupPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol7 = $startcol6 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServicePeer::HOST,), array(NagiosHostPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOST_TEMPLATE,), array(NagiosHostTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::HOSTGROUP,), array(NagiosHostgroupPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServicePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServicePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServicePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosHost rows + + $key2 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosHostPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosHostPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosHostPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj2 (NagiosHost) + $obj2->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostTemplate rows + + $key3 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosHostTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosHostTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosHostTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj3 (NagiosHostTemplate) + $obj3->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosHostgroup rows + + $key4 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosHostgroupPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosHostgroupPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosHostgroupPeer::addInstanceToPool($obj4, $key4); + } // if $obj4 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj4 (NagiosHostgroup) + $obj4->addNagiosService($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key5 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosCommandPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosCommandPeer::addInstanceToPool($obj5, $key5); + } // if $obj5 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj5 (NagiosCommand) + $obj5->addNagiosServiceRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key6 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol6); + if ($key6 !== null) { + $obj6 = NagiosCommandPeer::getInstanceFromPool($key6); + if (!$obj6) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj6 = new $cls(); + $obj6->hydrate($row, $startcol6); + NagiosCommandPeer::addInstanceToPool($obj6, $key6); + } // if $obj6 already loaded + + // Add the $obj1 (NagiosService) to the collection in $obj6 (NagiosCommand) + $obj6->addNagiosServiceRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServicePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosService or Criteria object. + * + * @param mixed $values Criteria or NagiosService object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosService object + } + + if ($criteria->containsKey(NagiosServicePeer::ID) && $criteria->keyContainsValue(NagiosServicePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServicePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosService or Criteria object. + * + * @param mixed $values Criteria or NagiosService object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServicePeer::ID); + $selectCriteria->add(NagiosServicePeer::ID, $criteria->remove(NagiosServicePeer::ID), $comparison); + + } else { // $values is NagiosService object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service 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(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosServicePeer::doOnDeleteCascade(new Criteria(NagiosServicePeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosServicePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosService or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosService object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServicePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosService) { + // invalidate the cache for this single object + NagiosServicePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServicePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServicePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosServicePeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosServicePeer::clearInstancePool(); + } else { // it's a PK or object + NagiosServicePeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosServiceCheckCommandParameterPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceCheckCommandParameterPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyTargetPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyTargetPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplateInheritancePeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosServicePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosServiceCheckCommandParameter objects + $c = new Criteria(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + + $c->add(NagiosServiceCheckCommandParameterPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosServiceCheckCommandParameterPeer::doDelete($c, $con); + + // delete related NagiosServiceGroupMember objects + $c = new Criteria(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceGroupMemberPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosServiceGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactMember objects + $c = new Criteria(NagiosServiceContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactMemberPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosServiceContactMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactGroupMember objects + $c = new Criteria(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactGroupMemberPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosServiceContactGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + + // delete related NagiosDependencyTarget objects + $c = new Criteria(NagiosDependencyTargetPeer::DATABASE_NAME); + + $c->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $obj->getId()); + $affectedRows += NagiosDependencyTargetPeer::doDelete($c, $con); + + // delete related NagiosEscalation objects + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + + $c->add(NagiosEscalationPeer::SERVICE, $obj->getId()); + $affectedRows += NagiosEscalationPeer::doDelete($c, $con); + + // delete related NagiosServiceTemplateInheritance objects + $c = new Criteria(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $obj->getId()); + $affectedRows += NagiosServiceTemplateInheritancePeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosService 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 NagiosService $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(NagiosService $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServicePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServicePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServicePeer::DATABASE_NAME, NagiosServicePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosService + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServicePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + $criteria->add(NagiosServicePeer::ID, $pk); + + $v = NagiosServicePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServicePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServicePeer::DATABASE_NAME); + $criteria->add(NagiosServicePeer::ID, $pks, Criteria::IN); + $objs = NagiosServicePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServicePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServicePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServicePeer class: +// +// Propel::getDatabaseMap(NagiosServicePeer::DATABASE_NAME)->addTableBuilder(NagiosServicePeer::TABLE_NAME, NagiosServicePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServicePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServicePeer::TABLE_NAME, BaseNagiosServicePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceTemplate.php b/classes/om/BaseNagiosServiceTemplate.php new file mode 100755 index 0000000..5ce84ba --- /dev/null +++ b/classes/om/BaseNagiosServiceTemplate.php @@ -0,0 +1,5662 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get the [initial_state] column value. + * + * @return string + */ + public function getInitialState() + { + return $this->initial_state; + } + + /** + * Get the [is_volatile] column value. + * + * @return boolean + */ + public function getIsVolatile() + { + return $this->is_volatile; + } + + /** + * Get the [check_command] column value. + * + * @return int + */ + public function getCheckCommand() + { + return $this->check_command; + } + + /** + * Get the [maximum_check_attempts] column value. + * + * @return int + */ + public function getMaximumCheckAttempts() + { + return $this->maximum_check_attempts; + } + + /** + * Get the [normal_check_interval] column value. + * + * @return int + */ + public function getNormalCheckInterval() + { + return $this->normal_check_interval; + } + + /** + * Get the [retry_interval] column value. + * + * @return int + */ + public function getRetryInterval() + { + return $this->retry_interval; + } + + /** + * Get the [first_notification_delay] column value. + * + * @return int + */ + public function getFirstNotificationDelay() + { + return $this->first_notification_delay; + } + + /** + * Get the [active_checks_enabled] column value. + * + * @return boolean + */ + public function getActiveChecksEnabled() + { + return $this->active_checks_enabled; + } + + /** + * Get the [passive_checks_enabled] column value. + * + * @return boolean + */ + public function getPassiveChecksEnabled() + { + return $this->passive_checks_enabled; + } + + /** + * Get the [check_period] column value. + * + * @return int + */ + public function getCheckPeriod() + { + return $this->check_period; + } + + /** + * Get the [parallelize_check] column value. + * + * @return boolean + */ + public function getParallelizeCheck() + { + return $this->parallelize_check; + } + + /** + * Get the [obsess_over_service] column value. + * + * @return boolean + */ + public function getObsessOverService() + { + return $this->obsess_over_service; + } + + /** + * Get the [check_freshness] column value. + * + * @return boolean + */ + public function getCheckFreshness() + { + return $this->check_freshness; + } + + /** + * Get the [freshness_threshold] column value. + * + * @return int + */ + public function getFreshnessThreshold() + { + return $this->freshness_threshold; + } + + /** + * Get the [event_handler] column value. + * + * @return int + */ + public function getEventHandler() + { + return $this->event_handler; + } + + /** + * Get the [event_handler_enabled] column value. + * + * @return boolean + */ + public function getEventHandlerEnabled() + { + return $this->event_handler_enabled; + } + + /** + * Get the [low_flap_threshold] column value. + * + * @return int + */ + public function getLowFlapThreshold() + { + return $this->low_flap_threshold; + } + + /** + * Get the [high_flap_threshold] column value. + * + * @return int + */ + public function getHighFlapThreshold() + { + return $this->high_flap_threshold; + } + + /** + * Get the [flap_detection_enabled] column value. + * + * @return boolean + */ + public function getFlapDetectionEnabled() + { + return $this->flap_detection_enabled; + } + + /** + * Get the [flap_detection_on_ok] column value. + * + * @return boolean + */ + public function getFlapDetectionOnOk() + { + return $this->flap_detection_on_ok; + } + + /** + * Get the [flap_detection_on_warning] column value. + * + * @return boolean + */ + public function getFlapDetectionOnWarning() + { + return $this->flap_detection_on_warning; + } + + /** + * Get the [flap_detection_on_critical] column value. + * + * @return boolean + */ + public function getFlapDetectionOnCritical() + { + return $this->flap_detection_on_critical; + } + + /** + * Get the [flap_detection_on_unknown] column value. + * + * @return boolean + */ + public function getFlapDetectionOnUnknown() + { + return $this->flap_detection_on_unknown; + } + + /** + * Get the [process_perf_data] column value. + * + * @return boolean + */ + public function getProcessPerfData() + { + return $this->process_perf_data; + } + + /** + * Get the [retain_status_information] column value. + * + * @return boolean + */ + public function getRetainStatusInformation() + { + return $this->retain_status_information; + } + + /** + * Get the [retain_nonstatus_information] column value. + * + * @return boolean + */ + public function getRetainNonstatusInformation() + { + return $this->retain_nonstatus_information; + } + + /** + * Get the [notification_interval] column value. + * + * @return int + */ + public function getNotificationInterval() + { + return $this->notification_interval; + } + + /** + * Get the [notification_period] column value. + * + * @return int + */ + public function getNotificationPeriod() + { + return $this->notification_period; + } + + /** + * Get the [notification_on_warning] column value. + * + * @return boolean + */ + public function getNotificationOnWarning() + { + return $this->notification_on_warning; + } + + /** + * Get the [notification_on_unknown] column value. + * + * @return boolean + */ + public function getNotificationOnUnknown() + { + return $this->notification_on_unknown; + } + + /** + * Get the [notification_on_critical] column value. + * + * @return boolean + */ + public function getNotificationOnCritical() + { + return $this->notification_on_critical; + } + + /** + * Get the [notification_on_recovery] column value. + * + * @return boolean + */ + public function getNotificationOnRecovery() + { + return $this->notification_on_recovery; + } + + /** + * Get the [notification_on_flapping] column value. + * + * @return boolean + */ + public function getNotificationOnFlapping() + { + return $this->notification_on_flapping; + } + + /** + * Get the [notification_on_scheduled_downtime] column value. + * + * @return boolean + */ + public function getNotificationOnScheduledDowntime() + { + return $this->notification_on_scheduled_downtime; + } + + /** + * Get the [notifications_enabled] column value. + * + * @return boolean + */ + public function getNotificationsEnabled() + { + return $this->notifications_enabled; + } + + /** + * Get the [stalking_on_ok] column value. + * + * @return boolean + */ + public function getStalkingOnOk() + { + return $this->stalking_on_ok; + } + + /** + * Get the [stalking_on_warning] column value. + * + * @return boolean + */ + public function getStalkingOnWarning() + { + return $this->stalking_on_warning; + } + + /** + * Get the [stalking_on_unknown] column value. + * + * @return boolean + */ + public function getStalkingOnUnknown() + { + return $this->stalking_on_unknown; + } + + /** + * Get the [stalking_on_critical] column value. + * + * @return boolean + */ + public function getStalkingOnCritical() + { + return $this->stalking_on_critical; + } + + /** + * Get the [failure_prediction_enabled] column value. + * + * @return boolean + */ + public function getFailurePredictionEnabled() + { + return $this->failure_prediction_enabled; + } + + /** + * Get the [notes] column value. + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Get the [notes_url] column value. + * + * @return string + */ + public function getNotesUrl() + { + return $this->notes_url; + } + + /** + * Get the [action_url] column value. + * + * @return string + */ + public function getActionUrl() + { + return $this->action_url; + } + + /** + * Get the [icon_image] column value. + * + * @return string + */ + public function getIconImage() + { + return $this->icon_image; + } + + /** + * Get the [icon_image_alt] column value. + * + * @return string + */ + public function getIconImageAlt() + { + return $this->icon_image_alt; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::DESCRIPTION; + } + + return $this; + } // setDescription() + + /** + * Set the value of [initial_state] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setInitialState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->initial_state !== $v) { + $this->initial_state = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::INITIAL_STATE; + } + + return $this; + } // setInitialState() + + /** + * Set the value of [is_volatile] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setIsVolatile($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->is_volatile !== $v) { + $this->is_volatile = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::IS_VOLATILE; + } + + return $this; + } // setIsVolatile() + + /** + * Set the value of [check_command] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setCheckCommand($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_command !== $v) { + $this->check_command = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::CHECK_COMMAND; + } + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->aNagiosCommandRelatedByCheckCommand->getId() !== $v) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + + return $this; + } // setCheckCommand() + + /** + * Set the value of [maximum_check_attempts] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setMaximumCheckAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->maximum_check_attempts !== $v) { + $this->maximum_check_attempts = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::MAXIMUM_CHECK_ATTEMPTS; + } + + return $this; + } // setMaximumCheckAttempts() + + /** + * Set the value of [normal_check_interval] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNormalCheckInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->normal_check_interval !== $v) { + $this->normal_check_interval = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NORMAL_CHECK_INTERVAL; + } + + return $this; + } // setNormalCheckInterval() + + /** + * Set the value of [retry_interval] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setRetryInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->retry_interval !== $v) { + $this->retry_interval = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::RETRY_INTERVAL; + } + + return $this; + } // setRetryInterval() + + /** + * Set the value of [first_notification_delay] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFirstNotificationDelay($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->first_notification_delay !== $v) { + $this->first_notification_delay = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FIRST_NOTIFICATION_DELAY; + } + + return $this; + } // setFirstNotificationDelay() + + /** + * Set the value of [active_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setActiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->active_checks_enabled !== $v) { + $this->active_checks_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ACTIVE_CHECKS_ENABLED; + } + + return $this; + } // setActiveChecksEnabled() + + /** + * Set the value of [passive_checks_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setPassiveChecksEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->passive_checks_enabled !== $v) { + $this->passive_checks_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::PASSIVE_CHECKS_ENABLED; + } + + return $this; + } // setPassiveChecksEnabled() + + /** + * Set the value of [check_period] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setCheckPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->check_period !== $v) { + $this->check_period = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::CHECK_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->aNagiosTimeperiodRelatedByCheckPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + + return $this; + } // setCheckPeriod() + + /** + * Set the value of [parallelize_check] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setParallelizeCheck($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->parallelize_check !== $v) { + $this->parallelize_check = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::PARALLELIZE_CHECK; + } + + return $this; + } // setParallelizeCheck() + + /** + * Set the value of [obsess_over_service] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setObsessOverService($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->obsess_over_service !== $v) { + $this->obsess_over_service = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::OBSESS_OVER_SERVICE; + } + + return $this; + } // setObsessOverService() + + /** + * Set the value of [check_freshness] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setCheckFreshness($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->check_freshness !== $v) { + $this->check_freshness = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::CHECK_FRESHNESS; + } + + return $this; + } // setCheckFreshness() + + /** + * Set the value of [freshness_threshold] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFreshnessThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->freshness_threshold !== $v) { + $this->freshness_threshold = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FRESHNESS_THRESHOLD; + } + + return $this; + } // setFreshnessThreshold() + + /** + * Set the value of [event_handler] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setEventHandler($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->event_handler !== $v) { + $this->event_handler = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::EVENT_HANDLER; + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->aNagiosCommandRelatedByEventHandler->getId() !== $v) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + + return $this; + } // setEventHandler() + + /** + * Set the value of [event_handler_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setEventHandlerEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->event_handler_enabled !== $v) { + $this->event_handler_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::EVENT_HANDLER_ENABLED; + } + + return $this; + } // setEventHandlerEnabled() + + /** + * Set the value of [low_flap_threshold] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setLowFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->low_flap_threshold !== $v) { + $this->low_flap_threshold = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::LOW_FLAP_THRESHOLD; + } + + return $this; + } // setLowFlapThreshold() + + /** + * Set the value of [high_flap_threshold] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setHighFlapThreshold($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->high_flap_threshold !== $v) { + $this->high_flap_threshold = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::HIGH_FLAP_THRESHOLD; + } + + return $this; + } // setHighFlapThreshold() + + /** + * Set the value of [flap_detection_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFlapDetectionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_enabled !== $v) { + $this->flap_detection_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FLAP_DETECTION_ENABLED; + } + + return $this; + } // setFlapDetectionEnabled() + + /** + * Set the value of [flap_detection_on_ok] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_ok !== $v) { + $this->flap_detection_on_ok = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FLAP_DETECTION_ON_OK; + } + + return $this; + } // setFlapDetectionOnOk() + + /** + * Set the value of [flap_detection_on_warning] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_warning !== $v) { + $this->flap_detection_on_warning = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FLAP_DETECTION_ON_WARNING; + } + + return $this; + } // setFlapDetectionOnWarning() + + /** + * Set the value of [flap_detection_on_critical] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_critical !== $v) { + $this->flap_detection_on_critical = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FLAP_DETECTION_ON_CRITICAL; + } + + return $this; + } // setFlapDetectionOnCritical() + + /** + * Set the value of [flap_detection_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFlapDetectionOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->flap_detection_on_unknown !== $v) { + $this->flap_detection_on_unknown = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FLAP_DETECTION_ON_UNKNOWN; + } + + return $this; + } // setFlapDetectionOnUnknown() + + /** + * Set the value of [process_perf_data] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setProcessPerfData($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->process_perf_data !== $v) { + $this->process_perf_data = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::PROCESS_PERF_DATA; + } + + return $this; + } // setProcessPerfData() + + /** + * Set the value of [retain_status_information] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setRetainStatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_status_information !== $v) { + $this->retain_status_information = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::RETAIN_STATUS_INFORMATION; + } + + return $this; + } // setRetainStatusInformation() + + /** + * Set the value of [retain_nonstatus_information] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setRetainNonstatusInformation($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->retain_nonstatus_information !== $v) { + $this->retain_nonstatus_information = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::RETAIN_NONSTATUS_INFORMATION; + } + + return $this; + } // setRetainNonstatusInformation() + + /** + * Set the value of [notification_interval] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationInterval($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_interval !== $v) { + $this->notification_interval = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_INTERVAL; + } + + return $this; + } // setNotificationInterval() + + /** + * Set the value of [notification_period] column. + * + * @param int $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationPeriod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->notification_period !== $v) { + $this->notification_period = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_PERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + + return $this; + } // setNotificationPeriod() + + /** + * Set the value of [notification_on_warning] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_warning !== $v) { + $this->notification_on_warning = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_WARNING; + } + + return $this; + } // setNotificationOnWarning() + + /** + * Set the value of [notification_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_unknown !== $v) { + $this->notification_on_unknown = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_UNKNOWN; + } + + return $this; + } // setNotificationOnUnknown() + + /** + * Set the value of [notification_on_critical] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_critical !== $v) { + $this->notification_on_critical = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_CRITICAL; + } + + return $this; + } // setNotificationOnCritical() + + /** + * Set the value of [notification_on_recovery] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnRecovery($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_recovery !== $v) { + $this->notification_on_recovery = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_RECOVERY; + } + + return $this; + } // setNotificationOnRecovery() + + /** + * Set the value of [notification_on_flapping] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnFlapping($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_flapping !== $v) { + $this->notification_on_flapping = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_FLAPPING; + } + + return $this; + } // setNotificationOnFlapping() + + /** + * Set the value of [notification_on_scheduled_downtime] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationOnScheduledDowntime($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notification_on_scheduled_downtime !== $v) { + $this->notification_on_scheduled_downtime = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME; + } + + return $this; + } // setNotificationOnScheduledDowntime() + + /** + * Set the value of [notifications_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotificationsEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->notifications_enabled !== $v) { + $this->notifications_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTIFICATIONS_ENABLED; + } + + return $this; + } // setNotificationsEnabled() + + /** + * Set the value of [stalking_on_ok] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setStalkingOnOk($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_ok !== $v) { + $this->stalking_on_ok = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::STALKING_ON_OK; + } + + return $this; + } // setStalkingOnOk() + + /** + * Set the value of [stalking_on_warning] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setStalkingOnWarning($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_warning !== $v) { + $this->stalking_on_warning = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::STALKING_ON_WARNING; + } + + return $this; + } // setStalkingOnWarning() + + /** + * Set the value of [stalking_on_unknown] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setStalkingOnUnknown($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_unknown !== $v) { + $this->stalking_on_unknown = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::STALKING_ON_UNKNOWN; + } + + return $this; + } // setStalkingOnUnknown() + + /** + * Set the value of [stalking_on_critical] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setStalkingOnCritical($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->stalking_on_critical !== $v) { + $this->stalking_on_critical = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::STALKING_ON_CRITICAL; + } + + return $this; + } // setStalkingOnCritical() + + /** + * Set the value of [failure_prediction_enabled] column. + * + * @param boolean $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setFailurePredictionEnabled($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->failure_prediction_enabled !== $v) { + $this->failure_prediction_enabled = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::FAILURE_PREDICTION_ENABLED; + } + + return $this; + } // setFailurePredictionEnabled() + + /** + * Set the value of [notes] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotes($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes !== $v) { + $this->notes = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTES; + } + + return $this; + } // setNotes() + + /** + * Set the value of [notes_url] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setNotesUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->notes_url !== $v) { + $this->notes_url = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::NOTES_URL; + } + + return $this; + } // setNotesUrl() + + /** + * Set the value of [action_url] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setActionUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action_url !== $v) { + $this->action_url = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ACTION_URL; + } + + return $this; + } // setActionUrl() + + /** + * Set the value of [icon_image] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setIconImage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image !== $v) { + $this->icon_image = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ICON_IMAGE; + } + + return $this; + } // setIconImage() + + /** + * Set the value of [icon_image_alt] column. + * + * @param string $v new value + * @return NagiosServiceTemplate The current object (for fluent API support) + */ + public function setIconImageAlt($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->icon_image_alt !== $v) { + $this->icon_image_alt = $v; + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ICON_IMAGE_ALT; + } + + return $this; + } // setIconImageAlt() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->initial_state = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->is_volatile = ($row[$startcol + 4] !== null) ? (boolean) $row[$startcol + 4] : null; + $this->check_command = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->maximum_check_attempts = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->normal_check_interval = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->retry_interval = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->first_notification_delay = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->active_checks_enabled = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null; + $this->passive_checks_enabled = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->check_period = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null; + $this->parallelize_check = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; + $this->obsess_over_service = ($row[$startcol + 14] !== null) ? (boolean) $row[$startcol + 14] : null; + $this->check_freshness = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; + $this->freshness_threshold = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null; + $this->event_handler = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null; + $this->event_handler_enabled = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; + $this->low_flap_threshold = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null; + $this->high_flap_threshold = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null; + $this->flap_detection_enabled = ($row[$startcol + 21] !== null) ? (boolean) $row[$startcol + 21] : null; + $this->flap_detection_on_ok = ($row[$startcol + 22] !== null) ? (boolean) $row[$startcol + 22] : null; + $this->flap_detection_on_warning = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; + $this->flap_detection_on_critical = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; + $this->flap_detection_on_unknown = ($row[$startcol + 25] !== null) ? (boolean) $row[$startcol + 25] : null; + $this->process_perf_data = ($row[$startcol + 26] !== null) ? (boolean) $row[$startcol + 26] : null; + $this->retain_status_information = ($row[$startcol + 27] !== null) ? (boolean) $row[$startcol + 27] : null; + $this->retain_nonstatus_information = ($row[$startcol + 28] !== null) ? (boolean) $row[$startcol + 28] : null; + $this->notification_interval = ($row[$startcol + 29] !== null) ? (int) $row[$startcol + 29] : null; + $this->notification_period = ($row[$startcol + 30] !== null) ? (int) $row[$startcol + 30] : null; + $this->notification_on_warning = ($row[$startcol + 31] !== null) ? (boolean) $row[$startcol + 31] : null; + $this->notification_on_unknown = ($row[$startcol + 32] !== null) ? (boolean) $row[$startcol + 32] : null; + $this->notification_on_critical = ($row[$startcol + 33] !== null) ? (boolean) $row[$startcol + 33] : null; + $this->notification_on_recovery = ($row[$startcol + 34] !== null) ? (boolean) $row[$startcol + 34] : null; + $this->notification_on_flapping = ($row[$startcol + 35] !== null) ? (boolean) $row[$startcol + 35] : null; + $this->notification_on_scheduled_downtime = ($row[$startcol + 36] !== null) ? (boolean) $row[$startcol + 36] : null; + $this->notifications_enabled = ($row[$startcol + 37] !== null) ? (boolean) $row[$startcol + 37] : null; + $this->stalking_on_ok = ($row[$startcol + 38] !== null) ? (boolean) $row[$startcol + 38] : null; + $this->stalking_on_warning = ($row[$startcol + 39] !== null) ? (boolean) $row[$startcol + 39] : null; + $this->stalking_on_unknown = ($row[$startcol + 40] !== null) ? (boolean) $row[$startcol + 40] : null; + $this->stalking_on_critical = ($row[$startcol + 41] !== null) ? (boolean) $row[$startcol + 41] : null; + $this->failure_prediction_enabled = ($row[$startcol + 42] !== null) ? (boolean) $row[$startcol + 42] : null; + $this->notes = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null; + $this->notes_url = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null; + $this->action_url = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null; + $this->icon_image = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; + $this->icon_image_alt = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 48; // 48 = NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceTemplate object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosCommandRelatedByCheckCommand !== null && $this->check_command !== $this->aNagiosCommandRelatedByCheckCommand->getId()) { + $this->aNagiosCommandRelatedByCheckCommand = null; + } + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null && $this->check_period !== $this->aNagiosTimeperiodRelatedByCheckPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + } + if ($this->aNagiosCommandRelatedByEventHandler !== null && $this->event_handler !== $this->aNagiosCommandRelatedByEventHandler->getId()) { + $this->aNagiosCommandRelatedByEventHandler = null; + } + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null && $this->notification_period !== $this->aNagiosTimeperiodRelatedByNotificationPeriod->getId()) { + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceTemplatePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + $this->collNagiosServiceCheckCommandParameters = null; + $this->lastNagiosServiceCheckCommandParameterCriteria = null; + + $this->collNagiosServiceGroupMembers = null; + $this->lastNagiosServiceGroupMemberCriteria = null; + + $this->collNagiosServiceContactMembers = null; + $this->lastNagiosServiceContactMemberCriteria = null; + + $this->collNagiosServiceContactGroupMembers = null; + $this->lastNagiosServiceContactGroupMemberCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = null; + $this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria = null; + + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = null; + $this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceTemplatePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceTemplatePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosCommandRelatedByCheckCommand !== null) { + if ($this->aNagiosCommandRelatedByCheckCommand->isModified() || $this->aNagiosCommandRelatedByCheckCommand->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByCheckCommand->save($con); + } + $this->setNagiosCommandRelatedByCheckCommand($this->aNagiosCommandRelatedByCheckCommand); + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if ($this->aNagiosCommandRelatedByEventHandler->isModified() || $this->aNagiosCommandRelatedByEventHandler->isNew()) { + $affectedRows += $this->aNagiosCommandRelatedByEventHandler->save($con); + } + $this->setNagiosCommandRelatedByEventHandler($this->aNagiosCommandRelatedByEventHandler); + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod->isModified() || $this->aNagiosTimeperiodRelatedByCheckPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByCheckPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByCheckPeriod($this->aNagiosTimeperiodRelatedByCheckPeriod); + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod->isModified() || $this->aNagiosTimeperiodRelatedByNotificationPeriod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByNotificationPeriod->save($con); + } + $this->setNagiosTimeperiodRelatedByNotificationPeriod($this->aNagiosTimeperiodRelatedByNotificationPeriod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceTemplatePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceTemplatePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceTemplatePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosServiceCheckCommandParameters !== null) { + foreach ($this->collNagiosServiceCheckCommandParameters as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate !== null) { + foreach ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate !== null) { + foreach ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosCommandRelatedByCheckCommand !== null) { + if (!$this->aNagiosCommandRelatedByCheckCommand->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByCheckCommand->getValidationFailures()); + } + } + + if ($this->aNagiosCommandRelatedByEventHandler !== null) { + if (!$this->aNagiosCommandRelatedByEventHandler->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosCommandRelatedByEventHandler->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByCheckPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByCheckPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByCheckPeriod->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod !== null) { + if (!$this->aNagiosTimeperiodRelatedByNotificationPeriod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByNotificationPeriod->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceTemplatePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosServiceCheckCommandParameters !== null) { + foreach ($this->collNagiosServiceCheckCommandParameters as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceGroupMembers !== null) { + foreach ($this->collNagiosServiceGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactMembers !== null) { + foreach ($this->collNagiosServiceContactMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceContactGroupMembers !== null) { + foreach ($this->collNagiosServiceContactGroupMembers as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate !== null) { + foreach ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate !== null) { + foreach ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceTemplatePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getDescription(); + break; + case 3: + return $this->getInitialState(); + break; + case 4: + return $this->getIsVolatile(); + break; + case 5: + return $this->getCheckCommand(); + break; + case 6: + return $this->getMaximumCheckAttempts(); + break; + case 7: + return $this->getNormalCheckInterval(); + break; + case 8: + return $this->getRetryInterval(); + break; + case 9: + return $this->getFirstNotificationDelay(); + break; + case 10: + return $this->getActiveChecksEnabled(); + break; + case 11: + return $this->getPassiveChecksEnabled(); + break; + case 12: + return $this->getCheckPeriod(); + break; + case 13: + return $this->getParallelizeCheck(); + break; + case 14: + return $this->getObsessOverService(); + break; + case 15: + return $this->getCheckFreshness(); + break; + case 16: + return $this->getFreshnessThreshold(); + break; + case 17: + return $this->getEventHandler(); + break; + case 18: + return $this->getEventHandlerEnabled(); + break; + case 19: + return $this->getLowFlapThreshold(); + break; + case 20: + return $this->getHighFlapThreshold(); + break; + case 21: + return $this->getFlapDetectionEnabled(); + break; + case 22: + return $this->getFlapDetectionOnOk(); + break; + case 23: + return $this->getFlapDetectionOnWarning(); + break; + case 24: + return $this->getFlapDetectionOnCritical(); + break; + case 25: + return $this->getFlapDetectionOnUnknown(); + break; + case 26: + return $this->getProcessPerfData(); + break; + case 27: + return $this->getRetainStatusInformation(); + break; + case 28: + return $this->getRetainNonstatusInformation(); + break; + case 29: + return $this->getNotificationInterval(); + break; + case 30: + return $this->getNotificationPeriod(); + break; + case 31: + return $this->getNotificationOnWarning(); + break; + case 32: + return $this->getNotificationOnUnknown(); + break; + case 33: + return $this->getNotificationOnCritical(); + break; + case 34: + return $this->getNotificationOnRecovery(); + break; + case 35: + return $this->getNotificationOnFlapping(); + break; + case 36: + return $this->getNotificationOnScheduledDowntime(); + break; + case 37: + return $this->getNotificationsEnabled(); + break; + case 38: + return $this->getStalkingOnOk(); + break; + case 39: + return $this->getStalkingOnWarning(); + break; + case 40: + return $this->getStalkingOnUnknown(); + break; + case 41: + return $this->getStalkingOnCritical(); + break; + case 42: + return $this->getFailurePredictionEnabled(); + break; + case 43: + return $this->getNotes(); + break; + case 44: + return $this->getNotesUrl(); + break; + case 45: + return $this->getActionUrl(); + break; + case 46: + return $this->getIconImage(); + break; + case 47: + return $this->getIconImageAlt(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceTemplatePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getDescription(), + $keys[3] => $this->getInitialState(), + $keys[4] => $this->getIsVolatile(), + $keys[5] => $this->getCheckCommand(), + $keys[6] => $this->getMaximumCheckAttempts(), + $keys[7] => $this->getNormalCheckInterval(), + $keys[8] => $this->getRetryInterval(), + $keys[9] => $this->getFirstNotificationDelay(), + $keys[10] => $this->getActiveChecksEnabled(), + $keys[11] => $this->getPassiveChecksEnabled(), + $keys[12] => $this->getCheckPeriod(), + $keys[13] => $this->getParallelizeCheck(), + $keys[14] => $this->getObsessOverService(), + $keys[15] => $this->getCheckFreshness(), + $keys[16] => $this->getFreshnessThreshold(), + $keys[17] => $this->getEventHandler(), + $keys[18] => $this->getEventHandlerEnabled(), + $keys[19] => $this->getLowFlapThreshold(), + $keys[20] => $this->getHighFlapThreshold(), + $keys[21] => $this->getFlapDetectionEnabled(), + $keys[22] => $this->getFlapDetectionOnOk(), + $keys[23] => $this->getFlapDetectionOnWarning(), + $keys[24] => $this->getFlapDetectionOnCritical(), + $keys[25] => $this->getFlapDetectionOnUnknown(), + $keys[26] => $this->getProcessPerfData(), + $keys[27] => $this->getRetainStatusInformation(), + $keys[28] => $this->getRetainNonstatusInformation(), + $keys[29] => $this->getNotificationInterval(), + $keys[30] => $this->getNotificationPeriod(), + $keys[31] => $this->getNotificationOnWarning(), + $keys[32] => $this->getNotificationOnUnknown(), + $keys[33] => $this->getNotificationOnCritical(), + $keys[34] => $this->getNotificationOnRecovery(), + $keys[35] => $this->getNotificationOnFlapping(), + $keys[36] => $this->getNotificationOnScheduledDowntime(), + $keys[37] => $this->getNotificationsEnabled(), + $keys[38] => $this->getStalkingOnOk(), + $keys[39] => $this->getStalkingOnWarning(), + $keys[40] => $this->getStalkingOnUnknown(), + $keys[41] => $this->getStalkingOnCritical(), + $keys[42] => $this->getFailurePredictionEnabled(), + $keys[43] => $this->getNotes(), + $keys[44] => $this->getNotesUrl(), + $keys[45] => $this->getActionUrl(), + $keys[46] => $this->getIconImage(), + $keys[47] => $this->getIconImageAlt(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceTemplatePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setDescription($value); + break; + case 3: + $this->setInitialState($value); + break; + case 4: + $this->setIsVolatile($value); + break; + case 5: + $this->setCheckCommand($value); + break; + case 6: + $this->setMaximumCheckAttempts($value); + break; + case 7: + $this->setNormalCheckInterval($value); + break; + case 8: + $this->setRetryInterval($value); + break; + case 9: + $this->setFirstNotificationDelay($value); + break; + case 10: + $this->setActiveChecksEnabled($value); + break; + case 11: + $this->setPassiveChecksEnabled($value); + break; + case 12: + $this->setCheckPeriod($value); + break; + case 13: + $this->setParallelizeCheck($value); + break; + case 14: + $this->setObsessOverService($value); + break; + case 15: + $this->setCheckFreshness($value); + break; + case 16: + $this->setFreshnessThreshold($value); + break; + case 17: + $this->setEventHandler($value); + break; + case 18: + $this->setEventHandlerEnabled($value); + break; + case 19: + $this->setLowFlapThreshold($value); + break; + case 20: + $this->setHighFlapThreshold($value); + break; + case 21: + $this->setFlapDetectionEnabled($value); + break; + case 22: + $this->setFlapDetectionOnOk($value); + break; + case 23: + $this->setFlapDetectionOnWarning($value); + break; + case 24: + $this->setFlapDetectionOnCritical($value); + break; + case 25: + $this->setFlapDetectionOnUnknown($value); + break; + case 26: + $this->setProcessPerfData($value); + break; + case 27: + $this->setRetainStatusInformation($value); + break; + case 28: + $this->setRetainNonstatusInformation($value); + break; + case 29: + $this->setNotificationInterval($value); + break; + case 30: + $this->setNotificationPeriod($value); + break; + case 31: + $this->setNotificationOnWarning($value); + break; + case 32: + $this->setNotificationOnUnknown($value); + break; + case 33: + $this->setNotificationOnCritical($value); + break; + case 34: + $this->setNotificationOnRecovery($value); + break; + case 35: + $this->setNotificationOnFlapping($value); + break; + case 36: + $this->setNotificationOnScheduledDowntime($value); + break; + case 37: + $this->setNotificationsEnabled($value); + break; + case 38: + $this->setStalkingOnOk($value); + break; + case 39: + $this->setStalkingOnWarning($value); + break; + case 40: + $this->setStalkingOnUnknown($value); + break; + case 41: + $this->setStalkingOnCritical($value); + break; + case 42: + $this->setFailurePredictionEnabled($value); + break; + case 43: + $this->setNotes($value); + break; + case 44: + $this->setNotesUrl($value); + break; + case 45: + $this->setActionUrl($value); + break; + case 46: + $this->setIconImage($value); + break; + case 47: + $this->setIconImageAlt($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceTemplatePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setInitialState($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsVolatile($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setCheckCommand($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setMaximumCheckAttempts($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setNormalCheckInterval($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setRetryInterval($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setFirstNotificationDelay($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setActiveChecksEnabled($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setPassiveChecksEnabled($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCheckPeriod($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setParallelizeCheck($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setObsessOverService($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setCheckFreshness($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setFreshnessThreshold($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setEventHandler($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setEventHandlerEnabled($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setLowFlapThreshold($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setHighFlapThreshold($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setFlapDetectionEnabled($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setFlapDetectionOnOk($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setFlapDetectionOnWarning($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setFlapDetectionOnCritical($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setFlapDetectionOnUnknown($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setProcessPerfData($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setRetainStatusInformation($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setRetainNonstatusInformation($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setNotificationInterval($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setNotificationPeriod($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setNotificationOnWarning($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setNotificationOnUnknown($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setNotificationOnCritical($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setNotificationOnRecovery($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setNotificationOnFlapping($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setNotificationOnScheduledDowntime($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setNotificationsEnabled($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setStalkingOnOk($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setStalkingOnWarning($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setStalkingOnUnknown($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setStalkingOnCritical($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setFailurePredictionEnabled($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setNotes($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setNotesUrl($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setActionUrl($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setIconImage($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setIconImageAlt($arr[$keys[47]]); + } + + /** + * 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(NagiosServiceTemplatePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceTemplatePeer::ID)) $criteria->add(NagiosServiceTemplatePeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NAME)) $criteria->add(NagiosServiceTemplatePeer::NAME, $this->name); + if ($this->isColumnModified(NagiosServiceTemplatePeer::DESCRIPTION)) $criteria->add(NagiosServiceTemplatePeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(NagiosServiceTemplatePeer::INITIAL_STATE)) $criteria->add(NagiosServiceTemplatePeer::INITIAL_STATE, $this->initial_state); + if ($this->isColumnModified(NagiosServiceTemplatePeer::IS_VOLATILE)) $criteria->add(NagiosServiceTemplatePeer::IS_VOLATILE, $this->is_volatile); + if ($this->isColumnModified(NagiosServiceTemplatePeer::CHECK_COMMAND)) $criteria->add(NagiosServiceTemplatePeer::CHECK_COMMAND, $this->check_command); + if ($this->isColumnModified(NagiosServiceTemplatePeer::MAXIMUM_CHECK_ATTEMPTS)) $criteria->add(NagiosServiceTemplatePeer::MAXIMUM_CHECK_ATTEMPTS, $this->maximum_check_attempts); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NORMAL_CHECK_INTERVAL)) $criteria->add(NagiosServiceTemplatePeer::NORMAL_CHECK_INTERVAL, $this->normal_check_interval); + if ($this->isColumnModified(NagiosServiceTemplatePeer::RETRY_INTERVAL)) $criteria->add(NagiosServiceTemplatePeer::RETRY_INTERVAL, $this->retry_interval); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FIRST_NOTIFICATION_DELAY)) $criteria->add(NagiosServiceTemplatePeer::FIRST_NOTIFICATION_DELAY, $this->first_notification_delay); + if ($this->isColumnModified(NagiosServiceTemplatePeer::ACTIVE_CHECKS_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::ACTIVE_CHECKS_ENABLED, $this->active_checks_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::PASSIVE_CHECKS_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::PASSIVE_CHECKS_ENABLED, $this->passive_checks_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::CHECK_PERIOD)) $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->check_period); + if ($this->isColumnModified(NagiosServiceTemplatePeer::PARALLELIZE_CHECK)) $criteria->add(NagiosServiceTemplatePeer::PARALLELIZE_CHECK, $this->parallelize_check); + if ($this->isColumnModified(NagiosServiceTemplatePeer::OBSESS_OVER_SERVICE)) $criteria->add(NagiosServiceTemplatePeer::OBSESS_OVER_SERVICE, $this->obsess_over_service); + if ($this->isColumnModified(NagiosServiceTemplatePeer::CHECK_FRESHNESS)) $criteria->add(NagiosServiceTemplatePeer::CHECK_FRESHNESS, $this->check_freshness); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FRESHNESS_THRESHOLD)) $criteria->add(NagiosServiceTemplatePeer::FRESHNESS_THRESHOLD, $this->freshness_threshold); + if ($this->isColumnModified(NagiosServiceTemplatePeer::EVENT_HANDLER)) $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER, $this->event_handler); + if ($this->isColumnModified(NagiosServiceTemplatePeer::EVENT_HANDLER_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::EVENT_HANDLER_ENABLED, $this->event_handler_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::LOW_FLAP_THRESHOLD)) $criteria->add(NagiosServiceTemplatePeer::LOW_FLAP_THRESHOLD, $this->low_flap_threshold); + if ($this->isColumnModified(NagiosServiceTemplatePeer::HIGH_FLAP_THRESHOLD)) $criteria->add(NagiosServiceTemplatePeer::HIGH_FLAP_THRESHOLD, $this->high_flap_threshold); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FLAP_DETECTION_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::FLAP_DETECTION_ENABLED, $this->flap_detection_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_OK)) $criteria->add(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_OK, $this->flap_detection_on_ok); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_WARNING)) $criteria->add(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_WARNING, $this->flap_detection_on_warning); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_CRITICAL)) $criteria->add(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_CRITICAL, $this->flap_detection_on_critical); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_UNKNOWN)) $criteria->add(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_UNKNOWN, $this->flap_detection_on_unknown); + if ($this->isColumnModified(NagiosServiceTemplatePeer::PROCESS_PERF_DATA)) $criteria->add(NagiosServiceTemplatePeer::PROCESS_PERF_DATA, $this->process_perf_data); + if ($this->isColumnModified(NagiosServiceTemplatePeer::RETAIN_STATUS_INFORMATION)) $criteria->add(NagiosServiceTemplatePeer::RETAIN_STATUS_INFORMATION, $this->retain_status_information); + if ($this->isColumnModified(NagiosServiceTemplatePeer::RETAIN_NONSTATUS_INFORMATION)) $criteria->add(NagiosServiceTemplatePeer::RETAIN_NONSTATUS_INFORMATION, $this->retain_nonstatus_information); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_INTERVAL)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_INTERVAL, $this->notification_interval); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->notification_period); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_WARNING)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_WARNING, $this->notification_on_warning); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_UNKNOWN)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_UNKNOWN, $this->notification_on_unknown); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_CRITICAL)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_CRITICAL, $this->notification_on_critical); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_RECOVERY)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_RECOVERY, $this->notification_on_recovery); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_FLAPPING)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_FLAPPING, $this->notification_on_flapping); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME, $this->notification_on_scheduled_downtime); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTIFICATIONS_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::NOTIFICATIONS_ENABLED, $this->notifications_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::STALKING_ON_OK)) $criteria->add(NagiosServiceTemplatePeer::STALKING_ON_OK, $this->stalking_on_ok); + if ($this->isColumnModified(NagiosServiceTemplatePeer::STALKING_ON_WARNING)) $criteria->add(NagiosServiceTemplatePeer::STALKING_ON_WARNING, $this->stalking_on_warning); + if ($this->isColumnModified(NagiosServiceTemplatePeer::STALKING_ON_UNKNOWN)) $criteria->add(NagiosServiceTemplatePeer::STALKING_ON_UNKNOWN, $this->stalking_on_unknown); + if ($this->isColumnModified(NagiosServiceTemplatePeer::STALKING_ON_CRITICAL)) $criteria->add(NagiosServiceTemplatePeer::STALKING_ON_CRITICAL, $this->stalking_on_critical); + if ($this->isColumnModified(NagiosServiceTemplatePeer::FAILURE_PREDICTION_ENABLED)) $criteria->add(NagiosServiceTemplatePeer::FAILURE_PREDICTION_ENABLED, $this->failure_prediction_enabled); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTES)) $criteria->add(NagiosServiceTemplatePeer::NOTES, $this->notes); + if ($this->isColumnModified(NagiosServiceTemplatePeer::NOTES_URL)) $criteria->add(NagiosServiceTemplatePeer::NOTES_URL, $this->notes_url); + if ($this->isColumnModified(NagiosServiceTemplatePeer::ACTION_URL)) $criteria->add(NagiosServiceTemplatePeer::ACTION_URL, $this->action_url); + if ($this->isColumnModified(NagiosServiceTemplatePeer::ICON_IMAGE)) $criteria->add(NagiosServiceTemplatePeer::ICON_IMAGE, $this->icon_image); + if ($this->isColumnModified(NagiosServiceTemplatePeer::ICON_IMAGE_ALT)) $criteria->add(NagiosServiceTemplatePeer::ICON_IMAGE_ALT, $this->icon_image_alt); + + 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(NagiosServiceTemplatePeer::DATABASE_NAME); + + $criteria->add(NagiosServiceTemplatePeer::ID, $this->id); + + 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 NagiosServiceTemplate (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) + { + + $copyObj->setName($this->name); + + $copyObj->setDescription($this->description); + + $copyObj->setInitialState($this->initial_state); + + $copyObj->setIsVolatile($this->is_volatile); + + $copyObj->setCheckCommand($this->check_command); + + $copyObj->setMaximumCheckAttempts($this->maximum_check_attempts); + + $copyObj->setNormalCheckInterval($this->normal_check_interval); + + $copyObj->setRetryInterval($this->retry_interval); + + $copyObj->setFirstNotificationDelay($this->first_notification_delay); + + $copyObj->setActiveChecksEnabled($this->active_checks_enabled); + + $copyObj->setPassiveChecksEnabled($this->passive_checks_enabled); + + $copyObj->setCheckPeriod($this->check_period); + + $copyObj->setParallelizeCheck($this->parallelize_check); + + $copyObj->setObsessOverService($this->obsess_over_service); + + $copyObj->setCheckFreshness($this->check_freshness); + + $copyObj->setFreshnessThreshold($this->freshness_threshold); + + $copyObj->setEventHandler($this->event_handler); + + $copyObj->setEventHandlerEnabled($this->event_handler_enabled); + + $copyObj->setLowFlapThreshold($this->low_flap_threshold); + + $copyObj->setHighFlapThreshold($this->high_flap_threshold); + + $copyObj->setFlapDetectionEnabled($this->flap_detection_enabled); + + $copyObj->setFlapDetectionOnOk($this->flap_detection_on_ok); + + $copyObj->setFlapDetectionOnWarning($this->flap_detection_on_warning); + + $copyObj->setFlapDetectionOnCritical($this->flap_detection_on_critical); + + $copyObj->setFlapDetectionOnUnknown($this->flap_detection_on_unknown); + + $copyObj->setProcessPerfData($this->process_perf_data); + + $copyObj->setRetainStatusInformation($this->retain_status_information); + + $copyObj->setRetainNonstatusInformation($this->retain_nonstatus_information); + + $copyObj->setNotificationInterval($this->notification_interval); + + $copyObj->setNotificationPeriod($this->notification_period); + + $copyObj->setNotificationOnWarning($this->notification_on_warning); + + $copyObj->setNotificationOnUnknown($this->notification_on_unknown); + + $copyObj->setNotificationOnCritical($this->notification_on_critical); + + $copyObj->setNotificationOnRecovery($this->notification_on_recovery); + + $copyObj->setNotificationOnFlapping($this->notification_on_flapping); + + $copyObj->setNotificationOnScheduledDowntime($this->notification_on_scheduled_downtime); + + $copyObj->setNotificationsEnabled($this->notifications_enabled); + + $copyObj->setStalkingOnOk($this->stalking_on_ok); + + $copyObj->setStalkingOnWarning($this->stalking_on_warning); + + $copyObj->setStalkingOnUnknown($this->stalking_on_unknown); + + $copyObj->setStalkingOnCritical($this->stalking_on_critical); + + $copyObj->setFailurePredictionEnabled($this->failure_prediction_enabled); + + $copyObj->setNotes($this->notes); + + $copyObj->setNotesUrl($this->notes_url); + + $copyObj->setActionUrl($this->action_url); + + $copyObj->setIconImage($this->icon_image); + + $copyObj->setIconImageAlt($this->icon_image_alt); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosServiceCheckCommandParameters() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceCheckCommandParameter($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceContactGroupMembers() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceContactGroupMember($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplateInheritancesRelatedBySourceTemplate() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateInheritanceRelatedBySourceTemplate($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplateInheritancesRelatedByTargetTemplate() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceTemplate 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); + $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 NagiosServiceTemplatePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceTemplatePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosServiceTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByCheckCommand(NagiosCommand $v = null) + { + if ($v === null) { + $this->setCheckCommand(NULL); + } else { + $this->setCheckCommand($v->getId()); + } + + $this->aNagiosCommandRelatedByCheckCommand = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateRelatedByCheckCommand($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByCheckCommand(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByCheckCommand === null && ($this->check_command !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->check_command); + $this->aNagiosCommandRelatedByCheckCommand = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByCheckCommand->addNagiosServiceTemplatesRelatedByCheckCommand($this); + */ + } + return $this->aNagiosCommandRelatedByCheckCommand; + } + + /** + * Declares an association between this object and a NagiosCommand object. + * + * @param NagiosCommand $v + * @return NagiosServiceTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosCommandRelatedByEventHandler(NagiosCommand $v = null) + { + if ($v === null) { + $this->setEventHandler(NULL); + } else { + $this->setEventHandler($v->getId()); + } + + $this->aNagiosCommandRelatedByEventHandler = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosCommand object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateRelatedByEventHandler($this); + } + + return $this; + } + + + /** + * Get the associated NagiosCommand object + * + * @param PropelPDO Optional Connection object. + * @return NagiosCommand The associated NagiosCommand object. + * @throws PropelException + */ + public function getNagiosCommandRelatedByEventHandler(PropelPDO $con = null) + { + if ($this->aNagiosCommandRelatedByEventHandler === null && ($this->event_handler !== null)) { + $c = new Criteria(NagiosCommandPeer::DATABASE_NAME); + $c->add(NagiosCommandPeer::ID, $this->event_handler); + $this->aNagiosCommandRelatedByEventHandler = NagiosCommandPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosCommandRelatedByEventHandler->addNagiosServiceTemplatesRelatedByEventHandler($this); + */ + } + return $this->aNagiosCommandRelatedByEventHandler; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosServiceTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByCheckPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setCheckPeriod(NULL); + } else { + $this->setCheckPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByCheckPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateRelatedByCheckPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByCheckPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByCheckPeriod === null && ($this->check_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->check_period); + $this->aNagiosTimeperiodRelatedByCheckPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByCheckPeriod->addNagiosServiceTemplatesRelatedByCheckPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByCheckPeriod; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosServiceTemplate The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByNotificationPeriod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setNotificationPeriod(NULL); + } else { + $this->setNotificationPeriod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByNotificationPeriod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateRelatedByNotificationPeriod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByNotificationPeriod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByNotificationPeriod === null && ($this->notification_period !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->notification_period); + $this->aNagiosTimeperiodRelatedByNotificationPeriod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByNotificationPeriod->addNagiosServiceTemplatesRelatedByNotificationPeriod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosServiceCheckCommandParameters collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceCheckCommandParameters() + */ + public function clearNagiosServiceCheckCommandParameters() + { + $this->collNagiosServiceCheckCommandParameters = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceCheckCommandParameters collection (array). + * + * By default this just sets the collNagiosServiceCheckCommandParameters collection to an empty array (like clearcollNagiosServiceCheckCommandParameters()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceCheckCommandParameters() + { + $this->collNagiosServiceCheckCommandParameters = array(); + } + + /** + * Gets an array of NagiosServiceCheckCommandParameter objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceCheckCommandParameters from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceCheckCommandParameter[] + * @throws PropelException + */ + public function getNagiosServiceCheckCommandParameters($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosServiceCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::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. + + + $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + NagiosServiceCheckCommandParameterPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceCheckCommandParameterCriteria = $criteria; + return $this->collNagiosServiceCheckCommandParameters; + } + + /** + * Returns the number of related NagiosServiceCheckCommandParameter objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceCheckCommandParameter objects. + * @throws PropelException + */ + public function countNagiosServiceCheckCommandParameters(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + $count = NagiosServiceCheckCommandParameterPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $count = NagiosServiceCheckCommandParameterPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceCheckCommandParameters); + } + } else { + $count = count($this->collNagiosServiceCheckCommandParameters); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceCheckCommandParameter object to this object + * through the NagiosServiceCheckCommandParameter foreign key attribute. + * + * @param NagiosServiceCheckCommandParameter $l NagiosServiceCheckCommandParameter + * @return void + * @throws PropelException + */ + public function addNagiosServiceCheckCommandParameter(NagiosServiceCheckCommandParameter $l) + { + if ($this->collNagiosServiceCheckCommandParameters === null) { + $this->initNagiosServiceCheckCommandParameters(); + } + if (!in_array($l, $this->collNagiosServiceCheckCommandParameters, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceCheckCommandParameters, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceCheckCommandParameters 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 NagiosServiceTemplate. + */ + public function getNagiosServiceCheckCommandParametersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceCheckCommandParameters === null) { + if ($this->isNew()) { + $this->collNagiosServiceCheckCommandParameters = array(); + } else { + + $criteria->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceCheckCommandParameterCriteria) || !$this->lastNagiosServiceCheckCommandParameterCriteria->equals($criteria)) { + $this->collNagiosServiceCheckCommandParameters = NagiosServiceCheckCommandParameterPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceCheckCommandParameterCriteria = $criteria; + + return $this->collNagiosServiceCheckCommandParameters; + } + + /** + * Clears out the collNagiosServiceGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceGroupMembers() + */ + public function clearNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceGroupMembers collection to an empty array (like clearcollNagiosServiceGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceGroupMembers() + { + $this->collNagiosServiceGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceGroupMembers from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::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. + + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + NagiosServiceGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + return $this->collNagiosServiceGroupMembers; + } + + /** + * Returns the number of related NagiosServiceGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + $count = NagiosServiceGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } else { + $count = count($this->collNagiosServiceGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceGroupMember object to this object + * through the NagiosServiceGroupMember foreign key attribute. + * + * @param NagiosServiceGroupMember $l NagiosServiceGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceGroupMember(NagiosServiceGroupMember $l) + { + if ($this->collNagiosServiceGroupMembers === null) { + $this->initNagiosServiceGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceGroupMembers, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceGroupMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceGroupMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceGroupMembersJoinNagiosServiceGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceGroup($criteria, $con, $join_behavior); + } + } 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(NagiosServiceGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceGroupMemberCriteria) || !$this->lastNagiosServiceGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceGroupMembers = NagiosServiceGroupMemberPeer::doSelectJoinNagiosServiceGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceGroupMembers; + } + + /** + * Clears out the collNagiosServiceContactMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactMembers() + */ + public function clearNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactMembers collection (array). + * + * By default this just sets the collNagiosServiceContactMembers collection to an empty array (like clearcollNagiosServiceContactMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactMembers() + { + $this->collNagiosServiceContactMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceContactMembers from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactMember[] + * @throws PropelException + */ + public function getNagiosServiceContactMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::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. + + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + NagiosServiceContactMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + return $this->collNagiosServiceContactMembers; + } + + /** + * Returns the number of related NagiosServiceContactMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + $count = NagiosServiceContactMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } else { + $count = count($this->collNagiosServiceContactMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactMember object to this object + * through the NagiosServiceContactMember foreign key attribute. + * + * @param NagiosServiceContactMember $l NagiosServiceContactMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactMember(NagiosServiceContactMember $l) + { + if ($this->collNagiosServiceContactMembers === null) { + $this->initNagiosServiceContactMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactMembers, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceContactMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceContactMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceContactMembersJoinNagiosContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactMembers = array(); + } else { + + $criteria->add(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactMemberCriteria) || !$this->lastNagiosServiceContactMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactMembers = NagiosServiceContactMemberPeer::doSelectJoinNagiosContact($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactMemberCriteria = $criteria; + + return $this->collNagiosServiceContactMembers; + } + + /** + * Clears out the collNagiosServiceContactGroupMembers collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceContactGroupMembers() + */ + public function clearNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceContactGroupMembers collection (array). + * + * By default this just sets the collNagiosServiceContactGroupMembers collection to an empty array (like clearcollNagiosServiceContactGroupMembers()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceContactGroupMembers() + { + $this->collNagiosServiceContactGroupMembers = array(); + } + + /** + * Gets an array of NagiosServiceContactGroupMember objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceContactGroupMembers from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceContactGroupMember[] + * @throws PropelException + */ + public function getNagiosServiceContactGroupMembers($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::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. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + NagiosServiceContactGroupMemberPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Returns the number of related NagiosServiceContactGroupMember objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceContactGroupMember objects. + * @throws PropelException + */ + public function countNagiosServiceContactGroupMembers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + $count = NagiosServiceContactGroupMemberPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $count = NagiosServiceContactGroupMemberPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } else { + $count = count($this->collNagiosServiceContactGroupMembers); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceContactGroupMember object to this object + * through the NagiosServiceContactGroupMember foreign key attribute. + * + * @param NagiosServiceContactGroupMember $l NagiosServiceContactGroupMember + * @return void + * @throws PropelException + */ + public function addNagiosServiceContactGroupMember(NagiosServiceContactGroupMember $l) + { + if ($this->collNagiosServiceContactGroupMembers === null) { + $this->initNagiosServiceContactGroupMembers(); + } + if (!in_array($l, $this->collNagiosServiceContactGroupMembers, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceContactGroupMembers, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceContactGroupMembers 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 NagiosServiceTemplate. + */ + public function getNagiosServiceContactGroupMembersJoinNagiosContactGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceContactGroupMembers === null) { + if ($this->isNew()) { + $this->collNagiosServiceContactGroupMembers = array(); + } else { + + $criteria->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } 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(NagiosServiceContactGroupMemberPeer::TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceContactGroupMemberCriteria) || !$this->lastNagiosServiceContactGroupMemberCriteria->equals($criteria)) { + $this->collNagiosServiceContactGroupMembers = NagiosServiceContactGroupMemberPeer::doSelectJoinNagiosContactGroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceContactGroupMemberCriteria = $criteria; + + return $this->collNagiosServiceContactGroupMembers; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosServiceTemplate. + */ + public function getNagiosDependencysJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosServiceTemplate. + */ + public function getNagiosDependencysJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosServiceTemplate. + */ + public function getNagiosDependencysJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosServiceTemplate. + */ + public function getNagiosDependencysJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosServiceTemplate. + */ + public function getNagiosDependencysJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosServiceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosServiceTemplate. + */ + public function getNagiosEscalationsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosServiceTemplate. + */ + public function getNagiosEscalationsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosServiceTemplate. + */ + public function getNagiosEscalationsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosServiceTemplate. + */ + public function getNagiosEscalationsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosServiceTemplate. + */ + public function getNagiosEscalationsJoinNagiosTimeperiod($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::SERVICE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosTimeperiod($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Clears out the collNagiosServiceTemplateInheritancesRelatedBySourceTemplate collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplateInheritancesRelatedBySourceTemplate() + */ + public function clearNagiosServiceTemplateInheritancesRelatedBySourceTemplate() + { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplateInheritancesRelatedBySourceTemplate collection (array). + * + * By default this just sets the collNagiosServiceTemplateInheritancesRelatedBySourceTemplate collection to an empty array (like clearcollNagiosServiceTemplateInheritancesRelatedBySourceTemplate()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplateInheritancesRelatedBySourceTemplate() + { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = array(); + } + + /** + * Gets an array of NagiosServiceTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceTemplateInheritancesRelatedBySourceTemplate from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosServiceTemplateInheritancesRelatedBySourceTemplate($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = NagiosServiceTemplateInheritancePeer::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. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = NagiosServiceTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria = $criteria; + return $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate; + } + + /** + * Returns the number of related NagiosServiceTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosServiceTemplateInheritancesRelatedBySourceTemplate(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + $count = NagiosServiceTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $count = NagiosServiceTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate); + } + } else { + $count = count($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplateInheritance object to this object + * through the NagiosServiceTemplateInheritance foreign key attribute. + * + * @param NagiosServiceTemplateInheritance $l NagiosServiceTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateInheritanceRelatedBySourceTemplate(NagiosServiceTemplateInheritance $l) + { + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate === null) { + $this->initNagiosServiceTemplateInheritancesRelatedBySourceTemplate(); + } + if (!in_array($l, $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate, $l); + $l->setNagiosServiceTemplateRelatedBySourceTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceTemplateInheritancesRelatedBySourceTemplate 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 NagiosServiceTemplate. + */ + public function getNagiosServiceTemplateInheritancesRelatedBySourceTemplateJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateInheritanceRelatedBySourceTemplateCriteria = $criteria; + + return $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate; + } + + /** + * Clears out the collNagiosServiceTemplateInheritancesRelatedByTargetTemplate collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplateInheritancesRelatedByTargetTemplate() + */ + public function clearNagiosServiceTemplateInheritancesRelatedByTargetTemplate() + { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplateInheritancesRelatedByTargetTemplate collection (array). + * + * By default this just sets the collNagiosServiceTemplateInheritancesRelatedByTargetTemplate collection to an empty array (like clearcollNagiosServiceTemplateInheritancesRelatedByTargetTemplate()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplateInheritancesRelatedByTargetTemplate() + { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = array(); + } + + /** + * Gets an array of NagiosServiceTemplateInheritance objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate has previously been saved, it will retrieve + * related NagiosServiceTemplateInheritancesRelatedByTargetTemplate from storage. If this NagiosServiceTemplate is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplateInheritance[] + * @throws PropelException + */ + public function getNagiosServiceTemplateInheritancesRelatedByTargetTemplate($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = NagiosServiceTemplateInheritancePeer::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. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = NagiosServiceTemplateInheritancePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria = $criteria; + return $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate; + } + + /** + * Returns the number of related NagiosServiceTemplateInheritance objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplateInheritance objects. + * @throws PropelException + */ + public function countNagiosServiceTemplateInheritancesRelatedByTargetTemplate(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + $count = NagiosServiceTemplateInheritancePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $count = NagiosServiceTemplateInheritancePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate); + } + } else { + $count = count($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplateInheritance object to this object + * through the NagiosServiceTemplateInheritance foreign key attribute. + * + * @param NagiosServiceTemplateInheritance $l NagiosServiceTemplateInheritance + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateInheritanceRelatedByTargetTemplate(NagiosServiceTemplateInheritance $l) + { + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate === null) { + $this->initNagiosServiceTemplateInheritancesRelatedByTargetTemplate(); + } + if (!in_array($l, $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate, $l); + $l->setNagiosServiceTemplateRelatedByTargetTemplate($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosServiceTemplate is new, it will return + * an empty collection; or if this NagiosServiceTemplate has previously + * been saved, it will retrieve related NagiosServiceTemplateInheritancesRelatedByTargetTemplate 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 NagiosServiceTemplate. + */ + public function getNagiosServiceTemplateInheritancesRelatedByTargetTemplateJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = array(); + } else { + + $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->id); + + if (!isset($this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria) || !$this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria->equals($criteria)) { + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = NagiosServiceTemplateInheritancePeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateInheritanceRelatedByTargetTemplateCriteria = $criteria; + + return $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosServiceCheckCommandParameters) { + foreach ((array) $this->collNagiosServiceCheckCommandParameters as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceGroupMembers) { + foreach ((array) $this->collNagiosServiceGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactMembers) { + foreach ((array) $this->collNagiosServiceContactMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceContactGroupMembers) { + foreach ((array) $this->collNagiosServiceContactGroupMembers as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate) { + foreach ((array) $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate) { + foreach ((array) $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosServiceCheckCommandParameters = null; + $this->collNagiosServiceGroupMembers = null; + $this->collNagiosServiceContactMembers = null; + $this->collNagiosServiceContactGroupMembers = null; + $this->collNagiosDependencys = null; + $this->collNagiosEscalations = null; + $this->collNagiosServiceTemplateInheritancesRelatedBySourceTemplate = null; + $this->collNagiosServiceTemplateInheritancesRelatedByTargetTemplate = null; + $this->aNagiosCommandRelatedByCheckCommand = null; + $this->aNagiosCommandRelatedByEventHandler = null; + $this->aNagiosTimeperiodRelatedByCheckPeriod = null; + $this->aNagiosTimeperiodRelatedByNotificationPeriod = null; + } + +} // BaseNagiosServiceTemplate diff --git a/classes/om/BaseNagiosServiceTemplateInheritance.php b/classes/om/BaseNagiosServiceTemplateInheritance.php new file mode 100755 index 0000000..8086c7f --- /dev/null +++ b/classes/om/BaseNagiosServiceTemplateInheritance.php @@ -0,0 +1,1059 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [source_service] column value. + * + * @return int + */ + public function getSourceService() + { + return $this->source_service; + } + + /** + * Get the [source_template] column value. + * + * @return int + */ + public function getSourceTemplate() + { + return $this->source_template; + } + + /** + * Get the [target_template] column value. + * + * @return int + */ + public function getTargetTemplate() + { + return $this->target_template; + } + + /** + * Get the [order] column value. + * + * @return int + */ + public function getOrder() + { + return $this->order; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [source_service] column. + * + * @param int $v new value + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + */ + public function setSourceService($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->source_service !== $v) { + $this->source_service = $v; + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE; + } + + if ($this->aNagiosService !== null && $this->aNagiosService->getId() !== $v) { + $this->aNagiosService = null; + } + + return $this; + } // setSourceService() + + /** + * Set the value of [source_template] column. + * + * @param int $v new value + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + */ + public function setSourceTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->source_template !== $v) { + $this->source_template = $v; + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE; + } + + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate !== null && $this->aNagiosServiceTemplateRelatedBySourceTemplate->getId() !== $v) { + $this->aNagiosServiceTemplateRelatedBySourceTemplate = null; + } + + return $this; + } // setSourceTemplate() + + /** + * Set the value of [target_template] column. + * + * @param int $v new value + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + */ + public function setTargetTemplate($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->target_template !== $v) { + $this->target_template = $v; + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE; + } + + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate !== null && $this->aNagiosServiceTemplateRelatedByTargetTemplate->getId() !== $v) { + $this->aNagiosServiceTemplateRelatedByTargetTemplate = null; + } + + return $this; + } // setTargetTemplate() + + /** + * Set the value of [order] column. + * + * @param int $v new value + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + */ + public function setOrder($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->order !== $v) { + $this->order = $v; + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::ORDER; + } + + return $this; + } // setOrder() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->source_service = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->source_template = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->target_template = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->order = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosServiceTemplateInheritance object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosService !== null && $this->source_service !== $this->aNagiosService->getId()) { + $this->aNagiosService = null; + } + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate !== null && $this->source_template !== $this->aNagiosServiceTemplateRelatedBySourceTemplate->getId()) { + $this->aNagiosServiceTemplateRelatedBySourceTemplate = null; + } + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate !== null && $this->target_template !== $this->aNagiosServiceTemplateRelatedByTargetTemplate->getId()) { + $this->aNagiosServiceTemplateRelatedByTargetTemplate = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosServiceTemplateInheritancePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosService = null; + $this->aNagiosServiceTemplateRelatedBySourceTemplate = null; + $this->aNagiosServiceTemplateRelatedByTargetTemplate = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosServiceTemplateInheritancePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosService !== null) { + if ($this->aNagiosService->isModified() || $this->aNagiosService->isNew()) { + $affectedRows += $this->aNagiosService->save($con); + } + $this->setNagiosService($this->aNagiosService); + } + + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate !== null) { + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate->isModified() || $this->aNagiosServiceTemplateRelatedBySourceTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplateRelatedBySourceTemplate->save($con); + } + $this->setNagiosServiceTemplateRelatedBySourceTemplate($this->aNagiosServiceTemplateRelatedBySourceTemplate); + } + + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate !== null) { + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate->isModified() || $this->aNagiosServiceTemplateRelatedByTargetTemplate->isNew()) { + $affectedRows += $this->aNagiosServiceTemplateRelatedByTargetTemplate->save($con); + } + $this->setNagiosServiceTemplateRelatedByTargetTemplate($this->aNagiosServiceTemplateRelatedByTargetTemplate); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosServiceTemplateInheritancePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosServiceTemplateInheritancePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosServiceTemplateInheritancePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosService !== null) { + if (!$this->aNagiosService->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosService->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate !== null) { + if (!$this->aNagiosServiceTemplateRelatedBySourceTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplateRelatedBySourceTemplate->getValidationFailures()); + } + } + + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate !== null) { + if (!$this->aNagiosServiceTemplateRelatedByTargetTemplate->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosServiceTemplateRelatedByTargetTemplate->getValidationFailures()); + } + } + + + if (($retval = NagiosServiceTemplateInheritancePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceTemplateInheritancePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getSourceService(); + break; + case 2: + return $this->getSourceTemplate(); + break; + case 3: + return $this->getTargetTemplate(); + break; + case 4: + return $this->getOrder(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosServiceTemplateInheritancePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getSourceService(), + $keys[2] => $this->getSourceTemplate(), + $keys[3] => $this->getTargetTemplate(), + $keys[4] => $this->getOrder(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosServiceTemplateInheritancePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setSourceService($value); + break; + case 2: + $this->setSourceTemplate($value); + break; + case 3: + $this->setTargetTemplate($value); + break; + case 4: + $this->setOrder($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosServiceTemplateInheritancePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSourceService($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setSourceTemplate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTargetTemplate($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setOrder($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(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosServiceTemplateInheritancePeer::ID)) $criteria->add(NagiosServiceTemplateInheritancePeer::ID, $this->id); + if ($this->isColumnModified(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE)) $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE, $this->source_service); + if ($this->isColumnModified(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE)) $criteria->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $this->source_template); + if ($this->isColumnModified(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE)) $criteria->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $this->target_template); + if ($this->isColumnModified(NagiosServiceTemplateInheritancePeer::ORDER)) $criteria->add(NagiosServiceTemplateInheritancePeer::ORDER, $this->order); + + 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(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + $criteria->add(NagiosServiceTemplateInheritancePeer::ID, $this->id); + + 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 NagiosServiceTemplateInheritance (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) + { + + $copyObj->setSourceService($this->source_service); + + $copyObj->setSourceTemplate($this->source_template); + + $copyObj->setTargetTemplate($this->target_template); + + $copyObj->setOrder($this->order); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosServiceTemplateInheritance 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); + $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 NagiosServiceTemplateInheritancePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosServiceTemplateInheritancePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosService object. + * + * @param NagiosService $v + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosService(NagiosService $v = null) + { + if ($v === null) { + $this->setSourceService(NULL); + } else { + $this->setSourceService($v->getId()); + } + + $this->aNagiosService = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosService object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateInheritance($this); + } + + return $this; + } + + + /** + * Get the associated NagiosService object + * + * @param PropelPDO Optional Connection object. + * @return NagiosService The associated NagiosService object. + * @throws PropelException + */ + public function getNagiosService(PropelPDO $con = null) + { + if ($this->aNagiosService === null && ($this->source_service !== null)) { + $c = new Criteria(NagiosServicePeer::DATABASE_NAME); + $c->add(NagiosServicePeer::ID, $this->source_service); + $this->aNagiosService = NagiosServicePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosService->addNagiosServiceTemplateInheritances($this); + */ + } + return $this->aNagiosService; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplateRelatedBySourceTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setSourceTemplate(NULL); + } else { + $this->setSourceTemplate($v->getId()); + } + + $this->aNagiosServiceTemplateRelatedBySourceTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateInheritanceRelatedBySourceTemplate($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplateRelatedBySourceTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplateRelatedBySourceTemplate === null && ($this->source_template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->source_template); + $this->aNagiosServiceTemplateRelatedBySourceTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplateRelatedBySourceTemplate->addNagiosServiceTemplateInheritancesRelatedBySourceTemplate($this); + */ + } + return $this->aNagiosServiceTemplateRelatedBySourceTemplate; + } + + /** + * Declares an association between this object and a NagiosServiceTemplate object. + * + * @param NagiosServiceTemplate $v + * @return NagiosServiceTemplateInheritance The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosServiceTemplateRelatedByTargetTemplate(NagiosServiceTemplate $v = null) + { + if ($v === null) { + $this->setTargetTemplate(NULL); + } else { + $this->setTargetTemplate($v->getId()); + } + + $this->aNagiosServiceTemplateRelatedByTargetTemplate = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. + if ($v !== null) { + $v->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($this); + } + + return $this; + } + + + /** + * Get the associated NagiosServiceTemplate object + * + * @param PropelPDO Optional Connection object. + * @return NagiosServiceTemplate The associated NagiosServiceTemplate object. + * @throws PropelException + */ + public function getNagiosServiceTemplateRelatedByTargetTemplate(PropelPDO $con = null) + { + if ($this->aNagiosServiceTemplateRelatedByTargetTemplate === null && ($this->target_template !== null)) { + $c = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $c->add(NagiosServiceTemplatePeer::ID, $this->target_template); + $this->aNagiosServiceTemplateRelatedByTargetTemplate = NagiosServiceTemplatePeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosServiceTemplateRelatedByTargetTemplate->addNagiosServiceTemplateInheritancesRelatedByTargetTemplate($this); + */ + } + return $this->aNagiosServiceTemplateRelatedByTargetTemplate; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosService = null; + $this->aNagiosServiceTemplateRelatedBySourceTemplate = null; + $this->aNagiosServiceTemplateRelatedByTargetTemplate = null; + } + +} // BaseNagiosServiceTemplateInheritance diff --git a/classes/om/BaseNagiosServiceTemplateInheritancePeer.php b/classes/om/BaseNagiosServiceTemplateInheritancePeer.php new file mode 100755 index 0000000..bb74987 --- /dev/null +++ b/classes/om/BaseNagiosServiceTemplateInheritancePeer.php @@ -0,0 +1,1617 @@ + array ('Id', 'SourceService', 'SourceTemplate', 'TargetTemplate', 'Order', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'sourceService', 'sourceTemplate', 'targetTemplate', 'order', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SOURCE_SERVICE, self::SOURCE_TEMPLATE, self::TARGET_TEMPLATE, self::ORDER, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'source_service', 'source_template', 'target_template', 'order', ), + 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, 'SourceService' => 1, 'SourceTemplate' => 2, 'TargetTemplate' => 3, 'Order' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'sourceService' => 1, 'sourceTemplate' => 2, 'targetTemplate' => 3, 'order' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SOURCE_SERVICE => 1, self::SOURCE_TEMPLATE => 2, self::TARGET_TEMPLATE => 3, self::ORDER => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'source_service' => 1, 'source_template' => 2, 'target_template' => 3, 'order' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceTemplateInheritanceMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceTemplateInheritancePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceTemplateInheritancePeer::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) + { + + $criteria->addSelectColumn(NagiosServiceTemplateInheritancePeer::ID); + + $criteria->addSelectColumn(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE); + + $criteria->addSelectColumn(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE); + + $criteria->addSelectColumn(NagiosServiceTemplateInheritancePeer::ORDER); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceTemplateInheritance + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceTemplateInheritancePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceTemplateInheritancePeer::populateObjects(NagiosServiceTemplateInheritancePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceTemplateInheritance $value A NagiosServiceTemplateInheritance object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceTemplateInheritance $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceTemplateInheritance object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceTemplateInheritance) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceTemplateInheritance object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceTemplateInheritance Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceTemplateInheritancePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplateRelatedBySourceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplateRelatedBySourceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplateRelatedByTargetTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosServiceTemplateRelatedByTargetTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with their NagiosService objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServicePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to $obj2 (NagiosService) + $obj2->addNagiosServiceTemplateInheritance($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplateRelatedBySourceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceTemplateInheritanceRelatedBySourceTemplate($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with their NagiosServiceTemplate objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosServiceTemplateRelatedByTargetTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosServiceTemplatePeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceTemplateInheritance($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceTemplateInheritanceRelatedBySourceTemplate($obj1); + } // if joined row not null + + // Add objects for joined NagiosServiceTemplate rows + + $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj4 (NagiosServiceTemplate) + $obj4->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosService table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosService(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplateRelatedBySourceTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplateRelatedBySourceTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosServiceTemplateRelatedByTargetTemplate table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosServiceTemplateRelatedByTargetTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplateInheritancePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with all related objects except NagiosService. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosService(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE,), array(NagiosServiceTemplatePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosServiceTemplate rows + + $key2 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServiceTemplatePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServiceTemplatePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj2 (NagiosServiceTemplate) + $obj2->addNagiosServiceTemplateInheritanceRelatedBySourceTemplate($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosServiceTemplate rows + + $key3 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosServiceTemplatePeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosServiceTemplatePeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj3 (NagiosServiceTemplate) + $obj3->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with all related objects except NagiosServiceTemplateRelatedBySourceTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplateRelatedBySourceTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceTemplateInheritance($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplateInheritance objects pre-filled with all related objects except NagiosServiceTemplateRelatedByTargetTemplate. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplateInheritance objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosServiceTemplateRelatedByTargetTemplate(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplateInheritancePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplateInheritancePeer::NUM_COLUMNS - NagiosServiceTemplateInheritancePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosServicePeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplateInheritancePeer::SOURCE_SERVICE,), array(NagiosServicePeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplateInheritancePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplateInheritancePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplateInheritancePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplateInheritancePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosService rows + + $key2 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosServicePeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosServicePeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosServicePeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplateInheritance) to the collection in $obj2 (NagiosService) + $obj2->addNagiosServiceTemplateInheritance($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceTemplateInheritancePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceTemplateInheritance or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceTemplateInheritance object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceTemplateInheritance object + } + + if ($criteria->containsKey(NagiosServiceTemplateInheritancePeer::ID) && $criteria->keyContainsValue(NagiosServiceTemplateInheritancePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceTemplateInheritancePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceTemplateInheritance or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceTemplateInheritance object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceTemplateInheritancePeer::ID); + $selectCriteria->add(NagiosServiceTemplateInheritancePeer::ID, $criteria->remove(NagiosServiceTemplateInheritancePeer::ID), $comparison); + + } else { // $values is NagiosServiceTemplateInheritance object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_template_inheritance 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(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceTemplateInheritancePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceTemplateInheritance or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceTemplateInheritance object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceTemplateInheritancePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceTemplateInheritance) { + // invalidate the cache for this single object + NagiosServiceTemplateInheritancePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceTemplateInheritancePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceTemplateInheritancePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosServiceTemplateInheritance 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 NagiosServiceTemplateInheritance $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(NagiosServiceTemplateInheritance $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceTemplateInheritancePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, NagiosServiceTemplateInheritancePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceTemplateInheritance + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceTemplateInheritancePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + $criteria->add(NagiosServiceTemplateInheritancePeer::ID, $pk); + + $v = NagiosServiceTemplateInheritancePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplateInheritancePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + $criteria->add(NagiosServiceTemplateInheritancePeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceTemplateInheritancePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceTemplateInheritancePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceTemplateInheritancePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceTemplateInheritancePeer class: +// +// Propel::getDatabaseMap(NagiosServiceTemplateInheritancePeer::DATABASE_NAME)->addTableBuilder(NagiosServiceTemplateInheritancePeer::TABLE_NAME, NagiosServiceTemplateInheritancePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceTemplateInheritancePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceTemplateInheritancePeer::TABLE_NAME, BaseNagiosServiceTemplateInheritancePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosServiceTemplatePeer.php b/classes/om/BaseNagiosServiceTemplatePeer.php new file mode 100755 index 0000000..1dbcb1f --- /dev/null +++ b/classes/om/BaseNagiosServiceTemplatePeer.php @@ -0,0 +1,2284 @@ + array ('Id', 'Name', 'Description', 'InitialState', 'IsVolatile', 'CheckCommand', 'MaximumCheckAttempts', 'NormalCheckInterval', 'RetryInterval', 'FirstNotificationDelay', 'ActiveChecksEnabled', 'PassiveChecksEnabled', 'CheckPeriod', 'ParallelizeCheck', 'ObsessOverService', 'CheckFreshness', 'FreshnessThreshold', 'EventHandler', 'EventHandlerEnabled', 'LowFlapThreshold', 'HighFlapThreshold', 'FlapDetectionEnabled', 'FlapDetectionOnOk', 'FlapDetectionOnWarning', 'FlapDetectionOnCritical', 'FlapDetectionOnUnknown', 'ProcessPerfData', 'RetainStatusInformation', 'RetainNonstatusInformation', 'NotificationInterval', 'NotificationPeriod', 'NotificationOnWarning', 'NotificationOnUnknown', 'NotificationOnCritical', 'NotificationOnRecovery', 'NotificationOnFlapping', 'NotificationOnScheduledDowntime', 'NotificationsEnabled', 'StalkingOnOk', 'StalkingOnWarning', 'StalkingOnUnknown', 'StalkingOnCritical', 'FailurePredictionEnabled', 'Notes', 'NotesUrl', 'ActionUrl', 'IconImage', 'IconImageAlt', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'description', 'initialState', 'isVolatile', 'checkCommand', 'maximumCheckAttempts', 'normalCheckInterval', 'retryInterval', 'firstNotificationDelay', 'activeChecksEnabled', 'passiveChecksEnabled', 'checkPeriod', 'parallelizeCheck', 'obsessOverService', 'checkFreshness', 'freshnessThreshold', 'eventHandler', 'eventHandlerEnabled', 'lowFlapThreshold', 'highFlapThreshold', 'flapDetectionEnabled', 'flapDetectionOnOk', 'flapDetectionOnWarning', 'flapDetectionOnCritical', 'flapDetectionOnUnknown', 'processPerfData', 'retainStatusInformation', 'retainNonstatusInformation', 'notificationInterval', 'notificationPeriod', 'notificationOnWarning', 'notificationOnUnknown', 'notificationOnCritical', 'notificationOnRecovery', 'notificationOnFlapping', 'notificationOnScheduledDowntime', 'notificationsEnabled', 'stalkingOnOk', 'stalkingOnWarning', 'stalkingOnUnknown', 'stalkingOnCritical', 'failurePredictionEnabled', 'notes', 'notesUrl', 'actionUrl', 'iconImage', 'iconImageAlt', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::INITIAL_STATE, self::IS_VOLATILE, self::CHECK_COMMAND, self::MAXIMUM_CHECK_ATTEMPTS, self::NORMAL_CHECK_INTERVAL, self::RETRY_INTERVAL, self::FIRST_NOTIFICATION_DELAY, self::ACTIVE_CHECKS_ENABLED, self::PASSIVE_CHECKS_ENABLED, self::CHECK_PERIOD, self::PARALLELIZE_CHECK, self::OBSESS_OVER_SERVICE, self::CHECK_FRESHNESS, self::FRESHNESS_THRESHOLD, self::EVENT_HANDLER, self::EVENT_HANDLER_ENABLED, self::LOW_FLAP_THRESHOLD, self::HIGH_FLAP_THRESHOLD, self::FLAP_DETECTION_ENABLED, self::FLAP_DETECTION_ON_OK, self::FLAP_DETECTION_ON_WARNING, self::FLAP_DETECTION_ON_CRITICAL, self::FLAP_DETECTION_ON_UNKNOWN, self::PROCESS_PERF_DATA, self::RETAIN_STATUS_INFORMATION, self::RETAIN_NONSTATUS_INFORMATION, self::NOTIFICATION_INTERVAL, self::NOTIFICATION_PERIOD, self::NOTIFICATION_ON_WARNING, self::NOTIFICATION_ON_UNKNOWN, self::NOTIFICATION_ON_CRITICAL, self::NOTIFICATION_ON_RECOVERY, self::NOTIFICATION_ON_FLAPPING, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME, self::NOTIFICATIONS_ENABLED, self::STALKING_ON_OK, self::STALKING_ON_WARNING, self::STALKING_ON_UNKNOWN, self::STALKING_ON_CRITICAL, self::FAILURE_PREDICTION_ENABLED, self::NOTES, self::NOTES_URL, self::ACTION_URL, self::ICON_IMAGE, self::ICON_IMAGE_ALT, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'initial_state', 'is_volatile', 'check_command', 'maximum_check_attempts', 'normal_check_interval', 'retry_interval', 'first_notification_delay', 'active_checks_enabled', 'passive_checks_enabled', 'check_period', 'parallelize_check', 'obsess_over_service', 'check_freshness', 'freshness_threshold', 'event_handler', 'event_handler_enabled', 'low_flap_threshold', 'high_flap_threshold', 'flap_detection_enabled', 'flap_detection_on_ok', 'flap_detection_on_warning', 'flap_detection_on_critical', 'flap_detection_on_unknown', 'process_perf_data', 'retain_status_information', 'retain_nonstatus_information', 'notification_interval', 'notification_period', 'notification_on_warning', 'notification_on_unknown', 'notification_on_critical', 'notification_on_recovery', 'notification_on_flapping', 'notification_on_scheduled_downtime', 'notifications_enabled', 'stalking_on_ok', 'stalking_on_warning', 'stalking_on_unknown', 'stalking_on_critical', 'failure_prediction_enabled', 'notes', 'notes_url', 'action_url', 'icon_image', 'icon_image_alt', ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, ) + ); + + /** + * 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, 'Name' => 1, 'Description' => 2, 'InitialState' => 3, 'IsVolatile' => 4, 'CheckCommand' => 5, 'MaximumCheckAttempts' => 6, 'NormalCheckInterval' => 7, 'RetryInterval' => 8, 'FirstNotificationDelay' => 9, 'ActiveChecksEnabled' => 10, 'PassiveChecksEnabled' => 11, 'CheckPeriod' => 12, 'ParallelizeCheck' => 13, 'ObsessOverService' => 14, 'CheckFreshness' => 15, 'FreshnessThreshold' => 16, 'EventHandler' => 17, 'EventHandlerEnabled' => 18, 'LowFlapThreshold' => 19, 'HighFlapThreshold' => 20, 'FlapDetectionEnabled' => 21, 'FlapDetectionOnOk' => 22, 'FlapDetectionOnWarning' => 23, 'FlapDetectionOnCritical' => 24, 'FlapDetectionOnUnknown' => 25, 'ProcessPerfData' => 26, 'RetainStatusInformation' => 27, 'RetainNonstatusInformation' => 28, 'NotificationInterval' => 29, 'NotificationPeriod' => 30, 'NotificationOnWarning' => 31, 'NotificationOnUnknown' => 32, 'NotificationOnCritical' => 33, 'NotificationOnRecovery' => 34, 'NotificationOnFlapping' => 35, 'NotificationOnScheduledDowntime' => 36, 'NotificationsEnabled' => 37, 'StalkingOnOk' => 38, 'StalkingOnWarning' => 39, 'StalkingOnUnknown' => 40, 'StalkingOnCritical' => 41, 'FailurePredictionEnabled' => 42, 'Notes' => 43, 'NotesUrl' => 44, 'ActionUrl' => 45, 'IconImage' => 46, 'IconImageAlt' => 47, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'initialState' => 3, 'isVolatile' => 4, 'checkCommand' => 5, 'maximumCheckAttempts' => 6, 'normalCheckInterval' => 7, 'retryInterval' => 8, 'firstNotificationDelay' => 9, 'activeChecksEnabled' => 10, 'passiveChecksEnabled' => 11, 'checkPeriod' => 12, 'parallelizeCheck' => 13, 'obsessOverService' => 14, 'checkFreshness' => 15, 'freshnessThreshold' => 16, 'eventHandler' => 17, 'eventHandlerEnabled' => 18, 'lowFlapThreshold' => 19, 'highFlapThreshold' => 20, 'flapDetectionEnabled' => 21, 'flapDetectionOnOk' => 22, 'flapDetectionOnWarning' => 23, 'flapDetectionOnCritical' => 24, 'flapDetectionOnUnknown' => 25, 'processPerfData' => 26, 'retainStatusInformation' => 27, 'retainNonstatusInformation' => 28, 'notificationInterval' => 29, 'notificationPeriod' => 30, 'notificationOnWarning' => 31, 'notificationOnUnknown' => 32, 'notificationOnCritical' => 33, 'notificationOnRecovery' => 34, 'notificationOnFlapping' => 35, 'notificationOnScheduledDowntime' => 36, 'notificationsEnabled' => 37, 'stalkingOnOk' => 38, 'stalkingOnWarning' => 39, 'stalkingOnUnknown' => 40, 'stalkingOnCritical' => 41, 'failurePredictionEnabled' => 42, 'notes' => 43, 'notesUrl' => 44, 'actionUrl' => 45, 'iconImage' => 46, 'iconImageAlt' => 47, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::INITIAL_STATE => 3, self::IS_VOLATILE => 4, self::CHECK_COMMAND => 5, self::MAXIMUM_CHECK_ATTEMPTS => 6, self::NORMAL_CHECK_INTERVAL => 7, self::RETRY_INTERVAL => 8, self::FIRST_NOTIFICATION_DELAY => 9, self::ACTIVE_CHECKS_ENABLED => 10, self::PASSIVE_CHECKS_ENABLED => 11, self::CHECK_PERIOD => 12, self::PARALLELIZE_CHECK => 13, self::OBSESS_OVER_SERVICE => 14, self::CHECK_FRESHNESS => 15, self::FRESHNESS_THRESHOLD => 16, self::EVENT_HANDLER => 17, self::EVENT_HANDLER_ENABLED => 18, self::LOW_FLAP_THRESHOLD => 19, self::HIGH_FLAP_THRESHOLD => 20, self::FLAP_DETECTION_ENABLED => 21, self::FLAP_DETECTION_ON_OK => 22, self::FLAP_DETECTION_ON_WARNING => 23, self::FLAP_DETECTION_ON_CRITICAL => 24, self::FLAP_DETECTION_ON_UNKNOWN => 25, self::PROCESS_PERF_DATA => 26, self::RETAIN_STATUS_INFORMATION => 27, self::RETAIN_NONSTATUS_INFORMATION => 28, self::NOTIFICATION_INTERVAL => 29, self::NOTIFICATION_PERIOD => 30, self::NOTIFICATION_ON_WARNING => 31, self::NOTIFICATION_ON_UNKNOWN => 32, self::NOTIFICATION_ON_CRITICAL => 33, self::NOTIFICATION_ON_RECOVERY => 34, self::NOTIFICATION_ON_FLAPPING => 35, self::NOTIFICATION_ON_SCHEDULED_DOWNTIME => 36, self::NOTIFICATIONS_ENABLED => 37, self::STALKING_ON_OK => 38, self::STALKING_ON_WARNING => 39, self::STALKING_ON_UNKNOWN => 40, self::STALKING_ON_CRITICAL => 41, self::FAILURE_PREDICTION_ENABLED => 42, self::NOTES => 43, self::NOTES_URL => 44, self::ACTION_URL => 45, self::ICON_IMAGE => 46, self::ICON_IMAGE_ALT => 47, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'initial_state' => 3, 'is_volatile' => 4, 'check_command' => 5, 'maximum_check_attempts' => 6, 'normal_check_interval' => 7, 'retry_interval' => 8, 'first_notification_delay' => 9, 'active_checks_enabled' => 10, 'passive_checks_enabled' => 11, 'check_period' => 12, 'parallelize_check' => 13, 'obsess_over_service' => 14, 'check_freshness' => 15, 'freshness_threshold' => 16, 'event_handler' => 17, 'event_handler_enabled' => 18, 'low_flap_threshold' => 19, 'high_flap_threshold' => 20, 'flap_detection_enabled' => 21, 'flap_detection_on_ok' => 22, 'flap_detection_on_warning' => 23, 'flap_detection_on_critical' => 24, 'flap_detection_on_unknown' => 25, 'process_perf_data' => 26, 'retain_status_information' => 27, 'retain_nonstatus_information' => 28, 'notification_interval' => 29, 'notification_period' => 30, 'notification_on_warning' => 31, 'notification_on_unknown' => 32, 'notification_on_critical' => 33, 'notification_on_recovery' => 34, 'notification_on_flapping' => 35, 'notification_on_scheduled_downtime' => 36, 'notifications_enabled' => 37, 'stalking_on_ok' => 38, 'stalking_on_warning' => 39, 'stalking_on_unknown' => 40, 'stalking_on_critical' => 41, 'failure_prediction_enabled' => 42, 'notes' => 43, 'notes_url' => 44, 'action_url' => 45, 'icon_image' => 46, 'icon_image_alt' => 47, ), + 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, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosServiceTemplateMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosServiceTemplatePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosServiceTemplatePeer::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) + { + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::ID); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NAME); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::DESCRIPTION); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::INITIAL_STATE); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::IS_VOLATILE); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::CHECK_COMMAND); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::MAXIMUM_CHECK_ATTEMPTS); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NORMAL_CHECK_INTERVAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::RETRY_INTERVAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FIRST_NOTIFICATION_DELAY); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::ACTIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::PASSIVE_CHECKS_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::CHECK_PERIOD); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::PARALLELIZE_CHECK); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::OBSESS_OVER_SERVICE); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::CHECK_FRESHNESS); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FRESHNESS_THRESHOLD); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::EVENT_HANDLER); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::EVENT_HANDLER_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::LOW_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::HIGH_FLAP_THRESHOLD); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FLAP_DETECTION_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_OK); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_WARNING); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FLAP_DETECTION_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::PROCESS_PERF_DATA); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::RETAIN_STATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::RETAIN_NONSTATUS_INFORMATION); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_INTERVAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_WARNING); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_RECOVERY); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_FLAPPING); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATION_ON_SCHEDULED_DOWNTIME); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTIFICATIONS_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::STALKING_ON_OK); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::STALKING_ON_WARNING); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::STALKING_ON_UNKNOWN); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::STALKING_ON_CRITICAL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::FAILURE_PREDICTION_ENABLED); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTES); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::NOTES_URL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::ACTION_URL); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::ICON_IMAGE); + + $criteria->addSelectColumn(NagiosServiceTemplatePeer::ICON_IMAGE_ALT); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosServiceTemplate + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosServiceTemplatePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosServiceTemplatePeer::populateObjects(NagiosServiceTemplatePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosServiceTemplate $value A NagiosServiceTemplate object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosServiceTemplate $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosServiceTemplate object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosServiceTemplate) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosServiceTemplate object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosServiceTemplate Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosServiceTemplatePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosServiceTemplatePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosServiceTemplatePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to $obj2 (NagiosCommand) + $obj2->addNagiosServiceTemplateRelatedByCheckCommand($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with their NagiosCommand objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosCommandPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to $obj2 (NagiosCommand) + $obj2->addNagiosServiceTemplateRelatedByEventHandler($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceTemplateRelatedByCheckPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol5 = $startcol4 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol6 = $startcol5 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosServiceTemplateRelatedByCheckCommand($obj1); + } // if joined row not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosServiceTemplateRelatedByEventHandler($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key4 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = NagiosTimeperiodPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + NagiosTimeperiodPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj4 (NagiosTimeperiod) + $obj4->addNagiosServiceTemplateRelatedByCheckPeriod($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key5 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol5); + if ($key5 !== null) { + $obj5 = NagiosTimeperiodPeer::getInstanceFromPool($key5); + if (!$obj5) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj5 = new $cls(); + $obj5->hydrate($row, $startcol5); + NagiosTimeperiodPeer::addInstanceToPool($obj5, $key5); + } // if obj5 loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj5 (NagiosTimeperiod) + $obj5->addNagiosServiceTemplateRelatedByNotificationPeriod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByCheckCommand table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosCommandRelatedByEventHandler table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByCheckPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByNotificationPeriod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosServiceTemplatePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosServiceTemplatePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with all related objects except NagiosCommandRelatedByCheckCommand. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByCheckCommand(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceTemplateRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosServiceTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with all related objects except NagiosCommandRelatedByEventHandler. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosCommandRelatedByEventHandler(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosServiceTemplateRelatedByCheckPeriod($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosServiceTemplateRelatedByNotificationPeriod($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with all related objects except NagiosTimeperiodRelatedByCheckPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByCheckPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosServiceTemplateRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosServiceTemplateRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosServiceTemplate objects pre-filled with all related objects except NagiosTimeperiodRelatedByNotificationPeriod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosServiceTemplate objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByNotificationPeriod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosServiceTemplatePeer::addSelectColumns($c); + $startcol2 = (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosCommandPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosCommandPeer::NUM_COLUMNS - NagiosCommandPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosServiceTemplatePeer::CHECK_COMMAND,), array(NagiosCommandPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosServiceTemplatePeer::EVENT_HANDLER,), array(NagiosCommandPeer::ID,), $join_behavior); + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosServiceTemplatePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosServiceTemplatePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosServiceTemplatePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosCommand rows + + $key2 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosCommandPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosCommandPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj2 (NagiosCommand) + $obj2->addNagiosServiceTemplateRelatedByCheckCommand($obj1); + + } // if joined row is not null + + // Add objects for joined NagiosCommand rows + + $key3 = NagiosCommandPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosCommandPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosCommandPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosCommandPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (NagiosServiceTemplate) to the collection in $obj3 (NagiosCommand) + $obj3->addNagiosServiceTemplateRelatedByEventHandler($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosServiceTemplatePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosServiceTemplate or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceTemplate object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosServiceTemplate object + } + + if ($criteria->containsKey(NagiosServiceTemplatePeer::ID) && $criteria->keyContainsValue(NagiosServiceTemplatePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosServiceTemplatePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosServiceTemplate or Criteria object. + * + * @param mixed $values Criteria or NagiosServiceTemplate object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosServiceTemplatePeer::ID); + $selectCriteria->add(NagiosServiceTemplatePeer::ID, $criteria->remove(NagiosServiceTemplatePeer::ID), $comparison); + + } else { // $values is NagiosServiceTemplate object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_service_template 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(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosServiceTemplatePeer::doOnDeleteCascade(new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosServiceTemplatePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosServiceTemplate or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosServiceTemplate object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosServiceTemplatePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosServiceTemplate) { + // invalidate the cache for this single object + NagiosServiceTemplatePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosServiceTemplatePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosServiceTemplatePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosServiceTemplatePeer::doOnDeleteCascade($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosServiceTemplatePeer::clearInstancePool(); + } else { // it's a PK or object + NagiosServiceTemplatePeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosServiceCheckCommandParameterPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceCheckCommandParameterPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceContactGroupMemberPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceContactGroupMemberPeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplateInheritancePeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplateInheritancePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplateInheritancePeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosServiceTemplatePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosServiceCheckCommandParameter objects + $c = new Criteria(NagiosServiceCheckCommandParameterPeer::DATABASE_NAME); + + $c->add(NagiosServiceCheckCommandParameterPeer::TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceCheckCommandParameterPeer::doDelete($c, $con); + + // delete related NagiosServiceGroupMember objects + $c = new Criteria(NagiosServiceGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceGroupMemberPeer::TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactMember objects + $c = new Criteria(NagiosServiceContactMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactMemberPeer::TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceContactMemberPeer::doDelete($c, $con); + + // delete related NagiosServiceContactGroupMember objects + $c = new Criteria(NagiosServiceContactGroupMemberPeer::DATABASE_NAME); + + $c->add(NagiosServiceContactGroupMemberPeer::TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceContactGroupMemberPeer::doDelete($c, $con); + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::SERVICE_TEMPLATE, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + + // delete related NagiosEscalation objects + $c = new Criteria(NagiosEscalationPeer::DATABASE_NAME); + + $c->add(NagiosEscalationPeer::SERVICE_TEMPLATE, $obj->getId()); + $affectedRows += NagiosEscalationPeer::doDelete($c, $con); + + // delete related NagiosServiceTemplateInheritance objects + $c = new Criteria(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosServiceTemplateInheritancePeer::SOURCE_TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceTemplateInheritancePeer::doDelete($c, $con); + + // delete related NagiosServiceTemplateInheritance objects + $c = new Criteria(NagiosServiceTemplateInheritancePeer::DATABASE_NAME); + + $c->add(NagiosServiceTemplateInheritancePeer::TARGET_TEMPLATE, $obj->getId()); + $affectedRows += NagiosServiceTemplateInheritancePeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * Validates all modified columns of given NagiosServiceTemplate 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 NagiosServiceTemplate $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(NagiosServiceTemplate $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosServiceTemplatePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosServiceTemplatePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosServiceTemplatePeer::DATABASE_NAME, NagiosServiceTemplatePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosServiceTemplate + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosServiceTemplatePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $criteria->add(NagiosServiceTemplatePeer::ID, $pk); + + $v = NagiosServiceTemplatePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosServiceTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosServiceTemplatePeer::DATABASE_NAME); + $criteria->add(NagiosServiceTemplatePeer::ID, $pks, Criteria::IN); + $objs = NagiosServiceTemplatePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosServiceTemplatePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosServiceTemplatePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosServiceTemplatePeer class: +// +// Propel::getDatabaseMap(NagiosServiceTemplatePeer::DATABASE_NAME)->addTableBuilder(NagiosServiceTemplatePeer::TABLE_NAME, NagiosServiceTemplatePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosServiceTemplatePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosServiceTemplatePeer::TABLE_NAME, BaseNagiosServiceTemplatePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosTimeperiod.php b/classes/om/BaseNagiosTimeperiod.php new file mode 100755 index 0000000..8d581d7 --- /dev/null +++ b/classes/om/BaseNagiosTimeperiod.php @@ -0,0 +1,5155 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get the [alias] column value. + * + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosTimeperiod The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosTimeperiodPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return NagiosTimeperiod The current object (for fluent API support) + */ + public function setName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = NagiosTimeperiodPeer::NAME; + } + + return $this; + } // setName() + + /** + * Set the value of [alias] column. + * + * @param string $v new value + * @return NagiosTimeperiod The current object (for fluent API support) + */ + public function setAlias($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->alias !== $v) { + $this->alias = $v; + $this->modifiedColumns[] = NagiosTimeperiodPeer::ALIAS; + } + + return $this; + } // setAlias() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosTimeperiod object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosTimeperiodPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collNagiosTimeperiodEntrys = null; + $this->lastNagiosTimeperiodEntryCriteria = null; + + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = null; + $this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria = null; + + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = null; + $this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria = null; + + $this->collNagiosContactsRelatedByHostNotificationPeriod = null; + $this->lastNagiosContactRelatedByHostNotificationPeriodCriteria = null; + + $this->collNagiosContactsRelatedByServiceNotificationPeriod = null; + $this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria = null; + + $this->collNagiosHostTemplatesRelatedByCheckPeriod = null; + $this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria = null; + + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = null; + $this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria = null; + + $this->collNagiosHostsRelatedByCheckPeriod = null; + $this->lastNagiosHostRelatedByCheckPeriodCriteria = null; + + $this->collNagiosHostsRelatedByNotificationPeriod = null; + $this->lastNagiosHostRelatedByNotificationPeriodCriteria = null; + + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = null; + $this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria = null; + + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = null; + $this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria = null; + + $this->collNagiosServicesRelatedByCheckPeriod = null; + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = null; + + $this->collNagiosServicesRelatedByNotificationPeriod = null; + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = null; + + $this->collNagiosDependencys = null; + $this->lastNagiosDependencyCriteria = null; + + $this->collNagiosEscalations = null; + $this->lastNagiosEscalationCriteria = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosTimeperiodPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosTimeperiodPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosTimeperiodPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosTimeperiodPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosTimeperiodPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collNagiosTimeperiodEntrys !== null) { + foreach ($this->collNagiosTimeperiodEntrys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId !== null) { + foreach ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod !== null) { + foreach ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosContactsRelatedByHostNotificationPeriod !== null) { + foreach ($this->collNagiosContactsRelatedByHostNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod !== null) { + foreach ($this->collNagiosContactsRelatedByServiceNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostsRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosHostsRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosHostsRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosHostsRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServicesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosServicesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosServicesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = NagiosTimeperiodPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collNagiosTimeperiodEntrys !== null) { + foreach ($this->collNagiosTimeperiodEntrys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId !== null) { + foreach ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod !== null) { + foreach ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosContactsRelatedByHostNotificationPeriod !== null) { + foreach ($this->collNagiosContactsRelatedByHostNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod !== null) { + foreach ($this->collNagiosContactsRelatedByServiceNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosHostTemplatesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostsRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosHostsRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosHostsRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosHostsRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServicesRelatedByCheckPeriod !== null) { + foreach ($this->collNagiosServicesRelatedByCheckPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod !== null) { + foreach ($this->collNagiosServicesRelatedByNotificationPeriod as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosDependencys !== null) { + foreach ($this->collNagiosDependencys as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collNagiosEscalations !== null) { + foreach ($this->collNagiosEscalations as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getName(); + break; + case 2: + return $this->getAlias(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosTimeperiodPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getName(), + $keys[2] => $this->getAlias(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setName($value); + break; + case 2: + $this->setAlias($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosTimeperiodPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAlias($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(NagiosTimeperiodPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosTimeperiodPeer::ID)) $criteria->add(NagiosTimeperiodPeer::ID, $this->id); + if ($this->isColumnModified(NagiosTimeperiodPeer::NAME)) $criteria->add(NagiosTimeperiodPeer::NAME, $this->name); + if ($this->isColumnModified(NagiosTimeperiodPeer::ALIAS)) $criteria->add(NagiosTimeperiodPeer::ALIAS, $this->alias); + + 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(NagiosTimeperiodPeer::DATABASE_NAME); + + $criteria->add(NagiosTimeperiodPeer::ID, $this->id); + + 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 NagiosTimeperiod (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) + { + + $copyObj->setName($this->name); + + $copyObj->setAlias($this->alias); + + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getNagiosTimeperiodEntrys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosTimeperiodEntry($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosTimeperiodExcludesRelatedByTimeperiodId() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosTimeperiodExcludeRelatedByTimeperiodId($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosTimeperiodExcludesRelatedByExcludedTimeperiod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosTimeperiodExcludeRelatedByExcludedTimeperiod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosContactsRelatedByHostNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactRelatedByHostNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosContactsRelatedByServiceNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosContactRelatedByServiceNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplatesRelatedByCheckPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateRelatedByCheckPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostTemplatesRelatedByNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostTemplateRelatedByNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostsRelatedByCheckPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostRelatedByCheckPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosHostsRelatedByNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosHostRelatedByNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplatesRelatedByCheckPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateRelatedByCheckPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServiceTemplatesRelatedByNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceTemplateRelatedByNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServicesRelatedByCheckPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceRelatedByCheckPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosServicesRelatedByNotificationPeriod() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosServiceRelatedByNotificationPeriod($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosDependencys() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosDependency($relObj->copy($deepCopy)); + } + } + + foreach ($this->getNagiosEscalations() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addNagiosEscalation($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosTimeperiod 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); + $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 NagiosTimeperiodPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosTimeperiodPeer(); + } + return self::$peer; + } + + /** + * Clears out the collNagiosTimeperiodEntrys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosTimeperiodEntrys() + */ + public function clearNagiosTimeperiodEntrys() + { + $this->collNagiosTimeperiodEntrys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosTimeperiodEntrys collection (array). + * + * By default this just sets the collNagiosTimeperiodEntrys collection to an empty array (like clearcollNagiosTimeperiodEntrys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosTimeperiodEntrys() + { + $this->collNagiosTimeperiodEntrys = array(); + } + + /** + * Gets an array of NagiosTimeperiodEntry objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosTimeperiodEntrys from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosTimeperiodEntry[] + * @throws PropelException + */ + public function getNagiosTimeperiodEntrys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosTimeperiodEntrys === null) { + if ($this->isNew()) { + $this->collNagiosTimeperiodEntrys = array(); + } else { + + $criteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $this->id); + + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + $this->collNagiosTimeperiodEntrys = NagiosTimeperiodEntryPeer::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. + + + $criteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $this->id); + + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosTimeperiodEntryCriteria) || !$this->lastNagiosTimeperiodEntryCriteria->equals($criteria)) { + $this->collNagiosTimeperiodEntrys = NagiosTimeperiodEntryPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosTimeperiodEntryCriteria = $criteria; + return $this->collNagiosTimeperiodEntrys; + } + + /** + * Returns the number of related NagiosTimeperiodEntry objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosTimeperiodEntry objects. + * @throws PropelException + */ + public function countNagiosTimeperiodEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosTimeperiodEntrys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $this->id); + + $count = NagiosTimeperiodEntryPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $this->id); + + if (!isset($this->lastNagiosTimeperiodEntryCriteria) || !$this->lastNagiosTimeperiodEntryCriteria->equals($criteria)) { + $count = NagiosTimeperiodEntryPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosTimeperiodEntrys); + } + } else { + $count = count($this->collNagiosTimeperiodEntrys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosTimeperiodEntry object to this object + * through the NagiosTimeperiodEntry foreign key attribute. + * + * @param NagiosTimeperiodEntry $l NagiosTimeperiodEntry + * @return void + * @throws PropelException + */ + public function addNagiosTimeperiodEntry(NagiosTimeperiodEntry $l) + { + if ($this->collNagiosTimeperiodEntrys === null) { + $this->initNagiosTimeperiodEntrys(); + } + if (!in_array($l, $this->collNagiosTimeperiodEntrys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosTimeperiodEntrys, $l); + $l->setNagiosTimeperiod($this); + } + } + + /** + * Clears out the collNagiosTimeperiodExcludesRelatedByTimeperiodId collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosTimeperiodExcludesRelatedByTimeperiodId() + */ + public function clearNagiosTimeperiodExcludesRelatedByTimeperiodId() + { + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosTimeperiodExcludesRelatedByTimeperiodId collection (array). + * + * By default this just sets the collNagiosTimeperiodExcludesRelatedByTimeperiodId collection to an empty array (like clearcollNagiosTimeperiodExcludesRelatedByTimeperiodId()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosTimeperiodExcludesRelatedByTimeperiodId() + { + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = array(); + } + + /** + * Gets an array of NagiosTimeperiodExclude objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosTimeperiodExcludesRelatedByTimeperiodId from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosTimeperiodExclude[] + * @throws PropelException + */ + public function getNagiosTimeperiodExcludesRelatedByTimeperiodId($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId === null) { + if ($this->isNew()) { + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = array(); + } else { + + $criteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $this->id); + + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = NagiosTimeperiodExcludePeer::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. + + + $criteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $this->id); + + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria) || !$this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria->equals($criteria)) { + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = NagiosTimeperiodExcludePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria = $criteria; + return $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId; + } + + /** + * Returns the number of related NagiosTimeperiodExclude objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosTimeperiodExclude objects. + * @throws PropelException + */ + public function countNagiosTimeperiodExcludesRelatedByTimeperiodId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $this->id); + + $count = NagiosTimeperiodExcludePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $this->id); + + if (!isset($this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria) || !$this->lastNagiosTimeperiodExcludeRelatedByTimeperiodIdCriteria->equals($criteria)) { + $count = NagiosTimeperiodExcludePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId); + } + } else { + $count = count($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId); + } + } + return $count; + } + + /** + * Method called to associate a NagiosTimeperiodExclude object to this object + * through the NagiosTimeperiodExclude foreign key attribute. + * + * @param NagiosTimeperiodExclude $l NagiosTimeperiodExclude + * @return void + * @throws PropelException + */ + public function addNagiosTimeperiodExcludeRelatedByTimeperiodId(NagiosTimeperiodExclude $l) + { + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId === null) { + $this->initNagiosTimeperiodExcludesRelatedByTimeperiodId(); + } + if (!in_array($l, $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId, $l); + $l->setNagiosTimeperiodRelatedByTimeperiodId($this); + } + } + + /** + * Clears out the collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosTimeperiodExcludesRelatedByExcludedTimeperiod() + */ + public function clearNagiosTimeperiodExcludesRelatedByExcludedTimeperiod() + { + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod collection (array). + * + * By default this just sets the collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod collection to an empty array (like clearcollNagiosTimeperiodExcludesRelatedByExcludedTimeperiod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosTimeperiodExcludesRelatedByExcludedTimeperiod() + { + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = array(); + } + + /** + * Gets an array of NagiosTimeperiodExclude objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosTimeperiodExcludesRelatedByExcludedTimeperiod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosTimeperiodExclude[] + * @throws PropelException + */ + public function getNagiosTimeperiodExcludesRelatedByExcludedTimeperiod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod === null) { + if ($this->isNew()) { + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = array(); + } else { + + $criteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $this->id); + + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = NagiosTimeperiodExcludePeer::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. + + + $criteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $this->id); + + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria) || !$this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria->equals($criteria)) { + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = NagiosTimeperiodExcludePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria = $criteria; + return $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod; + } + + /** + * Returns the number of related NagiosTimeperiodExclude objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosTimeperiodExclude objects. + * @throws PropelException + */ + public function countNagiosTimeperiodExcludesRelatedByExcludedTimeperiod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $this->id); + + $count = NagiosTimeperiodExcludePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $this->id); + + if (!isset($this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria) || !$this->lastNagiosTimeperiodExcludeRelatedByExcludedTimeperiodCriteria->equals($criteria)) { + $count = NagiosTimeperiodExcludePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod); + } + } else { + $count = count($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosTimeperiodExclude object to this object + * through the NagiosTimeperiodExclude foreign key attribute. + * + * @param NagiosTimeperiodExclude $l NagiosTimeperiodExclude + * @return void + * @throws PropelException + */ + public function addNagiosTimeperiodExcludeRelatedByExcludedTimeperiod(NagiosTimeperiodExclude $l) + { + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod === null) { + $this->initNagiosTimeperiodExcludesRelatedByExcludedTimeperiod(); + } + if (!in_array($l, $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod, $l); + $l->setNagiosTimeperiodRelatedByExcludedTimeperiod($this); + } + } + + /** + * Clears out the collNagiosContactsRelatedByHostNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactsRelatedByHostNotificationPeriod() + */ + public function clearNagiosContactsRelatedByHostNotificationPeriod() + { + $this->collNagiosContactsRelatedByHostNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactsRelatedByHostNotificationPeriod collection (array). + * + * By default this just sets the collNagiosContactsRelatedByHostNotificationPeriod collection to an empty array (like clearcollNagiosContactsRelatedByHostNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactsRelatedByHostNotificationPeriod() + { + $this->collNagiosContactsRelatedByHostNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosContact objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosContactsRelatedByHostNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContact[] + * @throws PropelException + */ + public function getNagiosContactsRelatedByHostNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactsRelatedByHostNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosContactsRelatedByHostNotificationPeriod = array(); + } else { + + $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $this->id); + + NagiosContactPeer::addSelectColumns($criteria); + $this->collNagiosContactsRelatedByHostNotificationPeriod = NagiosContactPeer::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. + + + $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $this->id); + + NagiosContactPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactRelatedByHostNotificationPeriodCriteria) || !$this->lastNagiosContactRelatedByHostNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosContactsRelatedByHostNotificationPeriod = NagiosContactPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactRelatedByHostNotificationPeriodCriteria = $criteria; + return $this->collNagiosContactsRelatedByHostNotificationPeriod; + } + + /** + * Returns the number of related NagiosContact objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContact objects. + * @throws PropelException + */ + public function countNagiosContactsRelatedByHostNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactsRelatedByHostNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $this->id); + + $count = NagiosContactPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosContactRelatedByHostNotificationPeriodCriteria) || !$this->lastNagiosContactRelatedByHostNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosContactPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactsRelatedByHostNotificationPeriod); + } + } else { + $count = count($this->collNagiosContactsRelatedByHostNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContact object to this object + * through the NagiosContact foreign key attribute. + * + * @param NagiosContact $l NagiosContact + * @return void + * @throws PropelException + */ + public function addNagiosContactRelatedByHostNotificationPeriod(NagiosContact $l) + { + if ($this->collNagiosContactsRelatedByHostNotificationPeriod === null) { + $this->initNagiosContactsRelatedByHostNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosContactsRelatedByHostNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactsRelatedByHostNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByHostNotificationPeriod($this); + } + } + + /** + * Clears out the collNagiosContactsRelatedByServiceNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosContactsRelatedByServiceNotificationPeriod() + */ + public function clearNagiosContactsRelatedByServiceNotificationPeriod() + { + $this->collNagiosContactsRelatedByServiceNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosContactsRelatedByServiceNotificationPeriod collection (array). + * + * By default this just sets the collNagiosContactsRelatedByServiceNotificationPeriod collection to an empty array (like clearcollNagiosContactsRelatedByServiceNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosContactsRelatedByServiceNotificationPeriod() + { + $this->collNagiosContactsRelatedByServiceNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosContact objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosContactsRelatedByServiceNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosContact[] + * @throws PropelException + */ + public function getNagiosContactsRelatedByServiceNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosContactsRelatedByServiceNotificationPeriod = array(); + } else { + + $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $this->id); + + NagiosContactPeer::addSelectColumns($criteria); + $this->collNagiosContactsRelatedByServiceNotificationPeriod = NagiosContactPeer::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. + + + $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $this->id); + + NagiosContactPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria) || !$this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosContactsRelatedByServiceNotificationPeriod = NagiosContactPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria = $criteria; + return $this->collNagiosContactsRelatedByServiceNotificationPeriod; + } + + /** + * Returns the number of related NagiosContact objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosContact objects. + * @throws PropelException + */ + public function countNagiosContactsRelatedByServiceNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $this->id); + + $count = NagiosContactPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria) || !$this->lastNagiosContactRelatedByServiceNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosContactPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosContactsRelatedByServiceNotificationPeriod); + } + } else { + $count = count($this->collNagiosContactsRelatedByServiceNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosContact object to this object + * through the NagiosContact foreign key attribute. + * + * @param NagiosContact $l NagiosContact + * @return void + * @throws PropelException + */ + public function addNagiosContactRelatedByServiceNotificationPeriod(NagiosContact $l) + { + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod === null) { + $this->initNagiosContactsRelatedByServiceNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosContactsRelatedByServiceNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosContactsRelatedByServiceNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByServiceNotificationPeriod($this); + } + } + + /** + * Clears out the collNagiosHostTemplatesRelatedByCheckPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplatesRelatedByCheckPeriod() + */ + public function clearNagiosHostTemplatesRelatedByCheckPeriod() + { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplatesRelatedByCheckPeriod collection (array). + * + * By default this just sets the collNagiosHostTemplatesRelatedByCheckPeriod collection to an empty array (like clearcollNagiosHostTemplatesRelatedByCheckPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplatesRelatedByCheckPeriod() + { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = array(); + } + + /** + * Gets an array of NagiosHostTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosHostTemplatesRelatedByCheckPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplate[] + * @throws PropelException + */ + public function getNagiosHostTemplatesRelatedByCheckPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::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. + + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria = $criteria; + return $this->collNagiosHostTemplatesRelatedByCheckPeriod; + } + + /** + * Returns the number of related NagiosHostTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplate objects. + * @throws PropelException + */ + public function countNagiosHostTemplatesRelatedByCheckPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + $count = NagiosHostTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $count = NagiosHostTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplatesRelatedByCheckPeriod); + } + } else { + $count = count($this->collNagiosHostTemplatesRelatedByCheckPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplate object to this object + * through the NagiosHostTemplate foreign key attribute. + * + * @param NagiosHostTemplate $l NagiosHostTemplate + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateRelatedByCheckPeriod(NagiosHostTemplate $l) + { + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod === null) { + $this->initNagiosHostTemplatesRelatedByCheckPeriod(); + } + if (!in_array($l, $this->collNagiosHostTemplatesRelatedByCheckPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplatesRelatedByCheckPeriod, $l); + $l->setNagiosTimeperiodRelatedByCheckPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostTemplatesRelatedByCheckPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostTemplatesRelatedByCheckPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByCheckPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByCheckPeriod; + } + + /** + * Clears out the collNagiosHostTemplatesRelatedByNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostTemplatesRelatedByNotificationPeriod() + */ + public function clearNagiosHostTemplatesRelatedByNotificationPeriod() + { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostTemplatesRelatedByNotificationPeriod collection (array). + * + * By default this just sets the collNagiosHostTemplatesRelatedByNotificationPeriod collection to an empty array (like clearcollNagiosHostTemplatesRelatedByNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostTemplatesRelatedByNotificationPeriod() + { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosHostTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosHostTemplatesRelatedByNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHostTemplate[] + * @throws PropelException + */ + public function getNagiosHostTemplatesRelatedByNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::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. + + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosHostTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria = $criteria; + return $this->collNagiosHostTemplatesRelatedByNotificationPeriod; + } + + /** + * Returns the number of related NagiosHostTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHostTemplate objects. + * @throws PropelException + */ + public function countNagiosHostTemplatesRelatedByNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $count = NagiosHostTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosHostTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostTemplatesRelatedByNotificationPeriod); + } + } else { + $count = count($this->collNagiosHostTemplatesRelatedByNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHostTemplate object to this object + * through the NagiosHostTemplate foreign key attribute. + * + * @param NagiosHostTemplate $l NagiosHostTemplate + * @return void + * @throws PropelException + */ + public function addNagiosHostTemplateRelatedByNotificationPeriod(NagiosHostTemplate $l) + { + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod === null) { + $this->initNagiosHostTemplatesRelatedByNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosHostTemplatesRelatedByNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostTemplatesRelatedByNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByNotificationPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostTemplatesRelatedByNotificationPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostTemplatesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostTemplatesRelatedByNotificationPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = NagiosHostTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostTemplateRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosHostTemplatesRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosHostsRelatedByCheckPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostsRelatedByCheckPeriod() + */ + public function clearNagiosHostsRelatedByCheckPeriod() + { + $this->collNagiosHostsRelatedByCheckPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostsRelatedByCheckPeriod collection (array). + * + * By default this just sets the collNagiosHostsRelatedByCheckPeriod collection to an empty array (like clearcollNagiosHostsRelatedByCheckPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostsRelatedByCheckPeriod() + { + $this->collNagiosHostsRelatedByCheckPeriod = array(); + } + + /** + * Gets an array of NagiosHost objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosHostsRelatedByCheckPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHost[] + * @throws PropelException + */ + public function getNagiosHostsRelatedByCheckPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::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. + + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostRelatedByCheckPeriodCriteria = $criteria; + return $this->collNagiosHostsRelatedByCheckPeriod; + } + + /** + * Returns the number of related NagiosHost objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHost objects. + * @throws PropelException + */ + public function countNagiosHostsRelatedByCheckPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostsRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + $count = NagiosHostPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostRelatedByCheckPeriodCriteria->equals($criteria)) { + $count = NagiosHostPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostsRelatedByCheckPeriod); + } + } else { + $count = count($this->collNagiosHostsRelatedByCheckPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHost object to this object + * through the NagiosHost foreign key attribute. + * + * @param NagiosHost $l NagiosHost + * @return void + * @throws PropelException + */ + public function addNagiosHostRelatedByCheckPeriod(NagiosHost $l) + { + if ($this->collNagiosHostsRelatedByCheckPeriod === null) { + $this->initNagiosHostsRelatedByCheckPeriod(); + } + if (!in_array($l, $this->collNagiosHostsRelatedByCheckPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostsRelatedByCheckPeriod, $l); + $l->setNagiosTimeperiodRelatedByCheckPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostsRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostsRelatedByCheckPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosHostsRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostsRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostsRelatedByCheckPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::CHECK_PERIOD, $this->id); + + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByCheckPeriodCriteria) || !$this->lastNagiosHostRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByCheckPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosHostsRelatedByCheckPeriod; + } + + /** + * Clears out the collNagiosHostsRelatedByNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosHostsRelatedByNotificationPeriod() + */ + public function clearNagiosHostsRelatedByNotificationPeriod() + { + $this->collNagiosHostsRelatedByNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosHostsRelatedByNotificationPeriod collection (array). + * + * By default this just sets the collNagiosHostsRelatedByNotificationPeriod collection to an empty array (like clearcollNagiosHostsRelatedByNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosHostsRelatedByNotificationPeriod() + { + $this->collNagiosHostsRelatedByNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosHost objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosHostsRelatedByNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosHost[] + * @throws PropelException + */ + public function getNagiosHostsRelatedByNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::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. + + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + NagiosHostPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosHostRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosHostRelatedByNotificationPeriodCriteria = $criteria; + return $this->collNagiosHostsRelatedByNotificationPeriod; + } + + /** + * Returns the number of related NagiosHost objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosHost objects. + * @throws PropelException + */ + public function countNagiosHostsRelatedByNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosHostsRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + $count = NagiosHostPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostRelatedByNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosHostPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosHostsRelatedByNotificationPeriod); + } + } else { + $count = count($this->collNagiosHostsRelatedByNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosHost object to this object + * through the NagiosHost foreign key attribute. + * + * @param NagiosHost $l NagiosHost + * @return void + * @throws PropelException + */ + public function addNagiosHostRelatedByNotificationPeriod(NagiosHost $l) + { + if ($this->collNagiosHostsRelatedByNotificationPeriod === null) { + $this->initNagiosHostsRelatedByNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosHostsRelatedByNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosHostsRelatedByNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByNotificationPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostsRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostsRelatedByNotificationPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosHostsRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosHostsRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosHostsRelatedByNotificationPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosHostsRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosHostsRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosHostPeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosHostRelatedByNotificationPeriodCriteria) || !$this->lastNagiosHostRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosHostsRelatedByNotificationPeriod = NagiosHostPeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosHostRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosHostsRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosServiceTemplatesRelatedByCheckPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplatesRelatedByCheckPeriod() + */ + public function clearNagiosServiceTemplatesRelatedByCheckPeriod() + { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplatesRelatedByCheckPeriod collection (array). + * + * By default this just sets the collNagiosServiceTemplatesRelatedByCheckPeriod collection to an empty array (like clearcollNagiosServiceTemplatesRelatedByCheckPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplatesRelatedByCheckPeriod() + { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = array(); + } + + /** + * Gets an array of NagiosServiceTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosServiceTemplatesRelatedByCheckPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplate[] + * @throws PropelException + */ + public function getNagiosServiceTemplatesRelatedByCheckPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::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. + + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria = $criteria; + return $this->collNagiosServiceTemplatesRelatedByCheckPeriod; + } + + /** + * Returns the number of related NagiosServiceTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplate objects. + * @throws PropelException + */ + public function countNagiosServiceTemplatesRelatedByCheckPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + $count = NagiosServiceTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $count = NagiosServiceTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByCheckPeriod); + } + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByCheckPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplate object to this object + * through the NagiosServiceTemplate foreign key attribute. + * + * @param NagiosServiceTemplate $l NagiosServiceTemplate + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateRelatedByCheckPeriod(NagiosServiceTemplate $l) + { + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod === null) { + $this->initNagiosServiceTemplatesRelatedByCheckPeriod(); + } + if (!in_array($l, $this->collNagiosServiceTemplatesRelatedByCheckPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplatesRelatedByCheckPeriod, $l); + $l->setNagiosTimeperiodRelatedByCheckPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServiceTemplatesRelatedByCheckPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServiceTemplatesRelatedByCheckPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByCheckPeriod; + } + + /** + * Clears out the collNagiosServiceTemplatesRelatedByNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServiceTemplatesRelatedByNotificationPeriod() + */ + public function clearNagiosServiceTemplatesRelatedByNotificationPeriod() + { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServiceTemplatesRelatedByNotificationPeriod collection (array). + * + * By default this just sets the collNagiosServiceTemplatesRelatedByNotificationPeriod collection to an empty array (like clearcollNagiosServiceTemplatesRelatedByNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServiceTemplatesRelatedByNotificationPeriod() + { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosServiceTemplate objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosServiceTemplatesRelatedByNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosServiceTemplate[] + * @throws PropelException + */ + public function getNagiosServiceTemplatesRelatedByNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::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. + + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosServiceTemplatePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria = $criteria; + return $this->collNagiosServiceTemplatesRelatedByNotificationPeriod; + } + + /** + * Returns the number of related NagiosServiceTemplate objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosServiceTemplate objects. + * @throws PropelException + */ + public function countNagiosServiceTemplatesRelatedByNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $count = NagiosServiceTemplatePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosServiceTemplatePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByNotificationPeriod); + } + } else { + $count = count($this->collNagiosServiceTemplatesRelatedByNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosServiceTemplate object to this object + * through the NagiosServiceTemplate foreign key attribute. + * + * @param NagiosServiceTemplate $l NagiosServiceTemplate + * @return void + * @throws PropelException + */ + public function addNagiosServiceTemplateRelatedByNotificationPeriod(NagiosServiceTemplate $l) + { + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod === null) { + $this->initNagiosServiceTemplatesRelatedByNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosServiceTemplatesRelatedByNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServiceTemplatesRelatedByNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByNotificationPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServiceTemplatesRelatedByNotificationPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServiceTemplatesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServiceTemplatesRelatedByNotificationPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = NagiosServiceTemplatePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceTemplateRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServiceTemplatesRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosServicesRelatedByCheckPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServicesRelatedByCheckPeriod() + */ + public function clearNagiosServicesRelatedByCheckPeriod() + { + $this->collNagiosServicesRelatedByCheckPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServicesRelatedByCheckPeriod collection (array). + * + * By default this just sets the collNagiosServicesRelatedByCheckPeriod collection to an empty array (like clearcollNagiosServicesRelatedByCheckPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServicesRelatedByCheckPeriod() + { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosServicesRelatedByCheckPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServicesRelatedByCheckPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServicesRelatedByCheckPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServicesRelatedByCheckPeriod); + } + } else { + $count = count($this->collNagiosServicesRelatedByCheckPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosServiceRelatedByCheckPeriod(NagiosService $l) + { + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + $this->initNagiosServicesRelatedByCheckPeriod(); + } + if (!in_array($l, $this->collNagiosServicesRelatedByCheckPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServicesRelatedByCheckPeriod, $l); + $l->setNagiosTimeperiodRelatedByCheckPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByCheckPeriodJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByCheckPeriodJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByCheckPeriodJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByCheckPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByCheckPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByCheckPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByCheckPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByCheckPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::CHECK_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::CHECK_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByCheckPeriodCriteria) || !$this->lastNagiosServiceRelatedByCheckPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByCheckPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByCheckPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByCheckPeriod; + } + + /** + * Clears out the collNagiosServicesRelatedByNotificationPeriod collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosServicesRelatedByNotificationPeriod() + */ + public function clearNagiosServicesRelatedByNotificationPeriod() + { + $this->collNagiosServicesRelatedByNotificationPeriod = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosServicesRelatedByNotificationPeriod collection (array). + * + * By default this just sets the collNagiosServicesRelatedByNotificationPeriod collection to an empty array (like clearcollNagiosServicesRelatedByNotificationPeriod()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosServicesRelatedByNotificationPeriod() + { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } + + /** + * Gets an array of NagiosService objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosServicesRelatedByNotificationPeriod from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosService[] + * @throws PropelException + */ + public function getNagiosServicesRelatedByNotificationPeriod($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::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. + + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + NagiosServicePeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + /** + * Returns the number of related NagiosService objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosService objects. + * @throws PropelException + */ + public function countNagiosServicesRelatedByNotificationPeriod(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $count = NagiosServicePeer::doCount($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 count of the collection. + + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $count = NagiosServicePeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosServicesRelatedByNotificationPeriod); + } + } else { + $count = count($this->collNagiosServicesRelatedByNotificationPeriod); + } + } + return $count; + } + + /** + * Method called to associate a NagiosService object to this object + * through the NagiosService foreign key attribute. + * + * @param NagiosService $l NagiosService + * @return void + * @throws PropelException + */ + public function addNagiosServiceRelatedByNotificationPeriod(NagiosService $l) + { + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + $this->initNagiosServicesRelatedByNotificationPeriod(); + } + if (!in_array($l, $this->collNagiosServicesRelatedByNotificationPeriod, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosServicesRelatedByNotificationPeriod, $l); + $l->setNagiosTimeperiodRelatedByNotificationPeriod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByNotificationPeriodJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByNotificationPeriodJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByNotificationPeriodJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByNotificationPeriodJoinNagiosCommandRelatedByCheckCommand($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByCheckCommand($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosServicesRelatedByNotificationPeriod 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 NagiosTimeperiod. + */ + public function getNagiosServicesRelatedByNotificationPeriodJoinNagiosCommandRelatedByEventHandler($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosServicesRelatedByNotificationPeriod === null) { + if ($this->isNew()) { + $this->collNagiosServicesRelatedByNotificationPeriod = array(); + } else { + + $criteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } 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(NagiosServicePeer::NOTIFICATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosServiceRelatedByNotificationPeriodCriteria) || !$this->lastNagiosServiceRelatedByNotificationPeriodCriteria->equals($criteria)) { + $this->collNagiosServicesRelatedByNotificationPeriod = NagiosServicePeer::doSelectJoinNagiosCommandRelatedByEventHandler($criteria, $con, $join_behavior); + } + } + $this->lastNagiosServiceRelatedByNotificationPeriodCriteria = $criteria; + + return $this->collNagiosServicesRelatedByNotificationPeriod; + } + + /** + * Clears out the collNagiosDependencys collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosDependencys() + */ + public function clearNagiosDependencys() + { + $this->collNagiosDependencys = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosDependencys collection (array). + * + * By default this just sets the collNagiosDependencys collection to an empty array (like clearcollNagiosDependencys()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosDependencys() + { + $this->collNagiosDependencys = array(); + } + + /** + * Gets an array of NagiosDependency objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosDependencys from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosDependency[] + * @throws PropelException + */ + public function getNagiosDependencys($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + $this->collNagiosDependencys = NagiosDependencyPeer::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. + + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + NagiosDependencyPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosDependencyCriteria = $criteria; + return $this->collNagiosDependencys; + } + + /** + * Returns the number of related NagiosDependency objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosDependency objects. + * @throws PropelException + */ + public function countNagiosDependencys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $count = NagiosDependencyPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $count = NagiosDependencyPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosDependencys); + } + } else { + $count = count($this->collNagiosDependencys); + } + } + return $count; + } + + /** + * Method called to associate a NagiosDependency object to this object + * through the NagiosDependency foreign key attribute. + * + * @param NagiosDependency $l NagiosDependency + * @return void + * @throws PropelException + */ + public function addNagiosDependency(NagiosDependency $l) + { + if ($this->collNagiosDependencys === null) { + $this->initNagiosDependencys(); + } + if (!in_array($l, $this->collNagiosDependencys, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosDependencys, $l); + $l->setNagiosTimeperiod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosTimeperiod. + */ + public function getNagiosDependencysJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosTimeperiod. + */ + public function getNagiosDependencysJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosTimeperiod. + */ + public function getNagiosDependencysJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosTimeperiod. + */ + public function getNagiosDependencysJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosDependencys 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 NagiosTimeperiod. + */ + public function getNagiosDependencysJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosDependencys === null) { + if ($this->isNew()) { + $this->collNagiosDependencys = array(); + } else { + + $criteria->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosDependencyPeer::DEPENDENCY_PERIOD, $this->id); + + if (!isset($this->lastNagiosDependencyCriteria) || !$this->lastNagiosDependencyCriteria->equals($criteria)) { + $this->collNagiosDependencys = NagiosDependencyPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosDependencyCriteria = $criteria; + + return $this->collNagiosDependencys; + } + + /** + * Clears out the collNagiosEscalations collection (array). + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addNagiosEscalations() + */ + public function clearNagiosEscalations() + { + $this->collNagiosEscalations = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collNagiosEscalations collection (array). + * + * By default this just sets the collNagiosEscalations collection to an empty array (like clearcollNagiosEscalations()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initNagiosEscalations() + { + $this->collNagiosEscalations = array(); + } + + /** + * Gets an array of NagiosEscalation objects which contain a foreign key that references this object. + * + * If this collection has already been initialized with an identical Criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod has previously been saved, it will retrieve + * related NagiosEscalations from storage. If this NagiosTimeperiod is new, it will return + * an empty collection or the current collection, the criteria is ignored on a new object. + * + * @param PropelPDO $con + * @param Criteria $criteria + * @return array NagiosEscalation[] + * @throws PropelException + */ + public function getNagiosEscalations($criteria = null, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + $this->collNagiosEscalations = NagiosEscalationPeer::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. + + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + NagiosEscalationPeer::addSelectColumns($criteria); + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelect($criteria, $con); + } + } + } + $this->lastNagiosEscalationCriteria = $criteria; + return $this->collNagiosEscalations; + } + + /** + * Returns the number of related NagiosEscalation objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related NagiosEscalation objects. + * @throws PropelException + */ + public function countNagiosEscalations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } else { + $criteria = clone $criteria; + } + + if ($distinct) { + $criteria->setDistinct(); + } + + $count = null; + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $count = 0; + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $count = NagiosEscalationPeer::doCount($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 count of the collection. + + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $count = NagiosEscalationPeer::doCount($criteria, $con); + } else { + $count = count($this->collNagiosEscalations); + } + } else { + $count = count($this->collNagiosEscalations); + } + } + return $count; + } + + /** + * Method called to associate a NagiosEscalation object to this object + * through the NagiosEscalation foreign key attribute. + * + * @param NagiosEscalation $l NagiosEscalation + * @return void + * @throws PropelException + */ + public function addNagiosEscalation(NagiosEscalation $l) + { + if ($this->collNagiosEscalations === null) { + $this->initNagiosEscalations(); + } + if (!in_array($l, $this->collNagiosEscalations, true)) { // only add it if the **same** object is not already associated + array_push($this->collNagiosEscalations, $l); + $l->setNagiosTimeperiod($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosTimeperiod. + */ + public function getNagiosEscalationsJoinNagiosHostTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosTimeperiod. + */ + public function getNagiosEscalationsJoinNagiosHost($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHost($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosTimeperiod. + */ + public function getNagiosEscalationsJoinNagiosServiceTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosServiceTemplate($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosTimeperiod. + */ + public function getNagiosEscalationsJoinNagiosService($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosService($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this NagiosTimeperiod is new, it will return + * an empty collection; or if this NagiosTimeperiod has previously + * been saved, it will retrieve related NagiosEscalations 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 NagiosTimeperiod. + */ + public function getNagiosEscalationsJoinNagiosHostgroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + if ($criteria === null) { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + } + elseif ($criteria instanceof Criteria) + { + $criteria = clone $criteria; + } + + if ($this->collNagiosEscalations === null) { + if ($this->isNew()) { + $this->collNagiosEscalations = array(); + } else { + + $criteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } 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(NagiosEscalationPeer::ESCALATION_PERIOD, $this->id); + + if (!isset($this->lastNagiosEscalationCriteria) || !$this->lastNagiosEscalationCriteria->equals($criteria)) { + $this->collNagiosEscalations = NagiosEscalationPeer::doSelectJoinNagiosHostgroup($criteria, $con, $join_behavior); + } + } + $this->lastNagiosEscalationCriteria = $criteria; + + return $this->collNagiosEscalations; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collNagiosTimeperiodEntrys) { + foreach ((array) $this->collNagiosTimeperiodEntrys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosTimeperiodExcludesRelatedByTimeperiodId) { + foreach ((array) $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod) { + foreach ((array) $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosContactsRelatedByHostNotificationPeriod) { + foreach ((array) $this->collNagiosContactsRelatedByHostNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosContactsRelatedByServiceNotificationPeriod) { + foreach ((array) $this->collNagiosContactsRelatedByServiceNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplatesRelatedByCheckPeriod) { + foreach ((array) $this->collNagiosHostTemplatesRelatedByCheckPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostTemplatesRelatedByNotificationPeriod) { + foreach ((array) $this->collNagiosHostTemplatesRelatedByNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostsRelatedByCheckPeriod) { + foreach ((array) $this->collNagiosHostsRelatedByCheckPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosHostsRelatedByNotificationPeriod) { + foreach ((array) $this->collNagiosHostsRelatedByNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplatesRelatedByCheckPeriod) { + foreach ((array) $this->collNagiosServiceTemplatesRelatedByCheckPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServiceTemplatesRelatedByNotificationPeriod) { + foreach ((array) $this->collNagiosServiceTemplatesRelatedByNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServicesRelatedByCheckPeriod) { + foreach ((array) $this->collNagiosServicesRelatedByCheckPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosServicesRelatedByNotificationPeriod) { + foreach ((array) $this->collNagiosServicesRelatedByNotificationPeriod as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosDependencys) { + foreach ((array) $this->collNagiosDependencys as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collNagiosEscalations) { + foreach ((array) $this->collNagiosEscalations as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collNagiosTimeperiodEntrys = null; + $this->collNagiosTimeperiodExcludesRelatedByTimeperiodId = null; + $this->collNagiosTimeperiodExcludesRelatedByExcludedTimeperiod = null; + $this->collNagiosContactsRelatedByHostNotificationPeriod = null; + $this->collNagiosContactsRelatedByServiceNotificationPeriod = null; + $this->collNagiosHostTemplatesRelatedByCheckPeriod = null; + $this->collNagiosHostTemplatesRelatedByNotificationPeriod = null; + $this->collNagiosHostsRelatedByCheckPeriod = null; + $this->collNagiosHostsRelatedByNotificationPeriod = null; + $this->collNagiosServiceTemplatesRelatedByCheckPeriod = null; + $this->collNagiosServiceTemplatesRelatedByNotificationPeriod = null; + $this->collNagiosServicesRelatedByCheckPeriod = null; + $this->collNagiosServicesRelatedByNotificationPeriod = null; + $this->collNagiosDependencys = null; + $this->collNagiosEscalations = null; + } + +} // BaseNagiosTimeperiod diff --git a/classes/om/BaseNagiosTimeperiodEntry.php b/classes/om/BaseNagiosTimeperiodEntry.php new file mode 100755 index 0000000..f0a65a7 --- /dev/null +++ b/classes/om/BaseNagiosTimeperiodEntry.php @@ -0,0 +1,855 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [timeperiod_id] column value. + * + * @return int + */ + public function getTimeperiodId() + { + return $this->timeperiod_id; + } + + /** + * Get the [entry] column value. + * + * @return string + */ + public function getEntry() + { + return $this->entry; + } + + /** + * Get the [value] column value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosTimeperiodEntry The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosTimeperiodEntryPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [timeperiod_id] column. + * + * @param int $v new value + * @return NagiosTimeperiodEntry The current object (for fluent API support) + */ + public function setTimeperiodId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->timeperiod_id !== $v) { + $this->timeperiod_id = $v; + $this->modifiedColumns[] = NagiosTimeperiodEntryPeer::TIMEPERIOD_ID; + } + + if ($this->aNagiosTimeperiod !== null && $this->aNagiosTimeperiod->getId() !== $v) { + $this->aNagiosTimeperiod = null; + } + + return $this; + } // setTimeperiodId() + + /** + * Set the value of [entry] column. + * + * @param string $v new value + * @return NagiosTimeperiodEntry The current object (for fluent API support) + */ + public function setEntry($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->entry !== $v) { + $this->entry = $v; + $this->modifiedColumns[] = NagiosTimeperiodEntryPeer::ENTRY; + } + + return $this; + } // setEntry() + + /** + * Set the value of [value] column. + * + * @param string $v new value + * @return NagiosTimeperiodEntry The current object (for fluent API support) + */ + public function setValue($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->value !== $v) { + $this->value = $v; + $this->modifiedColumns[] = NagiosTimeperiodEntryPeer::VALUE; + } + + return $this; + } // setValue() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->timeperiod_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->entry = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = NagiosTimeperiodEntryPeer::NUM_COLUMNS - NagiosTimeperiodEntryPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosTimeperiodEntry object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosTimeperiod !== null && $this->timeperiod_id !== $this->aNagiosTimeperiod->getId()) { + $this->aNagiosTimeperiod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosTimeperiodEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosTimeperiod = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosTimeperiodEntryPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosTimeperiodEntryPeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosTimeperiod !== null) { + if ($this->aNagiosTimeperiod->isModified() || $this->aNagiosTimeperiod->isNew()) { + $affectedRows += $this->aNagiosTimeperiod->save($con); + } + $this->setNagiosTimeperiod($this->aNagiosTimeperiod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosTimeperiodEntryPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosTimeperiodEntryPeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosTimeperiodEntryPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosTimeperiod !== null) { + if (!$this->aNagiosTimeperiod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiod->getValidationFailures()); + } + } + + + if (($retval = NagiosTimeperiodEntryPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getTimeperiodId(); + break; + case 2: + return $this->getEntry(); + break; + case 3: + return $this->getValue(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosTimeperiodEntryPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getTimeperiodId(), + $keys[2] => $this->getEntry(), + $keys[3] => $this->getValue(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodEntryPeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setTimeperiodId($value); + break; + case 2: + $this->setEntry($value); + break; + case 3: + $this->setValue($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosTimeperiodEntryPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setTimeperiodId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setEntry($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setValue($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(NagiosTimeperiodEntryPeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosTimeperiodEntryPeer::ID)) $criteria->add(NagiosTimeperiodEntryPeer::ID, $this->id); + if ($this->isColumnModified(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID)) $criteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $this->timeperiod_id); + if ($this->isColumnModified(NagiosTimeperiodEntryPeer::ENTRY)) $criteria->add(NagiosTimeperiodEntryPeer::ENTRY, $this->entry); + if ($this->isColumnModified(NagiosTimeperiodEntryPeer::VALUE)) $criteria->add(NagiosTimeperiodEntryPeer::VALUE, $this->value); + + 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(NagiosTimeperiodEntryPeer::DATABASE_NAME); + + $criteria->add(NagiosTimeperiodEntryPeer::ID, $this->id); + + 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 NagiosTimeperiodEntry (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) + { + + $copyObj->setTimeperiodId($this->timeperiod_id); + + $copyObj->setEntry($this->entry); + + $copyObj->setValue($this->value); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosTimeperiodEntry 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); + $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 NagiosTimeperiodEntryPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosTimeperiodEntryPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosTimeperiodEntry The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setTimeperiodId(NULL); + } else { + $this->setTimeperiodId($v->getId()); + } + + $this->aNagiosTimeperiod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosTimeperiodEntry($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiod === null && ($this->timeperiod_id !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->timeperiod_id); + $this->aNagiosTimeperiod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiod->addNagiosTimeperiodEntrys($this); + */ + } + return $this->aNagiosTimeperiod; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosTimeperiod = null; + } + +} // BaseNagiosTimeperiodEntry diff --git a/classes/om/BaseNagiosTimeperiodEntryPeer.php b/classes/om/BaseNagiosTimeperiodEntryPeer.php new file mode 100755 index 0000000..dd0ea1d --- /dev/null +++ b/classes/om/BaseNagiosTimeperiodEntryPeer.php @@ -0,0 +1,932 @@ + array ('Id', 'TimeperiodId', 'Entry', 'Value', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'timeperiodId', 'entry', 'value', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::TIMEPERIOD_ID, self::ENTRY, self::VALUE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'timeperiod_id', 'entry', 'value', ), + 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, 'TimeperiodId' => 1, 'Entry' => 2, 'Value' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'timeperiodId' => 1, 'entry' => 2, 'value' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TIMEPERIOD_ID => 1, self::ENTRY => 2, self::VALUE => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timeperiod_id' => 1, 'entry' => 2, 'value' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosTimeperiodEntryMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosTimeperiodEntryPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosTimeperiodEntryPeer::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) + { + + $criteria->addSelectColumn(NagiosTimeperiodEntryPeer::ID); + + $criteria->addSelectColumn(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID); + + $criteria->addSelectColumn(NagiosTimeperiodEntryPeer::ENTRY); + + $criteria->addSelectColumn(NagiosTimeperiodEntryPeer::VALUE); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosTimeperiodEntry + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosTimeperiodEntryPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosTimeperiodEntryPeer::populateObjects(NagiosTimeperiodEntryPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosTimeperiodEntry $value A NagiosTimeperiodEntry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosTimeperiodEntry $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosTimeperiodEntry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosTimeperiodEntry) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosTimeperiodEntry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosTimeperiodEntry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosTimeperiodEntryPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosTimeperiodEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosTimeperiodEntryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosTimeperiodEntryPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosTimeperiodEntry objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodEntryPeer::addSelectColumns($c); + $startcol = (NagiosTimeperiodEntryPeer::NUM_COLUMNS - NagiosTimeperiodEntryPeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosTimeperiodEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodEntryPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosTimeperiodEntry) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosTimeperiodEntry($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodEntryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodEntryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosTimeperiodEntry objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodEntry objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodEntryPeer::addSelectColumns($c); + $startcol2 = (NagiosTimeperiodEntryPeer::NUM_COLUMNS - NagiosTimeperiodEntryPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodEntryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodEntryPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosTimeperiodEntryPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodEntryPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosTimeperiodEntry) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosTimeperiodEntry($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosTimeperiodEntryPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosTimeperiodEntry or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiodEntry object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosTimeperiodEntry object + } + + if ($criteria->containsKey(NagiosTimeperiodEntryPeer::ID) && $criteria->keyContainsValue(NagiosTimeperiodEntryPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosTimeperiodEntryPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosTimeperiodEntry or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiodEntry object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosTimeperiodEntryPeer::ID); + $selectCriteria->add(NagiosTimeperiodEntryPeer::ID, $criteria->remove(NagiosTimeperiodEntryPeer::ID), $comparison); + + } else { // $values is NagiosTimeperiodEntry object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_timeperiod_entry 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(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosTimeperiodEntryPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosTimeperiodEntry or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosTimeperiodEntry object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosTimeperiodEntryPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosTimeperiodEntry) { + // invalidate the cache for this single object + NagiosTimeperiodEntryPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosTimeperiodEntryPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosTimeperiodEntryPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosTimeperiodEntry 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 NagiosTimeperiodEntry $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(NagiosTimeperiodEntry $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosTimeperiodEntryPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosTimeperiodEntryPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosTimeperiodEntryPeer::DATABASE_NAME, NagiosTimeperiodEntryPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosTimeperiodEntry + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosTimeperiodEntryPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosTimeperiodEntryPeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodEntryPeer::ID, $pk); + + $v = NagiosTimeperiodEntryPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosTimeperiodEntryPeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodEntryPeer::ID, $pks, Criteria::IN); + $objs = NagiosTimeperiodEntryPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosTimeperiodEntryPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosTimeperiodEntryPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosTimeperiodEntryPeer class: +// +// Propel::getDatabaseMap(NagiosTimeperiodEntryPeer::DATABASE_NAME)->addTableBuilder(NagiosTimeperiodEntryPeer::TABLE_NAME, NagiosTimeperiodEntryPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosTimeperiodEntryPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosTimeperiodEntryPeer::TABLE_NAME, BaseNagiosTimeperiodEntryPeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosTimeperiodExclude.php b/classes/om/BaseNagiosTimeperiodExclude.php new file mode 100755 index 0000000..497ea70 --- /dev/null +++ b/classes/om/BaseNagiosTimeperiodExclude.php @@ -0,0 +1,885 @@ +applyDefaultValues(); + } + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [timeperiod_id] column value. + * + * @return int + */ + public function getTimeperiodId() + { + return $this->timeperiod_id; + } + + /** + * Get the [excluded_timeperiod] column value. + * + * @return int + */ + public function getExcludedTimeperiod() + { + return $this->excluded_timeperiod; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return NagiosTimeperiodExclude The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = NagiosTimeperiodExcludePeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [timeperiod_id] column. + * + * @param int $v new value + * @return NagiosTimeperiodExclude The current object (for fluent API support) + */ + public function setTimeperiodId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->timeperiod_id !== $v) { + $this->timeperiod_id = $v; + $this->modifiedColumns[] = NagiosTimeperiodExcludePeer::TIMEPERIOD_ID; + } + + if ($this->aNagiosTimeperiodRelatedByTimeperiodId !== null && $this->aNagiosTimeperiodRelatedByTimeperiodId->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByTimeperiodId = null; + } + + return $this; + } // setTimeperiodId() + + /** + * Set the value of [excluded_timeperiod] column. + * + * @param int $v new value + * @return NagiosTimeperiodExclude The current object (for fluent API support) + */ + public function setExcludedTimeperiod($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->excluded_timeperiod !== $v) { + $this->excluded_timeperiod = $v; + $this->modifiedColumns[] = NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD; + } + + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod !== null && $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->getId() !== $v) { + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = null; + } + + return $this; + } // setExcludedTimeperiod() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // First, ensure that we don't have any columns that have been modified which aren't default columns. + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->timeperiod_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->excluded_timeperiod = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 3; // 3 = NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating NagiosTimeperiodExclude object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aNagiosTimeperiodRelatedByTimeperiodId !== null && $this->timeperiod_id !== $this->aNagiosTimeperiodRelatedByTimeperiodId->getId()) { + $this->aNagiosTimeperiodRelatedByTimeperiodId = null; + } + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod !== null && $this->excluded_timeperiod !== $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->getId()) { + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = NagiosTimeperiodExcludePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aNagiosTimeperiodRelatedByTimeperiodId = null; + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + NagiosTimeperiodExcludePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $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(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + NagiosTimeperiodExcludePeer::addInstanceToPool($this); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row 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 PropelPDO $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(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + 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->aNagiosTimeperiodRelatedByTimeperiodId !== null) { + if ($this->aNagiosTimeperiodRelatedByTimeperiodId->isModified() || $this->aNagiosTimeperiodRelatedByTimeperiodId->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByTimeperiodId->save($con); + } + $this->setNagiosTimeperiodRelatedByTimeperiodId($this->aNagiosTimeperiodRelatedByTimeperiodId); + } + + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod !== null) { + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod->isModified() || $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->isNew()) { + $affectedRows += $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->save($con); + } + $this->setNagiosTimeperiodRelatedByExcludedTimeperiod($this->aNagiosTimeperiodRelatedByExcludedTimeperiod); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = NagiosTimeperiodExcludePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = NagiosTimeperiodExcludePeer::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 + + $this->setNew(false); + } else { + $affectedRows += NagiosTimeperiodExcludePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $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); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * 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 true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $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->aNagiosTimeperiodRelatedByTimeperiodId !== null) { + if (!$this->aNagiosTimeperiodRelatedByTimeperiodId->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByTimeperiodId->getValidationFailures()); + } + } + + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod !== null) { + if (!$this->aNagiosTimeperiodRelatedByExcludedTimeperiod->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->getValidationFailures()); + } + } + + + if (($retval = NagiosTimeperiodExcludePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodExcludePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * 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) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getTimeperiodId(); + break; + case 2: + return $this->getExcludedTimeperiod(); + break; + 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 (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = NagiosTimeperiodExcludePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getTimeperiodId(), + $keys[2] => $this->getExcludedTimeperiod(), + ); + 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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = NagiosTimeperiodExcludePeer::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) { + case 0: + $this->setId($value); + break; + case 1: + $this->setTimeperiodId($value); + break; + case 2: + $this->setExcludedTimeperiod($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 BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::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 = NagiosTimeperiodExcludePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setTimeperiodId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setExcludedTimeperiod($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(NagiosTimeperiodExcludePeer::DATABASE_NAME); + + if ($this->isColumnModified(NagiosTimeperiodExcludePeer::ID)) $criteria->add(NagiosTimeperiodExcludePeer::ID, $this->id); + if ($this->isColumnModified(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID)) $criteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $this->timeperiod_id); + if ($this->isColumnModified(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD)) $criteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $this->excluded_timeperiod); + + 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(NagiosTimeperiodExcludePeer::DATABASE_NAME); + + $criteria->add(NagiosTimeperiodExcludePeer::ID, $this->id); + + 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 NagiosTimeperiodExclude (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) + { + + $copyObj->setTimeperiodId($this->timeperiod_id); + + $copyObj->setExcludedTimeperiod($this->excluded_timeperiod); + + + $copyObj->setNew(true); + + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + + } + + /** + * 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 NagiosTimeperiodExclude 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); + $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 NagiosTimeperiodExcludePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new NagiosTimeperiodExcludePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosTimeperiodExclude The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByTimeperiodId(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setTimeperiodId(NULL); + } else { + $this->setTimeperiodId($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByTimeperiodId = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosTimeperiodExcludeRelatedByTimeperiodId($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByTimeperiodId(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByTimeperiodId === null && ($this->timeperiod_id !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->timeperiod_id); + $this->aNagiosTimeperiodRelatedByTimeperiodId = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByTimeperiodId->addNagiosTimeperiodExcludesRelatedByTimeperiodId($this); + */ + } + return $this->aNagiosTimeperiodRelatedByTimeperiodId; + } + + /** + * Declares an association between this object and a NagiosTimeperiod object. + * + * @param NagiosTimeperiod $v + * @return NagiosTimeperiodExclude The current object (for fluent API support) + * @throws PropelException + */ + public function setNagiosTimeperiodRelatedByExcludedTimeperiod(NagiosTimeperiod $v = null) + { + if ($v === null) { + $this->setExcludedTimeperiod(NULL); + } else { + $this->setExcludedTimeperiod($v->getId()); + } + + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the NagiosTimeperiod object, it will not be re-added. + if ($v !== null) { + $v->addNagiosTimeperiodExcludeRelatedByExcludedTimeperiod($this); + } + + return $this; + } + + + /** + * Get the associated NagiosTimeperiod object + * + * @param PropelPDO Optional Connection object. + * @return NagiosTimeperiod The associated NagiosTimeperiod object. + * @throws PropelException + */ + public function getNagiosTimeperiodRelatedByExcludedTimeperiod(PropelPDO $con = null) + { + if ($this->aNagiosTimeperiodRelatedByExcludedTimeperiod === null && ($this->excluded_timeperiod !== null)) { + $c = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $c->add(NagiosTimeperiodPeer::ID, $this->excluded_timeperiod); + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = NagiosTimeperiodPeer::doSelectOne($c, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod->addNagiosTimeperiodExcludesRelatedByExcludedTimeperiod($this); + */ + } + return $this->aNagiosTimeperiodRelatedByExcludedTimeperiod; + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aNagiosTimeperiodRelatedByTimeperiodId = null; + $this->aNagiosTimeperiodRelatedByExcludedTimeperiod = null; + } + +} // BaseNagiosTimeperiodExclude diff --git a/classes/om/BaseNagiosTimeperiodExcludePeer.php b/classes/om/BaseNagiosTimeperiodExcludePeer.php new file mode 100755 index 0000000..5e2b31f --- /dev/null +++ b/classes/om/BaseNagiosTimeperiodExcludePeer.php @@ -0,0 +1,1264 @@ + array ('Id', 'TimeperiodId', 'ExcludedTimeperiod', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'timeperiodId', 'excludedTimeperiod', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::TIMEPERIOD_ID, self::EXCLUDED_TIMEPERIOD, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'timeperiod_id', 'excluded_timeperiod', ), + 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, 'TimeperiodId' => 1, 'ExcludedTimeperiod' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'timeperiodId' => 1, 'excludedTimeperiod' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TIMEPERIOD_ID => 1, self::EXCLUDED_TIMEPERIOD => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timeperiod_id' => 1, 'excluded_timeperiod' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosTimeperiodExcludeMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosTimeperiodExcludePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosTimeperiodExcludePeer::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) + { + + $criteria->addSelectColumn(NagiosTimeperiodExcludePeer::ID); + + $criteria->addSelectColumn(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID); + + $criteria->addSelectColumn(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosTimeperiodExclude + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosTimeperiodExcludePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosTimeperiodExcludePeer::populateObjects(NagiosTimeperiodExcludePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosTimeperiodExclude $value A NagiosTimeperiodExclude object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosTimeperiodExclude $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosTimeperiodExclude object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosTimeperiodExclude) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosTimeperiodExclude object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosTimeperiodExclude Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosTimeperiodExcludePeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosTimeperiodExcludePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosTimeperiodExcludePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByTimeperiodId table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByTimeperiodId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByExcludedTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinNagiosTimeperiodRelatedByExcludedTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosTimeperiodExclude objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodExclude objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByTimeperiodId(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodExcludePeer::addSelectColumns($c); + $startcol = (NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodExcludePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosTimeperiodExcludePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodExcludePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosTimeperiodExclude) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosTimeperiodExcludeRelatedByTimeperiodId($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosTimeperiodExclude objects pre-filled with their NagiosTimeperiod objects. + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodExclude objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinNagiosTimeperiodRelatedByExcludedTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodExcludePeer::addSelectColumns($c); + $startcol = (NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS); + NagiosTimeperiodPeer::addSelectColumns($c); + + $c->addJoin(array(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodExcludePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $omClass = NagiosTimeperiodExcludePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodExcludePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (NagiosTimeperiodExclude) to $obj2 (NagiosTimeperiod) + $obj2->addNagiosTimeperiodExcludeRelatedByExcludedTimeperiod($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(array(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $criteria->addJoin(array(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of NagiosTimeperiodExclude objects pre-filled with all related objects. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodExclude objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $c = clone $c; + + // Set the correct dbName if it has not been overridden + if ($c->getDbName() == Propel::getDefaultDB()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodExcludePeer::addSelectColumns($c); + $startcol2 = (NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol3 = $startcol2 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + NagiosTimeperiodPeer::addSelectColumns($c); + $startcol4 = $startcol3 + (NagiosTimeperiodPeer::NUM_COLUMNS - NagiosTimeperiodPeer::NUM_LAZY_LOAD_COLUMNS); + + $c->addJoin(array(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $c->addJoin(array(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD,), array(NagiosTimeperiodPeer::ID,), $join_behavior); + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodExcludePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosTimeperiodExcludePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodExcludePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined NagiosTimeperiod rows + + $key2 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = NagiosTimeperiodPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + NagiosTimeperiodPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (NagiosTimeperiodExclude) to the collection in $obj2 (NagiosTimeperiod) + $obj2->addNagiosTimeperiodExcludeRelatedByTimeperiodId($obj1); + } // if joined row not null + + // Add objects for joined NagiosTimeperiod rows + + $key3 = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = NagiosTimeperiodPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $omClass = NagiosTimeperiodPeer::getOMClass(); + + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + NagiosTimeperiodPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (NagiosTimeperiodExclude) to the collection in $obj3 (NagiosTimeperiod) + $obj3->addNagiosTimeperiodExcludeRelatedByExcludedTimeperiod($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByTimeperiodId table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByTimeperiodId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related NagiosTimeperiodRelatedByExcludedTimeperiod table + * + * @param Criteria $c + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptNagiosTimeperiodRelatedByExcludedTimeperiod(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodExcludePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of NagiosTimeperiodExclude objects pre-filled with all related objects except NagiosTimeperiodRelatedByTimeperiodId. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodExclude objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByTimeperiodId(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodExcludePeer::addSelectColumns($c); + $startcol2 = (NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodExcludePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosTimeperiodExcludePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodExcludePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of NagiosTimeperiodExclude objects pre-filled with all related objects except NagiosTimeperiodRelatedByExcludedTimeperiod. + * + * @param Criteria $c + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of NagiosTimeperiodExclude objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptNagiosTimeperiodRelatedByExcludedTimeperiod(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $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()) { + $c->setDbName(self::DATABASE_NAME); + } + + NagiosTimeperiodExcludePeer::addSelectColumns($c); + $startcol2 = (NagiosTimeperiodExcludePeer::NUM_COLUMNS - NagiosTimeperiodExcludePeer::NUM_LAZY_LOAD_COLUMNS); + + + $stmt = BasePeer::doSelect($c, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = NagiosTimeperiodExcludePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = NagiosTimeperiodExcludePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $omClass = NagiosTimeperiodExcludePeer::getOMClass(); + + $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); + $obj1 = new $cls(); + $obj1->hydrate($row); + NagiosTimeperiodExcludePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + $results[] = $obj1; + } + $stmt->closeCursor(); + 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 NagiosTimeperiodExcludePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosTimeperiodExclude or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiodExclude object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosTimeperiodExclude object + } + + if ($criteria->containsKey(NagiosTimeperiodExcludePeer::ID) && $criteria->keyContainsValue(NagiosTimeperiodExcludePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosTimeperiodExcludePeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosTimeperiodExclude or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiodExclude object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosTimeperiodExcludePeer::ID); + $selectCriteria->add(NagiosTimeperiodExcludePeer::ID, $criteria->remove(NagiosTimeperiodExcludePeer::ID), $comparison); + + } else { // $values is NagiosTimeperiodExclude object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_timeperiod_exclude 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(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(NagiosTimeperiodExcludePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosTimeperiodExclude or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosTimeperiodExclude object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosTimeperiodExcludePeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosTimeperiodExclude) { + // invalidate the cache for this single object + NagiosTimeperiodExcludePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosTimeperiodExcludePeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosTimeperiodExcludePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given NagiosTimeperiodExclude 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 NagiosTimeperiodExclude $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(NagiosTimeperiodExclude $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosTimeperiodExcludePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosTimeperiodExcludePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosTimeperiodExcludePeer::DATABASE_NAME, NagiosTimeperiodExcludePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosTimeperiodExclude + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosTimeperiodExcludePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosTimeperiodExcludePeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodExcludePeer::ID, $pk); + + $v = NagiosTimeperiodExcludePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodExcludePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosTimeperiodExcludePeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodExcludePeer::ID, $pks, Criteria::IN); + $objs = NagiosTimeperiodExcludePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosTimeperiodExcludePeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosTimeperiodExcludePeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosTimeperiodExcludePeer class: +// +// Propel::getDatabaseMap(NagiosTimeperiodExcludePeer::DATABASE_NAME)->addTableBuilder(NagiosTimeperiodExcludePeer::TABLE_NAME, NagiosTimeperiodExcludePeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosTimeperiodExcludePeer::DATABASE_NAME)->addTableBuilder(BaseNagiosTimeperiodExcludePeer::TABLE_NAME, BaseNagiosTimeperiodExcludePeer::getMapBuilder()); + diff --git a/classes/om/BaseNagiosTimeperiodPeer.php b/classes/om/BaseNagiosTimeperiodPeer.php new file mode 100755 index 0000000..139d26c --- /dev/null +++ b/classes/om/BaseNagiosTimeperiodPeer.php @@ -0,0 +1,917 @@ + array ('Id', 'Name', 'Alias', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'alias', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::ALIAS, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'alias', ), + 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, 'Name' => 1, 'Alias' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::ALIAS => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'alias' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Get a (singleton) instance of the MapBuilder for this peer class. + * @return MapBuilder The map builder for this peer + */ + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new NagiosTimeperiodMapBuilder(); + } + return self::$mapBuilder; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + 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. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. NagiosTimeperiodPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(NagiosTimeperiodPeer::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) + { + + $criteria->addSelectColumn(NagiosTimeperiodPeer::ID); + + $criteria->addSelectColumn(NagiosTimeperiodPeer::NAME); + + $criteria->addSelectColumn(NagiosTimeperiodPeer::ALIAS); + + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(NagiosTimeperiodPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + NagiosTimeperiodPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return NagiosTimeperiod + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = NagiosTimeperiodPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $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, PropelPDO $con = null) + { + return NagiosTimeperiodPeer::populateObjects(NagiosTimeperiodPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + NagiosTimeperiodPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param NagiosTimeperiod $value A NagiosTimeperiod object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(NagiosTimeperiod $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A NagiosTimeperiod object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof NagiosTimeperiod) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NagiosTimeperiod object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return NagiosTimeperiod Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol + 0] === null) { + return null; + } + return (string) $row[$startcol + 0]; + } + + /** + * 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(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = NagiosTimeperiodPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = NagiosTimeperiodPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = NagiosTimeperiodPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://propel.phpdb.org/trac/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + NagiosTimeperiodPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + 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 NagiosTimeperiodPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a NagiosTimeperiod or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiod object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from NagiosTimeperiod object + } + + if ($criteria->containsKey(NagiosTimeperiodPeer::ID) && $criteria->keyContainsValue(NagiosTimeperiodPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.NagiosTimeperiodPeer::ID.')'); + } + + + // 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->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a NagiosTimeperiod or Criteria object. + * + * @param mixed $values Criteria or NagiosTimeperiod object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO 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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(NagiosTimeperiodPeer::ID); + $selectCriteria->add(NagiosTimeperiodPeer::ID, $criteria->remove(NagiosTimeperiodPeer::ID), $comparison); + + } else { // $values is NagiosTimeperiod object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the nagios_timeperiod 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(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $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->beginTransaction(); + $affectedRows += NagiosTimeperiodPeer::doOnDeleteCascade(new Criteria(NagiosTimeperiodPeer::DATABASE_NAME), $con); + NagiosTimeperiodPeer::doOnDeleteSetNull(new Criteria(NagiosTimeperiodPeer::DATABASE_NAME), $con); + $affectedRows += BasePeer::doDeleteAll(NagiosTimeperiodPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a NagiosTimeperiod or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or NagiosTimeperiod object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $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, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + NagiosTimeperiodPeer::clearInstancePool(); + + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof NagiosTimeperiod) { + // invalidate the cache for this single object + NagiosTimeperiodPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(NagiosTimeperiodPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + // we can invalidate the cache for this single object + NagiosTimeperiodPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(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->beginTransaction(); + $affectedRows += NagiosTimeperiodPeer::doOnDeleteCascade($criteria, $con); + NagiosTimeperiodPeer::doOnDeleteSetNull($criteria, $con); + + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + if ($values instanceof Criteria) { + NagiosTimeperiodPeer::clearInstancePool(); + } else { // it's a PK or object + NagiosTimeperiodPeer::removeInstanceFromPool($values); + } + + $affectedRows += BasePeer::doDelete($criteria, $con); + + // invalidate objects in NagiosTimeperiodEntryPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosTimeperiodEntryPeer::clearInstancePool(); + + // invalidate objects in NagiosTimeperiodExcludePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosTimeperiodExcludePeer::clearInstancePool(); + + // invalidate objects in NagiosTimeperiodExcludePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosTimeperiodExcludePeer::clearInstancePool(); + + // invalidate objects in NagiosContactPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactPeer::clearInstancePool(); + + // invalidate objects in NagiosContactPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosContactPeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosHostTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosHostPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostPeer::clearInstancePool(); + + // invalidate objects in NagiosHostPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosHostPeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosServiceTemplatePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServiceTemplatePeer::clearInstancePool(); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosServicePeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosServicePeer::clearInstancePool(); + + // invalidate objects in NagiosDependencyPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosDependencyPeer::clearInstancePool(); + + // invalidate objects in NagiosEscalationPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. + NagiosEscalationPeer::clearInstancePool(); + + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * This is a method for emulating ON DELETE CASCADE for DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return int The number of affected rows (if supported by underlying database driver). + */ + protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) + { + // initialize var to track total num of affected rows + $affectedRows = 0; + + // first find the objects that are implicated by the $criteria + $objects = NagiosTimeperiodPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + + // delete related NagiosDependency objects + $c = new Criteria(NagiosDependencyPeer::DATABASE_NAME); + + $c->add(NagiosDependencyPeer::DEPENDENCY_PERIOD, $obj->getId()); + $affectedRows += NagiosDependencyPeer::doDelete($c, $con); + } + return $affectedRows; + } + + /** + * This is a method for emulating ON DELETE SET NULL DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return void + */ + protected static function doOnDeleteSetNull(Criteria $criteria, PropelPDO $con) + { + + // first find the objects that are implicated by the $criteria + $objects = NagiosTimeperiodPeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + // set fkey col in related NagiosTimeperiodEntry rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $obj->getId()); + $updateValues->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosTimeperiodExclude rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $obj->getId()); + $updateValues->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosTimeperiodExclude rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, $obj->getId()); + $updateValues->add(NagiosTimeperiodExcludePeer::EXCLUDED_TIMEPERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosContact rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosContactPeer::HOST_NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosContact rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosContactPeer::SERVICE_NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHostTemplate rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostTemplatePeer::CHECK_PERIOD, $obj->getId()); + $updateValues->add(NagiosHostTemplatePeer::CHECK_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHostTemplate rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosHostTemplatePeer::NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHost rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostPeer::CHECK_PERIOD, $obj->getId()); + $updateValues->add(NagiosHostPeer::CHECK_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosHost rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosHostPeer::NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosHostPeer::NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosServiceTemplate rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServiceTemplatePeer::CHECK_PERIOD, $obj->getId()); + $updateValues->add(NagiosServiceTemplatePeer::CHECK_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosServiceTemplate rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosServiceTemplatePeer::NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosService rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServicePeer::CHECK_PERIOD, $obj->getId()); + $updateValues->add(NagiosServicePeer::CHECK_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosService rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosServicePeer::NOTIFICATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosServicePeer::NOTIFICATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + // set fkey col in related NagiosEscalation rows to NULL + $selectCriteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $updateValues = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $selectCriteria->add(NagiosEscalationPeer::ESCALATION_PERIOD, $obj->getId()); + $updateValues->add(NagiosEscalationPeer::ESCALATION_PERIOD, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + } + } + + /** + * Validates all modified columns of given NagiosTimeperiod 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 NagiosTimeperiod $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(NagiosTimeperiod $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(NagiosTimeperiodPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(NagiosTimeperiodPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(NagiosTimeperiodPeer::DATABASE_NAME, NagiosTimeperiodPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return NagiosTimeperiod + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = NagiosTimeperiodPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodPeer::ID, $pk); + + $v = NagiosTimeperiodPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(NagiosTimeperiodPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(NagiosTimeperiodPeer::DATABASE_NAME); + $criteria->add(NagiosTimeperiodPeer::ID, $pks, Criteria::IN); + $objs = NagiosTimeperiodPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseNagiosTimeperiodPeer + +// This is the static code needed to register the MapBuilder for this table with the main Propel class. +// +// NOTE: This static code cannot call methods on the NagiosTimeperiodPeer class, because it is not defined yet. +// If you need to use overridden methods, you can add this code to the bottom of the NagiosTimeperiodPeer class: +// +// Propel::getDatabaseMap(NagiosTimeperiodPeer::DATABASE_NAME)->addTableBuilder(NagiosTimeperiodPeer::TABLE_NAME, NagiosTimeperiodPeer::getMapBuilder()); +// +// Doing so will effectively overwrite the registration below. + +Propel::getDatabaseMap(BaseNagiosTimeperiodPeer::DATABASE_NAME)->addTableBuilder(BaseNagiosTimeperiodPeer::TABLE_NAME, BaseNagiosTimeperiodPeer::getMapBuilder()); + diff --git a/commands.php b/commands.php new file mode 100755 index 0000000..56b0bf8 --- /dev/null +++ b/commands.php @@ -0,0 +1,197 @@ +delete(); + $success = "Command Deleted"; + unset($command); + } +} + +if(isset($_POST['request'])) { + // Load Up The Session Data + + + if($_POST['request'] == 'add_command') { + // Error check for required fields + if(!isset($_POST['command_manage']['command_name'])) { + $error = "You must provide a command name."; + $_GET['command_add'] = 1; + } + else { + // Check for pre-existing command with same name + if($lilac->command_exists($_POST['command_manage']['command_name'])) { + $error = "A command with that name already exists!"; + $_GET['command_add'] = 1; + } + else { + // All is well for error checking, add the command into the db. + $lilac->add_command($_POST['command_manage']); + // Remove session data + unset($command); + $success = "Command added."; + } + } + } + else if($_POST['request'] == 'modify_command') { + $c = new Criteria(); + $c->add(NagiosCommandPeer::NAME, $_POST['command_manage']['command_name']); + $c->setIgnoreCase(true); + $c->add(NagiosCommandPeer::ID, $command->getId(), "!="); + + $duplicate = NagiosCommandPeer::doSelectOne($c); + + if($duplicate && $command->getId() != $duplicate->getId()) { + $error = "A command with that name already exists!"; + } + else { + // All is well for error checking, modify the command. + $command->updateFromArray($_POST['command_manage']); + $command->save(); + $success = "Command modified."; + unset($command); + } + } +} + +// Get list of commands +$lilac->return_command_list($command_list); +$numOfCommands = count($command_list); + +print_header("Nagios Command Editor"); +?> + + + + + + + + + Command Name:
+
+ element_desc("command_name", "nagios_commands_desc"); ?>
+
+ Command Line:
+
+ element_desc("command_line", "nagios_commands_desc"); ?>
+
+ Command Description:
+
+ element_desc("command_desc", "nagios_commands_desc"); ?>
+
+
+ + Delete  Cancel + +  Cancel + +

+ +  Add A New Command
+ +
+ + + + + + + + + + + + + + +
Command NameCommand Description
 getName();?> getDescription();?>
+ +
+
No Commands Exist
+ diff --git a/contactgroups.php b/contactgroups.php new file mode 100755 index 0000000..26e13a4 --- /dev/null +++ b/contactgroups.php @@ -0,0 +1,317 @@ +add(NagiosContactGroupMemberPeer::CONTACT, $_GET['contact_id']); + $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $contactGroupInfo->getId()); + $membership = NagiosContactGroupMemberPeer::doSelectOne($c); + if($membership) { + $membership->delete(); + $success = "Member Deleted"; + } + } + if($_GET['request'] == "delete" && $_GET['section'] == 'general') { + $contactGroupInfo->delete(); + $success = "Contact Group Deleted"; + unset($_GET['contactgroup_id']); + } +} + +if(isset($_POST['request'])) { + + if($_POST['request'] == 'add_contactgroup') { + // Check for pre-existing contact with same name + if($lilac->contactgroup_exists($_POST['contactgroup_manage']['contactgroup_name'])) { + $error = "A contact group with that name already exists!"; + } + else { + // Field Error Checking + if(count($_POST['contactgroup_manage'])) { + foreach($_POST['contactgroup_manage'] as $tempVariable) + $tempVariable = trim($tempVariable); + } + if($_POST['contactgroup_manage']['contactgroup_name'] == '' || $_POST['contactgroup_manage']['alias'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + $lilac->add_contactgroup($_POST['contactgroup_manage']); + $success = "Contact group added."; + } + } + } + else if($_POST['request'] == 'modify_contactgroup') { + if($_POST['contactgroup_manage']['contactgroup_name'] != $contactGroupInfo->getName() && $lilac->contactgroup_exists($_POST['contactgroup_manage']['contactgroup_name'])) { + $error = "A contact group with that name already exists!"; + } + else { + // Field Error Checking + if(count($_POST['contactgroup_manage'])) { + foreach($_POST['contactgroup_manage'] as $tempVariable) + $tempVariable = trim($tempVariable); + } + if($_POST['contactgroup_manage']['contactgroup_name'] == '' || $_POST['contactgroup_manage']['alias'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + // All is well for error checking, modify the contact. + $contactGroupInfo->setName($_POST['contactgroup_manage']['contactgroup_name']); + $contactGroupInfo->setAlias($_POST['contactgroup_manage']['alias']); + $contactGroupInfo->save(); + $success = "Contact group modified."; + unset($_GET['edit']); + } + } + $_GET['section'] = "general"; + } + else if($_POST['request'] == 'add_member_command') { + $c = new Criteria(); + $c->add(NagiosContactGroupMemberPeer::CONTACT, $_POST['contactgroup_manage']['member_add']['contact_id']); + $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $contactGroupInfo->getId()); + if(NagiosContactGroupMemberPeer::doSelectOne($c)) { + $error = "That member already exists in that list!"; + } + else { + $membership = new NagiosContactGroupMember(); + $membership->setContact($_POST['contactgroup_manage']['member_add']['contact_id']); + $membership->setContactgroup($contactGroupInfo->getId()); + $membership->save(); + $success = "New Contact Group Member added."; + } + } +} + +// Get list of contact groups +$lilac->get_contactgroup_list($contactgroups_list); +$numOfContactGroups = count($contactgroups_list); + + +print_header("Contact Group Editor"); + if(isset($_GET['contactgroup_id'])) { + // Build subnav + $subnav = array( + 'general' => 'General', + 'members' => 'Members' + ); + + // PLACEHOLDER TO PUT CONTACT GROUP INFO + print_window_header("Group Info for " . $contactGroupInfo->getName(), "100%"); + print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?contactgroup_id=" . $_GET['contactgroup_id']); + if($_GET['section'] == 'general') { + ?> + + + + + +
+ + + + + + Contact Group Name:
+ element_desc("contactgroup_name", "nagios_contactgroups_desc"); ?>
+
+ Description:
+
+ element_desc("alias", "nagios_contactgroups_desc"); ?>
+
+
+  [ Cancel ] + + + Contact Group Name: getName();?>
+ Description: getAlias();?>
+
+ [ Edit ] + +
+
+ [ Delete This Contact Group ] + add(NagiosContactGroupMemberPeer::CONTACTGROUP, $contactGroupInfo->getId()); + $c->addAscendingOrderByColumn(NagiosContactPeer::NAME); + $member_list = NagiosContactGroupMemberPeer::doSelectJoinNagiosContact($c); + + $numOfMembers = count($member_list); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Members:
 [ Delete ]getNagiosContact()->getName();?>: getNagiosContact()->getAlias();?>
+ get_contact_list($tempList); + $contact_list = array(); + foreach($tempList as $contact) { + $contact_list[] = array('contact_id' => $contact->getId(), 'contact_name' => $contact->getName()); + } + ?> +
+
+
+ + + Add New Member: No Contacts Available

+ element_desc("members", "nagios_contactgroups_desc"); ?>
+
+
+
+ + +  Add A New Contact Group
+
+ + + + + + + + + + + + + + + +
Group NameDescription
 getName();?>getAlias();?>
+ +
No Contact Groups Exist
+
"); + } + + + if(isset($_GET['contactgroup_add'])) { + print_window_header("Add A Contact Group", "100%"); + ?> +
+ + Contact Group Name:
+ element_desc("contactgroup_name", "nagios_contactgroups_desc"); ?>
+
+ Description:
+
+ element_desc("alias", "nagios_contactgroups_desc"); ?>
+
+
+ [ Cancel ] +

+
+ +
+ diff --git a/contacts.php b/contacts.php new file mode 100755 index 0000000..07993f4 --- /dev/null +++ b/contacts.php @@ -0,0 +1,849 @@ +delete_contact_notification_command($_GET['contact_notification_command_id']); + $success = "Command Deleted"; + unset($_GET['command_id']); + unset($tempData); + } + else if($_GET['request'] == "delete" && $_GET['section'] == 'groups') { + $lilac->get_contact_membership_list($_GET['contact_id'], $tempGroupList); + $numOfGroups = count($tempGroupList); + if($numOfGroups > 1) { + $c = new Criteria(); + $c->add(NagiosContactGroupMemberPeer::CONTACT, $_GET['contact_id']); + $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $_GET['contactgroup_id']); + $membership = NagiosContactGroupMemberPeer::doSelectOne($c); + if($membership) { + $membership->delete(); + $success = "Membership Deleted."; + } + } + else { + $error = "There must be at least one contact group!"; + } + } + else if($_GET['request'] == "delete" && $_GET['section'] == 'general') { + $lilac->get_contact_list($tempList); + $numOfContacts = count($tempList); + if($numOfContacts > 1) { + $lilac->delete_contact($_GET['contact_id']); + $success = "Contact deleted."; + unset($tempData); + unset($_GET['contact_id']); + } + else { + $error = "There must be at least one contact in the system."; + } + } + else if($_GET['request'] == "delete" && $_GET['section'] == 'addresses') { + // !!!!!!!!!!!!!! This is where we do dependency error checking + $lilac->delete_contact_address($_GET['contactaddress_id']); + $success = "Contact address deleted."; + unset($tempData); + } + +} + +if(isset($_POST['request'])) { + // Load Up The Session Data + if(count($_POST['contact_manage'])) { + foreach($_POST['contact_manage'] as $key=>$value) { + $tempData[$key] = $value; + } + } + if($_POST['request'] == 'add_contact') { + // Error check! + if(count($tempData)) { + foreach($tempData as $tempVariable) + $tempVariable = trim($tempVariable); + } + // We have checkboxes, let's verify the data against POST + if(!isset($_POST['contact_manage']['host_notification_options_down'])) + $tempData['host_notification_options_down'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) + $tempData['host_notification_options_unreachable'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) + $tempData['host_notification_options_recovery'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) + $tempData['host_notification_options_flapping'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) + $tempData['host_notification_options_scheduled_downtime'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_warning'])) + $tempData['service_notification_options_warning'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) + $tempData['service_notification_options_unknown'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_critical'])) + $tempData['service_notification_options_critical'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) + $tempData['service_notification_options_recovery'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) + $tempData['service_notification_options_flapping'] = 0; + + if(!isset($_POST['contact_manage']['can_submit_commands'])) + $tempData['can_submit_commands'] = 0; + if(!isset($_POST['contact_manage']['retain_status_information'])) + $tempData['retain_status_information'] = 0; + if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) + $tempData['retain_nonstatus_information'] = 0; + + if(!isset($_POST['contact_manage']['host_notifications_enabled'])) + $tempData['host_notifications_enabled'] = 0; + if(!isset($_POST['contact_manage']['service_notifications_enabled'])) + $tempData['service_notifications_enabled'] = 0; + + // Field Error Checking + if($tempData['contact_name'] == '' || $tempData['alias'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + // Check for pre-existing contact with same name + if($lilac->contact_exists($tempData['contact_name'])) { + $error = "A contact with that name already exists!"; + } + else { + $tempContactGroup = $tempData['contact_group']; + unset($tempData['contact_group']); + // All is well for error checking, add the contact into the db. + + $contact = $lilac->add_contact($tempData); + + $success = "Contact added"; + if( $tempContactGroup && $tempContactGroup != 0) { + $contactGroup = NagiosContactGroupPeer::retrieveByPK($tempContactGroup); + if($contactGroup && $contact) { + $contactGroupMember = new NagiosContactGroupMember(); + $contactGroupMember->setContact($contact->getId()); + $contactGroupMember->setContactgroup($contactGroup->getId()); + $contactGroupMember->save(); + } + } + unset($_GET['contact_add']); + + } + } + } + else if($_POST['request'] == 'modify_contact') { + // Error check! + if(count($tempData)) { + foreach($tempData as $tempVariable) + $tempVariable = trim($tempVariable); + } + // We have checkboxes, let's verify the data against POST + if(!isset($_POST['contact_manage']['host_notification_options_down'])) + $tempData['host_notification_options_down'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) + $tempData['host_notification_options_unreachable'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) + $tempData['host_notification_options_recovery'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) + $tempData['host_notification_options_flapping'] = 0; + if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) + $tempData['host_notification_options_scheduled_downtime'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_warning'])) + $tempData['service_notification_options_warning'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) + $tempData['service_notification_options_unknown'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_critical'])) + $tempData['service_notification_options_critical'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) + $tempData['service_notification_options_recovery'] = 0; + if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) + $tempData['service_notification_options_flapping'] = 0; + if(!isset($_POST['contact_manage']['can_submit_commands'])) + $tempData['can_submit_commands'] = 0; + if(!isset($_POST['contact_manage']['retain_status_information'])) + $tempData['retain_status_information'] = 0; + if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) + $tempData['retain_nonstatus_information'] = 0; + + if(!isset($_POST['contact_manage']['host_notifications_enabled'])) + $tempData['host_notifications_enabled'] = 0; + if(!isset($_POST['contact_manage']['service_notifications_enabled'])) + $tempData['service_notifications_enabled'] = 0; + + // Field Error Checking + if($tempData['contact_name'] == '' || $tempData['alias'] == '') { + $addError = 1; + $error = "Fields shown are required and cannot be left blank."; + } + else { + if($tempData['contact_name'] != $tempContactInfo->getName() && $lilac->contact_exists($tempData['contact_name'])) { + $error = "A contact with that name already exists!"; + } + else { + // All is well for error checking, modify the contact. + $lilac->modify_contact($_POST['contact_id'], $tempData); + // Remove session data + unset($tempData); + $success = "Contact modified."; + unset($_GET['edit']); + } + $_GET['section'] = "general"; + } + } + else if($_POST['request'] == 'add_notification_command') { + if($lilac->contact_has_notification_command($_GET['contact_id'], $tempData['notification_add'])) { + $error = "That notification command already exists in that list!"; + unset($tempData); + } + else { + $lilac->add_contacts_notification_command($_GET['contact_id'], $tempData['notification_add']); + $success = "Notification Command added."; + unset($tempData); + } + } + else if($_POST['request'] == 'add_member_command') { + if($lilac->contactgroup_has_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id'])) { + $error = "That member already exists in that list!"; + unset($tempData); + } + else { + $lilac->add_contactgroup_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id']); + $success = "New Group membership added."; + unset($tempData); + } + } + else if($_POST['request'] == 'contact_address_add') { + // All is well for error checking, modify the contact. + $lilac->add_contact_address($_GET['contact_id'], $tempData); + // Remove session data + unset($tempData); + $success = "Contact Address added."; + } +} + +if(isset($_GET['contact_id'])) { + $tempContactInfo = NagiosContactPeer::retrieveByPK($_GET['contact_id']); + if(!$tempContactInfo) { + header("Location: welcome.php"); + } +} + + +$lilac->get_contact_list($contact_list); +$numOfContacts = count($contact_list); + +$lilac->return_period_list($tempList); +$period_list = array(); +foreach($tempList as $tempPeriod) { + $period_list[] = array("timeperiod_id" => $tempPeriod->getId(), "timeperiod_name" => $tempPeriod->getName()); +} + + + +print_header("Contact Editor"); +?> + 'General', + 'notification' => 'Notification Commands', + 'groups' => 'Group Membership', + 'addresses' => 'Addresses' + + ); + + // PLACEHOLDER TO PUT CONTACT INFO + print_window_header("Contact Info for " . $tempContactInfo->getName(), "100%"); + print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?contact_id=" . $tempContactInfo->getId()); + if($_GET['section'] == 'general') { + ?> + + + + + +
+ + + +
+ + + + + + + Contact Name:
+ element_desc("contact_name", "nagios_contacts_desc"); ?>
+
+ Description:
+
+ element_desc("alias", "nagios_contacts_desc"); ?>
+
+ getCanSubmitCommands() == 1) ? "CHECKED" : '');?>>Can Submit Commands
+
+ getRetainStatusInformation() == 1) ? "CHECKED" : '');?>>Retain Status Information
+
+ getRetainNonstatusInformation() == 1) ? "CHECKED" : '');?>>Retain Non-Status Information
+
+ + getHostNotificationsEnabled() == 1) ? "CHECKED" : '');?>>Host Notifications Enabled
+
+ getServiceNotificationsEnabled() == 1) ? "CHECKED" : '');?>>Service Notifications Enabled
+
+ Host Notification Period: getHostNotificationPeriod() != null) ? $tempContactInfo->getHostNotificationPeriod() : '');?>
+ element_desc("host_notification_period", "nagios_contacts_desc"); ?>
+
+ Service Notification Period: getHostNotificationPeriod() != null) ? $tempContactInfo->getServiceNotificationPeriod() : '');?>
+ element_desc("service_notification_period", "nagios_contacts_desc"); ?>
+
+ Host Notification Options: + + + + + +
+ getHostNotificationOnDown() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_down]" value="1">Down
+ getHostNotificationOnUnreachable() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_unreachable]" value="1">Unreachable
+ getHostNotificationOnRecovery() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_recovery]" value="1">Recovery
+ getHostNotificationOnFlapping() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_flapping]" value="1">Flapping
+ getHostNotificationOnScheduledDowntime() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_scheduled_downtime]" value="1">Scheduled Downtime
+
element_desc("host_notification_options", "nagios_contacts_desc"); ?>
+
+ Service Notification Options: + + + + + +
+ getServiceNotificationOnWarning() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_warning]" value="1">Warning
+ getServiceNotificationOnUnknown() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_unknown]" value="1">Unknown
+ getServiceNotificationOnCritical() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_critical]" value="1">Critical
+ getServiceNotificationOnRecovery() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_recovery]" value="1">Recovery
+ getServiceNotificationOnFlapping() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_flapping]" value="1">Flapping
+
element_desc("service_notification_options", "nagios_contacts_desc"); ?>
+
+ + Email:
+
+ element_desc("email", "nagios_contacts_desc"); ?>
+
+ Pager:
+
+  [ Cancel ] +
+ + Contact Name: getName();?>
+ Description: getAlias();?>
+ Email: getEmail();?>
+ Pager: getPager();?>
+
+ Can Submit Commands:getCanSubmitCommands()) ? "Yes" : "No";?>
+ Retain Status Information:getRetainStatusInformation()) ? "Yes" : "No";?>
+ Retain Non-Status Information:getRetainNonstatusInformation()) ? "Yes" : "No";?>
+
+ Host Notifications Enabled:getHostNotificationsEnabled()) ? "Yes" : "No";?>
+ Service Notifications Enabled:getServiceNotificationsEnabled()) ? "Yes" : "No";?>
+
+ Host Notification Period: return_period_name($tempContactInfo->getHostNotificationPeriod());?>
+ Service Notification Period: return_period_name($tempContactInfo->getServiceNotificationPeriod());?>
+ Host Notification On: + getHostNotificationOnDown() && !$tempContactInfo->getHostNotificationOnUnreachable() && !$tempContactInfo->getHostNotificationOnRecovery() && !$tempContactInfo->getHostNotificationOnFlapping() && !$tempContactInfo->getHostNotificationOnScheduledDowntime()) { + print("None"); + } + else { + if($tempContactInfo->getHostNotificationOnDown()) { + print("Down"); + if($tempContactInfo->getHostNotificationOnUnreachable() || $tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) + print(","); + } + if($tempContactInfo->getHostNotificationOnUnreachable()) { + print("Unreachable"); + if($tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) + print(","); + } + if($tempContactInfo->getHostNotificationOnRecovery()) { + print("Recovery"); + if($tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) + print(","); + } + if($tempContactInfo->getHostNotificationOnFlapping()) { + print("Flapping"); + if($tempContactInfo->getHostNotificationOnScheduledDowntime()) + print(","); + } + if($tempContactInfo->getHostNotificationOnScheduledDowntime()) { + print("Scheduled Downtime"); + } + } + ?> +
+ Service Notification On: + getServiceNotificationOnWarning() && !$tempContactInfo->getServiceNotificationOnUnknown() && !$tempContactInfo->getServiceNotificationOnCritical() && !$tempContactInfo->getServiceNotificationOnRecovery()) + print("None"); + else { + if($tempContactInfo->getServiceNotificationOnWarning()) { + print("Warning"); + if($tempContactInfo->getServiceNotificationOnUnknown() || $tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) + print(","); + } + if($tempContactInfo->getServiceNotificationOnUnknown()) { + print("Unknown"); + if($tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) + print(","); + } + if($tempContactInfo->getServiceNotificationOnCritical()) { + print("Critical"); + if($tempContactInfo->getServiceNotificationOnRecovery() || $tempContactInfo->getServiceNotificationOnFlapping()) + print(","); + } + if($tempContactInfo->getServiceNotificationOnRecovery()) { + print("Recovery"); + if($tempContactInfo->getServiceNotificationOnFlapping()) + print(","); + } + if($tempContactInfo->getServiceNotificationOnFlapping()) { + print("Flapping"); + } + } + ?> +
+
+ [ Edit ] + +
+
+ [ Delete This Contact ] + return_command_list($tempList); + foreach($tempList as $command) { + $command_list[] = array("command_id" => $command->getId(), "command_name" => $command->getName()); + } + + $numOfHostCommands = 0; + $numOfServiceCommands = 0; + $lilac->get_contacts_notification_commands($_GET['contact_id'], $contactNotificationCommands); + if(isset($contactNotificationCommands['host'])) + $numOfHostCommands = count($contactNotificationCommands['host']); + if(isset($contactNotificationCommands['service'])) + $numOfServiceCommands = count($contactNotificationCommands['service']); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Host Notification Commands:
 [ Delete ]getNagiosCommand()->getName();?>
+
+
+
+ + + + Add New Host Notification Command: No Commands Available

+ element_desc("host_notification_commands", "nagios_contacts_desc"); ?>
+
+
+
+ + + + + + + + + + + + + +
Service Notification Commands:
 [ Delete ]getNagiosCommand()->getName();?>
+
+
+
+ + + + Add New Service Notification Command: No Commands Available

+ element_desc("service_notification_commands", "nagios_contacts_desc"); ?>
+
+
+
+ get_contact_membership_list($_GET['contact_id'], $group_list); + $numOfGroups = count($group_list); + // Get list of contact groups + $lilac->get_contactgroup_list($tempList); + $contactgroups_list = array(); + foreach($tempList as $contactgroup) { + $contactgroups_list[] = array('contactgroup_id' => $contactgroup->getId(), 'contactgroup_name' => $contactgroup->getName()); + } + $numOfContactGroups = count($contactgroups_list); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Contact Group Membership:
 [ Delete ]getNagiosContactGroup()->getName();?>: getNagiosContactGroup()->getAlias();?>
+
+
+
+ + + Add New Group Membership: No Contact Groups Available

+ element_desc("members", "nagios_contactgroups_desc"); ?>
+
+
+
+ get_contact_addresses($_GET['contact_id'], $contactAddresses); + $numOfAddresses = count($contactAddresses); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Additional Addresses:
 [ Delete ]$CONTACTADDRESS$: getAddress();?>
+ +
+
+
+ + + Value for $CONTACTADDRESS$:
+ element_desc("address", "nagios_contacts_desc"); ?>
+
+ +
+
+ +
+
+ +  Add A New Contact
+
+ + + + + + + + + + + + + + + +
Contact NameDescription
 getName();?>getAlias();?>
+ +
No Contacts Exist
+ get_contactgroup_list($tempList); + $contactgroups_list = array(); + foreach($tempList as $contactgroup) { + $contactgroups_list[] = array('contactgroup_id' => $contactgroup->getId(), 'contactgroup_name' => $contactgroup->getName()); + } + + + + $contactgroups_list = array_merge( array( array( 'contactgroup_id'=>0, 'contactgroup_name'=>"None")), $contactgroups_list); + print_window_header("Add A Contact", "100%"); + ?> +
+ + + + + + + Contact Name:
+ element_desc("contact_name", "nagios_contacts_desc"); ?>
+
+ Description:
+
+ element_desc("alias", "nagios_contacts_desc"); ?>
+
+ Host Notification Period:
+ element_desc("host_notification_period", "nagios_contacts_desc"); ?>
+
+ Service Notification Period:
+ element_desc("service_notification_period", "nagios_contacts_desc"); ?>
+
+ Can Submit Commands
+
+ Retain Status Information
+
+ Retain Non-Status Information
+ +
+ Host Notifications Enabled
+
+ Service Notifications Enabled
+
+ + Host Notification Options: + + + + + +
+ Down
+ Unreachable
+ Recovery
+ Flapping
+ Scheduled Downtime
+
element_desc("host_notification_options", "nagios_contacts_desc"); ?>
+
+ Service Notification Options: + + + + + +
+ Warning
+ Unknown
+ Critical
+ Recovery
+ Flapping
+
element_desc("service_notification_options", "nagios_contacts_desc"); ?>
+
+ Initial Contact Group:
+ element_desc("members", "nagios_contactgroups_desc"); ?>
+
+ Email:
+
+ element_desc("email", "nagios_contacts_desc"); ?>
+
+ Pager:
+
+ element_desc("pager", "nagios_contacts_desc"); ?>
+
+
+  [ Cancel ] +
+

+ +
+ diff --git a/dependency.php b/dependency.php new file mode 100755 index 0000000..511971a --- /dev/null +++ b/dependency.php @@ -0,0 +1,875 @@ +add(NagiosHostPeer::NAME, $_GET['q']."%", Criteria::LIKE); + $c->setIgnoreCase(true); + $results = NagiosHostPeer::doSelect($c); + break; + case 'hostgroup': + $c = new Criteria(); + $c->add(NagiosHostgroupPeer::NAME, $_GET['q']."%", Criteria::LIKE); + $c->setIgnoreCase(true); + $results = NagiosHostgroupPeer::doSelect($c); + case 'service': + // Get the host + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $_GET['host']); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + $returnObj = array(); + if(!$host) { + $returnObj['error'] = "Host " . $_GET['host'] . " not found."; + print(json_encode($returnObj)); + exit(); + } + else { + $returnObj['services'] = array(); + // Okay, let's get services. + $services = $host->getNagiosServices(); + foreach($services as $service) { + if(!in_array($service->getDescription(), $returnObj['services'])) + $returnObj['services'][] = $service->getDescription(); + } + $inherited_services = $host->getInheritedServices(); + foreach($inherited_services as $service) { + if(!in_array($service->getDescription(), $returnObj['services'])) + $returnObj['services'][] = $service->getDescription(); + } + + if(count($returnObj['services']) == 0) { + $returnObj['error'] = "No services for that host."; + } + print(json_encode($returnObj)); + exit(); + } + + } + + foreach($results as $result) { + print($result->getName() . "\n"); + } + exit(); +} + + +// Data preparation +if(!isset($_GET['section'])) + $_GET['section'] = 'general'; + +// If we're going to modify dependency data +if(isset($_GET['id'])) { + $dependency = NagiosDependencyPeer::retrieveByPK($_GET['id']); + if(!$dependency) { + header("Location: welcome.php"); + } +} + + + +// Action Handlers +if(isset($_GET['request'])) { + if($_GET['request'] == "delete" && $_GET['section'] == "targets") { + $target = NagiosDependencyTargetPeer::retrieveByPK($_GET['target_id']); + if(!$target) { + $error = "That target was not found."; + } + else if($target->getNagiosDependency()->getId() != $dependency->getId()) { + $error = "That target does not belong to this dependency."; + } + else { + // Okay, let's delete. + $target->delete(); + $success = "Target deleted."; + } + } + +} +if(isset($_POST['request'])) { + if($_POST['request'] == 'dependency_modify_general') { + // Field Error Checking + + if(isset($_POST['dependency_manage']['inherits_parent'])) { + $dependency->setInheritsParent(true); + } + else { + $dependency->setInheritsParent(false); + } + if($_POST['dependency_manage']['dependency_period'] == '') { + $dependency->setDependencyPeriod(null); + } + else { + $dependency->setDependencyPeriod($_POST['dependency_manage']['dependency_period']); + } + // Execution criteria + if(isset($_POST['dependency_manage']['execution_failure_criteria_up'])) { + $dependency->setExecutionFailureCriteriaUp(true); + } + else { + $dependency->setExecutionFailureCriteriaUp(false); + } + if(isset($_POST['dependency_manage']['execution_failure_criteria_down'])) { + $dependency->setExecutionFailureCriteriaDown(true); + } + else { + $dependency->setExecutionFailureCriteriaDown(false); + } + + if(isset($_POST['dependency_manage']['execution_failure_criteria_unreachable'])) { + $dependency->setExecutionFailureCriteriaUnreachable(true); + } + else { + $dependency->setExecutionFailureCriteriaUnreachable(false); + } + + if(isset($_POST['dependency_manage']['execution_failure_criteria_pending'])) { + $dependency->setExecutionFailureCriteriaPending(true); + } + else { + $dependency->setExecutionFailureCriteriaPending(false); + } + if(isset($_POST['dependency_manage']['execution_failure_criteria_ok'])) { + $dependency->setExecutionFailureCriteriaOk(true); + } + else { + $dependency->setExecutionFailureCriteriaOk(false); + } + if(isset($_POST['dependency_manage']['execution_failure_criteria_warning'])) { + $dependency->setExecutionFailureCriteriaWarning(true); + } + else { + $dependency->setExecutionFailureCriteriaWarning(false); + } + if(isset($_POST['dependency_manage']['execution_failure_criteria_unknown'])) { + $dependency->setExecutionFailureCriteriaUnknown(true); + } + else { + $dependency->setExecutionFailureCriteriaUnknown(false); + } + if(isset($_POST['dependency_manage']['execution_failure_criteria_critical'])) { + $dependency->setExecutionFailureCriteriaCritical(true); + } + else { + $dependency->setExecutionFailureCriteriaCritical(false); + } + + + + // Notification criteria + if(isset($_POST['dependency_manage']['notification_failure_criteria_up'])) { + $dependency->setNotificationFailureCriteriaUp(true); + } + else { + $dependency->setNotificationFailureCriteriaUp(false); + } + if(isset($_POST['dependency_manage']['notification_failure_criteria_down'])) { + $dependency->setNotificationFailureCriteriaDown(true); + } + else { + $dependency->setNotificationFailureCriteriaDown(false); + } + + if(isset($_POST['dependency_manage']['notification_failure_criteria_unreachable'])) { + $dependency->setNotificationFailureCriteriaUnreachable(true); + } + else { + $dependency->setNotificationFailureCriteriaUnreachable(false); + } + + if(isset($_POST['dependency_manage']['notification_failure_criteria_pending'])) { + $dependency->setNotificationFailureCriteriaPending(true); + } + else { + $dependency->setNotificationFailureCriteriaPending(false); + } + if(isset($_POST['dependency_manage']['notification_failure_criteria_ok'])) { + $dependency->setNotificationFailureCriteriaOk(true); + } + else { + $dependency->setNotificationFailureCriteriaOk(false); + } + if(isset($_POST['dependency_manage']['notification_failure_criteria_warning'])) { + $dependency->setNotificationFailureCriteriaWarning(true); + } + else { + $dependency->setNotificationFailureCriteriaWarning(false); + } + if(isset($_POST['dependency_manage']['notification_failure_criteria_unknown'])) { + $dependency->setNotificationFailureCriteriaUnknown(true); + } + else { + $dependency->setNotificationFailureCriteriaUnknown(false); + } + if(isset($_POST['dependency_manage']['notification_failure_criteria_critical'])) { + $dependency->setNotificationFailureCriteriaCritical(true); + } + else { + $dependency->setNotificationFailureCriteriaCritical(false); + } + + $dependency->save(); + $success = "Dependency modified."; + unset($_GET['edit']); + } + else if($_POST['request'] == 'add_target') { + $type = $dependency->getType(); + if($type == "host" || $type == "hosttemplate" || $type == "hostgroup") { + if($_POST['typeselect'] == "host") { + // First find the host + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $_POST['name']); + $c->setIgnoreCase(true); + $tempHost = NagiosHostPeer::doSelectOne($c); + if(!$tempHost) { + $error = "The host specified by name " . $_POST['name'] . " was not found."; + } + else { + // Check for target existence + $c = new Criteria(); + $c->add(NagiosDependencyTargetPeer::DEPENDENCY, $dependency->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_HOST, $tempHost->getId()); + $target = NagiosDependencyTargetPeer::doSelectOne($c); + if($target) { + $error = "That target already exists."; + } + else { + // Add the target. + $target = new NagiosDependencyTarget(); + $target->setNagiosDependency($dependency); + $target->setNagiosHost($tempHost); + $target->save(); + $success = "Created target."; + } + } + } + else if($_POST['typeselect'] == "hostgroup") { + // First find the hostgroup + $c = new Criteria(); + $c->add(NagiosHostgroupPeer::NAME, $_POST['name']); + $c->setIgnoreCase(true); + $tempHostgroup = NagiosHostgroupPeer::doSelectOne($c); + if(!$tempHostgroup) { + $error = "The hostgroup specified by name " . $_POST['name'] . " was not found."; + } + else { + // Check for target existence + $c = new Criteria(); + $c->add(NagiosDependencyTargetPeer::DEPENDENCY, $dependency->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_HOSTGROUP, $tempHostgroup->getId()); + $target = NagiosDependencyTargetPeer::doSelectOne($c); + if($target) { + $error = "That target already exists."; + } + else { + // Add the target. + $target = new NagiosDependencyTarget(); + $target->setNagiosDependency($dependency); + $target->setNagiosHostgroup($tempHostgroup); + $target->save(); + $success = "Created target."; + } + } + } + } + else { + // Get the host + $c = new Criteria(); + $c->add(NagiosHostPeer::NAME, $_POST['hostname']); + $c->setIgnoreCase(true); + $host = NagiosHostPeer::doSelectOne($c); + if(!$host) { + $error = "The host specified by name " . $_POST['hostname'] . " was not found."; + } + else { + // Okay, let's find the service + $services = $host->getNagiosServices(); + $found = false; + foreach($services as $service) { + if($service->getDescription() == $_POST['service_select']) { + // We found it! Regular service target. + // Check for existence + $c = new Criteria(); + $c->add(NagiosDependencyTargetPeer::DEPENDENCY, $dependency->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_HOST, $host->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $service->getId()); + $target = NagiosDependencyTargetPeer::doSelectOne($c); + if($target) { + $error = "That target already exists."; + } + else { + $target = new NagiosDependencyTarget(); + $target->setNagiosDependency($dependency); + $target->setNagiosHost($host); + $target->setNagiosService($service); + $target->save(); + $success = "Created target."; + $found = true; + break; + } + } + } + if(!$found) { + // Check inherited services + $inheritedServices = $host->getInheritedServices(); + foreach($inheritedServices as $service) { + if($service->getDescription() == $_POST['service_select']) { + // We found it! + // Check for existence + $c = new Criteria(); + $c->add(NagiosDependencyTargetPeer::DEPENDENCY, $dependency->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_HOST, $host->getId()); + $c->add(NagiosDependencyTargetPeer::TARGET_SERVICE, $service->getId()); + $target = NagiosDependencyTargetPeer::doSelectOne($c); + if($target) { + $error = "That target already exists."; + } + else { + $target = new NagiosDependencyTarget(); + $target->setNagiosDependency($dependency); + $target->setNagiosHost($host); + $target->setNagiosService($service); + $target->save(); + $success = "Created target."; + $found = true; + break; + } + } + } + } + } + } + } + +} + +$period_list = array(); +$lilac->return_period_list($tempList); +$period_list[] = array("timeperiod_id" => '', "timeperiod_name" => 'Active Always'); +foreach($tempList as $period) { + $period_list[] = array("timeperiod_id" => $period->getId(), "timeperiod_name" => $period->getName()); +} + + +$title = ''; +if($dependency->getNagiosService() || $dependency->getNagiosServiceTemplate()) { + $title .= "Service "; + if($dependency->getNagiosServiceTemplate()) { + $title .= "Template " . $dependency->getNagiosServiceTemplate()->getName() . ""; + $sublink = "service_template.php?id=" . $dependency->getNagiosServiceTemplate()->getId(); + $subText = "Return To Service Template " . $dependency->getNagiosServiceTemplate()->getName(); + } + else { + $title .= "" . $dependency->getNagiosService()->getDescription() . " On "; + if($dependency->getNagiosService()->getNagiosHostTemplate()) { + $title .= " Host Template " . $dependency->getNagiosService()->getNagiosHostTemplate()->getName() . ""; + } + else if($dependency->getNagiosService()->getNagiosHost()) { + $title .= "Host " . "" . $dependency->getNagiosService()->getNagiosHost()->getName() . ""; + } + $sublink = "service.php?id=" . $dependency->getNagiosService()->getId(); + $subText = "Return To Service " . $dependency->getNagiosService()->getDescription(); + } +} +else { + if($dependency->getNagiosHostTemplate()) { + $title .= "Host Template " . $dependency->getNagiosHostTemplate()->getName() . ""; + $sublink = "host_template.php?id=" . $dependency->getNagiosHostTemplate()->getId(); + $subText = "Return To Host Template " . $dependency->getNagiosHostTemplate()->getName(); + } + else if($dependency->getNagiosHost()) { + $title .= "Host " . $dependency->getNagiosHost()->getName() . ""; + $sublink = "hosts.php?id=" . $dependency->getNagiosHost()->getId(); + $subText = "Return To Host " . $dependency->getNagiosHost()->getName(); + } + else if($dependency->getNagiosHostgroup()) { + $title .= "Hostgroup " . $dependency->getNagiosHostgroup()->getName() . ""; + $sublink = "hostgroups.php?id=" . $dependency->getNagiosHostgroup()->getId(); + $subText = "Return To Hostgroup " . $dependency->getNagiosHostgroup()->getName(); + } + +} + + +print_header("Dependency Editor for " . strip_tags($title)); +?> + +getName(); + + // Build subnav + $subnav = array( + 'general' => 'General', + 'targets' => 'Targets' + ); + + print_window_header($titlebar, "100%"); + print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?id=" . $_GET['id']); + if($_GET['section'] == 'general') { + if(!$dependency->getNagiosService()) + $dependency_image = $path_config['image_root'] . "server.gif"; + else + $dependency_image = $path_config['image_root'] . "services.gif"; + ?> + + + + + +
+ + + +
+ + + + + + + +
+ getInheritsParent() == 1) ? "CHECKED" : '');?> name="dependency_manage[inherits_parent]" value="1">Inherits Parents
+
element_desc("inherits_parent", "nagios_dependency_desc"); ?>
+ getService() !== null || $dependency->getServiceTemplate() !== null) { // It's a service dependency + ?> + + + + + + + + +
+ Execution Failure Criteria +
+ getExecutionFailureCriteriaOk() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_ok]" value="1">Ok
+ getExecutionFailureCriteriaWarning() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_warning]" value="1">Warning
+ getExecutionFailureCriteriaUnknown() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_unknown]" value="1">Unknown
+ getExecutionFailureCriteriaCritical() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_critical]" value="1">Critical
+ getExecutionFailureCriteriaPending() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_pending]" value="1">Pending
+
element_desc("service_execution_failure_criteria", "nagios_dependency_desc"); ?>
+ + + + + + + + + +
+ Notification Failure Criteria +
+ getNotificationFailureCriteriaOk() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_ok]" value="1">Ok
+ getNotificationFailureCriteriaWarning() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_warning]" value="1">Warning
+ getNotificationFailureCriteriaUnknown() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_unknown]" value="1">Unknown
+ getNotificationFailureCriteriaCritical() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_critical]" value="1">Critical
+ getNotificationFailureCriteriaPending() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_pending]" value="1">Pending
+
element_desc("service_execution_failure_criteria", "nagios_dependency_desc"); ?>
+ + + + + + + + + + +
+ Execution Failure Criteria +
+ getExecutionFailureCriteriaUp() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_up]" value="1">Up
+ getExecutionFailureCriteriaDown() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_down]" value="1">Down
+ getExecutionFailureCriteriaUnreachable() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_unreachable]" value="1">Unreachable
+ getExecutionFailureCriteriaPending() == 1) ? "CHECKED" : '');?> name="dependency_manage[execution_failure_criteria_pending]" value="1">Pending
+
element_desc("host_execution_failure_criteria", "nagios_dependency_desc"); ?>
+ + + + + + + + + +
+ Notification Failure Criteria +
+ getNotificationFailureCriteriaUp() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_up]" value="1">Up
+ getNotificationFailureCriteriaDown() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_down]" value="1">Down
+ getNotificationFailureCriteriaUnreachable() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_unreachable]" value="1">Unreachable
+ getNotificationFailureCriteriaPending() == 1) ? "CHECKED" : '');?> name="dependency_manage[notification_failure_criteria_pending]" value="1">Pending
+
element_desc("host_execution_failure_criteria", "nagios_dependency_desc"); ?>
+ + + Dependency Period
+ getDependencyPeriod()); ?>
+ element_desc("dependency_period", "nagios_dependency_desc")); ?> + + +
+
+ [ Cancel ] + + Included In Definition:
+ getInheritsParent() !== null) { + ?> + Inherits Parent: getInheritsParent()) print("Yes"); else print("No");?>
+ getExecutionFailureCriteriaUp() !== null || $dependency->getExecutionFailureCriteriaOk() !== null) { + ?> + Execution Failure Criteria On: + getExecutionFailureCriteriaUp()) { + print("Up"); + if($dependency->getExecutionFailureCriteriaDown() || $dependency->getExecutionFailureCriteriaUnreachable() || $dependency->getExecutionFailureCriteriaOk() || $dependency->getExecutionFailureCriteriaWarning() || $dependency->getExecutionFailureCriteriaUnknown() || $dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaDown()) { + print("Down"); + if($dependency->getExecutionFailureCriteriaUnreachable() || $dependency->getExecutionFailureCriteriaOk() || $dependency->getExecutionFailureCriteriaWarning() || $dependency->getExecutionFailureCriteriaUnknown() || $dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaUnreachable()) { + print("Unreachable"); + if($dependency->getExecutionFailureCriteriaOk() || $dependency->getExecutionFailureCriteriaWarning() || $dependency->getExecutionFailureCriteriaUnknown() || $dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaOk()) { + print("Ok"); + if($dependency->getExecutionFailureCriteriaWarning() || $dependency->getExecutionFailureCriteriaUnknown() || $dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaWarning()) { + print("Warning"); + if($dependency->getExecutionFailureCriteriaUnknown() || $dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaUnknown()) { + print("Unknown"); + if($dependency->getExecutionFailureCriteriaCritical() || $dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaCritical()) { + print("Critical"); + if($dependency->getExecutionFailureCriteriaPending()) + print(","); + } + if($dependency->getExecutionFailureCriteriaPending()) { + print("Pending"); + } + print("
"); + } + if($dependency->getNotificationFailureCriteriaUp() !== null || $dependency->getExecutionFailureCriteriaOk() !== null) { + ?> + Notification Failure Criteria On: + getNotificationFailureCriteriaUp()) { + print("Up"); + if($dependency->getNotificationFailureCriteriaDown() || $dependency->getNotificationFailureCriteriaUnreachable() || $dependency->getNotificationFailureCriteriaOk() || $dependency->getNotificationFailureCriteriaWarning() || $dependency->getNotificationFailureCriteriaUnknown() || $dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaDown()) { + print("Down"); + if($dependency->getNotificationFailureCriteriaUnreachable() || $dependency->getNotificationFailureCriteriaOk() || $dependency->getNotificationFailureCriteriaWarning() || $dependency->getNotificationFailureCriteriaUnknown() || $dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaUnreachable()) { + print("Unreachable"); + if($dependency->getNotificationFailureCriteriaOk() || $dependency->getNotificationFailureCriteriaWarning() || $dependency->getNotificationFailureCriteriaUnknown() || $dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaOk()) { + print("Ok"); + if($dependency->getNotificationFailureCriteriaWarning() || $dependency->getNotificationFailureCriteriaUnknown() || $dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaWarning()) { + print("Warning"); + if($dependency->getNotificationFailureCriteriaUnknown() || $dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaUnknown()) { + print("Unknown"); + if($dependency->getNotificationFailureCriteriaCritical() || $dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaCritical()) { + print("Critical"); + if($dependency->getNotificationFailureCriteriaPending()) + print(","); + } + if($dependency->getNotificationFailureCriteriaPending()) { + print("Pending"); + } + print("
"); + } + if(!$dependency->getDependencyPeriod()) { + print("Dependency Period: Always Active"); + } + else { + print("Dependency Period: " . $dependency->getNagiosTimeperiod()->getName()); + } + ?> +
+ [ Edit ] + +
+
+ + getNagiosDependencyTargets(); + $numOfTargets = count($targets_list); + ?> + + + + + +
+ + + + + + + + + + + + + + +
Targets for this Dependency:
 [ Delete ]getType()) { + case 'host': + print("Host: " . $target->getNagiosHost()->getName()); + break; + case 'hostgroup': + print("Hostgroup: " . $target->getNagiosHostgroup()->getName()); + break; + case 'service': + print("Service: " . $target->getNagiosHost()->getName() . " - " . $target->getNagiosService()->getDescription()); + break; + + };?> +
+
+
+

Add A Target:

+ getType(); + if(in_array($type, array("host", "hosttemplate", "hostgroup"))) { + ?> + + + + + + + + + + + +
TypeName
+ + + + + +
+ + Select either Host or Hostgroup from the Type dropdown, and begin typing the name of the host/hostgroup. Select the matched host/hostgroup you want to be dependent on and click on Add Target. + +
+ + + + + + + + + + + +
Host NameService Name
+ + + +
+
+ +
+
+ + + + +
+
+ +
+ diff --git a/escalation.php b/escalation.php new file mode 100755 index 0000000..a1d4257 --- /dev/null +++ b/escalation.php @@ -0,0 +1,582 @@ +return_period_list($tempList); +foreach($tempList as $period) { + $period_list[] = array("timeperiod_id" => $period->getId(), "timeperiod_name" => $period->getName()); +} + + +if(isset($_GET['request'])) { + if($_GET['request'] == "delete" && $_GET['section'] == 'contacts') { + if(!empty($_GET['contactgroup_id'])) { + $membership = NagiosEscalationContactgroupPeer::retrieveByPK($_GET['contactgroup_id']); + if($membership) { + $membership->delete(); + $success = "Contact Group Deleted"; + } + } + else if(!empty($_GET['contact_id'])) { + $c = new Criteria(); + $c->add(NagiosEscalationContactPeer::ESCALATION, $_GET['id']); + $c->add(NagiosEscalationContactPeer::CONTACT, $_GET['contact_id']); + $membership = NagiosEscalationContactPeer::doSelectOne($c); + if($membership) { + $membership->delete(); + $success = "Contact deleted."; + } + } + unset($_GET['request']); + } +} + +// Action Handlers +if(isset($_POST['request'])) { + + + if($_POST['request'] == 'escalation_modify_general') { + // Field Error Checking + if(count($_POST['escalation_manage'])) { + foreach($_POST['escalation_manage'] as $tempVariable) + $tempVariable = trim($tempVariable); + } + if((isset($_POST['escalation_manage_enablers']['first_notification']) && !is_numeric($_POST['escalation_manage']['first_notification'])) || + (isset($_POST['escalation_manage_enablers']['first_notification']) && !($_POST['escalation_manage']['first_notification'] >= 1)) || + (isset($_POST['escalation_manage_enablers']['last_notification']) && !is_numeric($_POST['escalation_manage']['last_notification'])) || + (isset($_POST['escalation_manage_enablers']['last_notification']) && !($tempData['service_manage']['last_notification'] >= 1)) || + (isset($_POST['escalation_manage_enablers']['notification_interval']) && !is_numeric($tempData['service_manage']['notification_interval'])) || + (isset($_POST['escalation_manage_enablers']['notification_interval']) && !($tempData['service_manage']['notification_interval'] >= 1)) ) { + $error = "Incorrect values for fields. Please verify."; + } + + + if($escalation) { + $escalation->setDescription($_POST['escalation_manage']['escalation_description']); + $escalation->setFirstNotification($_POST['escalation_manage']['first_notification']); + $escalation->setLastNotification($_POST['escalation_manage']['last_notification']); + $escalation->setNotificationInterval($_POST['escalation_manage']['notification_interval']); + $escalation->setEscalationPeriod($_POST['escalation_manage']['escalation_period']); + + if(isset($_POST['escalation_manage']['escalation_options_down'])) { + $escalation->setEscalationOptionsDown(true); + } + else { + $escalation->setEscalationOptionsDown(false); + } + if(isset($_POST['escalation_manage']['escalation_options_unreachable'])) { + $escalation->setEscalationOptionsUnreachable(true); + } + else { + $escalation->setEscalationOptionsUnreachable(false); + } + if(isset($_POST['escalation_manage']['escalation_options_ok'])) { + $escalation->setEscalationOptionsOk(true); + } + else { + $escalation->setEscalationOptionsOk(false); + } + if(isset($_POST['escalation_manage']['escalation_options_up'])) { + $escalation->setEscalationOptionsUp(true); + } + else { + $escalation->setEscalationOptionsUp(false); + } + if(isset($_POST['escalation_manage']['escalation_options_warning'])) { + $escalation->setEscalationOptionsWarning(true); + } + else { + $escalation->setEscalationOptionsWarning(false); + } + if(isset($_POST['escalation_manage']['escalation_options_unknown'])) { + $escalation->setEscalationOptionsUnknown(true); + } + else { + $escalation->setEscalationOptionsUnknown(false); + } + if(isset($_POST['escalation_manage']['escalation_options_critical'])) { + $escalation->setEscalationOptionsCritical(true); + } + else { + $escalation->setEscalationOptionsCritical(false); + } + $escalation->save(); + $success = "Escalation modified."; + unset($_GET['edit']); + } + } + else if($_POST['request'] == 'add_contactgroup_command') { + if($lilac->escalation_has_contactgroup($_GET['id'], $_POST['escalation_manage']['contactgroup_add']['contactgroup_id'])) { + $error = "That contact group already exists in that list!"; + unset($_POST['escalation_manage']); + } + else { + $membership = new NagiosEscalationContactgroup(); + $membership->setNagiosEscalation($escalation); + $membership->setContactgroup($_POST['escalation_manage']['contactgroup_add']['contactgroup_id']); + $membership->save(); + $success = "New Escalation Contact Group Link added."; + unset($_POST['escalation_manage']); + } + } + else if($_POST['request'] == 'add_contact_command') { + $c = new Criteria(); + $c->add(NagiosEscalationContactPeer::ESCALATION, $_GET['id']); + $c->add(NagiosEscalationContactPeer::CONTACT, $_POST['escalation_manage']['contact_add']['contact_id']); + $membership = NagiosEscalationContactPeer::doSelectOne($c); + if($membership) { + $error = "That contact already exists in that list!"; + } + else { + $tempContact = NagiosContactPeer::retrieveByPk($_POST['escalation_manage']['contact_add']['contact_id']); + if($tempContact) { + $membership = new NagiosEscalationContact(); + $membership->setEscalation($_GET['id']); + $membership->setNagiosContact($tempContact); + $membership->save(); + $success = "New Escalation Contact Link added."; + } + else { + $error = "That contact is not found."; + } + } + } + +} + +if(isset($_GET['id'])) { + if(!$lilac->get_escalation($_GET['id'], $escalation)) { + header("Location: welcome.php"); + die(); + } +} + +$title = ''; +if($escalation->getNagiosService() || $escalation->getNagiosServiceTemplate()) { + $title .= "Service "; + if($escalation->getNagiosServiceTemplate()) { + $title .= "Template " . $escalation->getNagiosServiceTemplate()->getName() . ""; + $sublink = "service_template.php?id=" . $escalation->getNagiosServiceTemplate()->getId(); + $subText = "Return To Service Template " . $escalation->getNagiosServiceTemplate()->getName(); + } + else { + $title .= "" . $escalation->getNagiosService()->getDescription() . " On "; + if($escalation->getNagiosService()->getNagiosHostTemplate()) { + $title .= " Host Template " . $escalation->getNagiosService()->getNagiosHostTemplate()->getName() . ""; + } + else if($escalation->getNagiosService()->getNagiosHost()) { + $title .= "Host " . "" . $escalation->getNagiosService()->getNagiosHost()->getName() . ""; + } + $sublink = "service.php?id=" . $escalation->getNagiosService()->getId(); + $subText = "Return To Service " . $escalation->getNagiosService()->getDescription(); + } +} +else { + if($escalation->getNagiosHostTemplate()) { + $title .= "Host Template " . $escalation->getNagiosHostTemplate()->getName() . ""; + $sublink = "host_template.php?id=" . $escalation->getNagiosHostTemplate()->getId(); + $subText = "Return To Host Template " . $escalation->getNagiosHostTemplate()->getName(); + } + else if($escalation->getNagiosHost()) { + $title .= "Host " . $escalation->getNagiosHost()->getName() . ""; + $sublink = "hosts.php?id=" . $escalation->getNagiosHost()->getId(); + $subText = "Return To Host " . $escalation->getNagiosHost()->getName(); + } + else if($escalation->getNagiosHostgroup()) { + $title .= "Hostgroup " . $escalation->getNagiosHostgroup()->getName() . ""; + $sublink = "hostgroups.php?id=" . $escalation->getNagiosHostgroup()->getId(); + $subText = "Return To Hostgroup " . $escalation->getNagiosHostgroup()->getName(); + } + +} + +// Build subnav +$subnav = array( + 'general' => 'General', + 'contacts' => 'Contacts' + ); + + +print_header("Escalation Editor for " . $title); +?> +getDescription() . " Escalation Information", "100%"); + print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?id=" . $_GET['id']); + if($_GET['section'] == 'general') { + if(!$escalation->getService() && !$escalation->getServiceTemplate()) + $escalation_image = $path_config['image_root'] . "server.gif"; + else + $escalation_image = $path_config['image_root'] . "services.gif"; + ?> + + + + + +
+ + + +
+ + + Escalation Description:
+ element_desc("escalation_description", "nagios_escalations_desc"); ?>
+
+ First Notification:
+ element_desc("first_notification", "nagios_escalations_desc"); ?>
+
+ Last Notification:
+ element_desc("last_notification", "nagios_escalations_desc"); ?>
+
+ Notification Interval:
+ element_desc("notification_interval", "nagios_escalations_desc"); ?>
+
+ Escalation Period: getEscalationPeriod() != null) ? $escalation->getEscalationPeriod() : '');?>
+ element_desc("escalation_period", "nagios_escalations_desc"); ?>
+
+ + + + + + + + + +
+ Execution Failure Criteria +
+ getService()) || $escalation->getServiceTemplate()) { // It's a service escalation + ?> + getEscalationOptionsOk() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_ok]" value="1">Ok
+ getEscalationOptionsWarning() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_warning]" value="1">Warning
+ getEscalationOptionsUnknown() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_unknown]" value="1">Unknown
+ getEscalationOptionsCritical() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_critical]" value="1">Critical
+ + getEscalationOptionsUp() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_up]" value="1">Up
+ getEscalationOptionsDown() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_down]" value="1">Down
+ getEscalationOptionsUnreachable() == 1) ? "CHECKED" : '');?> name="escalation_manage[escalation_options_unreachable]" value="1">Unreachable
+ +
element_desc("escalation_options", "nagios_escalations_desc"); ?>
+ +
+
+ [ Cancel ] + + Attached To getHost() !== null && !($escalation->getService() !== null)) + print("Host: " . $escalation->getNagiosHost()->getName()); + else if($escalation->getHostTemplate()) + print("Host Template: " . $escalation->getNagiosHostTemplate()->getName()); + else if($escalation->getService()) { + if($escalation->getNagiosService()->getNagiosHost() !== null) + print("Service: " . $escalation->getNagiosService()->getDescription() . " On " . $escalation->getNagiosService()->getNagiosHost()->getName()); + else + print("Service: " . $escalation->getNagiosService()->getDescription() . " On Host Template " . $escalation->getNagiosService()->getNagiosHostTemplate()->getName()); + } + else if($escalation->getServiceTemplate()) { + print("Service Template: " . $escalation->getNagiosServiceTemplate()->getName()); + } + else if($escalation->getHostgroup() !== null) { + print("Hostgroup: " . $escalation->getNagiosHostgroup()->getName()); + } + ?>
+ Description: getDescription();?>
+
+ Included In Definition:
+ getFirstNotification() != null) { + ?> + First Notification: #getFirstNotification();?> Notification
+ getLastNotification() != null) { + ?> + Last Notification: #getLastNotification();?> Notification
+ getNotificationInterval() != null) { + ?> + Notification Interval: getNotificationInterval();?> Time-Units
+ getEscalationPeriod()) { + ?> + Escalation Period: return_period_name($escalation->getEscalationPeriod());?>
+ getEscalationOptionsUp() != null || $escalation->getEscalationOptionsDown() != null || $escalation->getEscalationOptionsUnreachable() != null || $escalation->getEscalationOptionsOk() != null || $escalation->getEscalationOptionsWarning() != null || $escalation->getEscalationOptionsUnknown() != null || $escalation->getEscalationOptionsCritical() != null) { + ?> + Escalation Options: + getEscalationOptionsUp()) { + print("Up"); + if($escalation->getEscalationOptionsDown() || $escalation->getEscalationOptionsUnreachable() || $escalation->getEscalationOptionsOk() || $escalation->getEscalationOptionsWarning() || $escalation->getEscalationOptionsUnknown() || $escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsDown()) { + print("Down"); + if($escalation->getEscalationOptionsUnreachable() || $escalation->getEscalationOptionsOk() || $escalation->getEscalationOptionsWarning() || $escalation->getEscalationOptionsUnknown() || $escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsUnreachable()) { + print("Unreachable"); + if($escalation->getEscalationOptionsOk() || $escalation->getEscalationOptionsWarning() || $escalation->getEscalationOptionsUnknown() || $escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsOk()) { + print("Ok"); + if($escalation->getEscalationOptionsWarning() || $escalation->getEscalationOptionsUnknown() || $escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsWarning()) { + print("Warning"); + if($escalation->getEscalationOptionsUnknown() || $escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsUnknown()) { + print("Unknown"); + if($escalation->getEscalationOptionsCritical() ) + print(","); + } + if($escalation->getEscalationOptionsCritical()) { + print("Critical"); + } + print("
"); + } + ?> +
+ [ Edit ] + +
+
+ getNagiosEscalationContacts(); + + $numOfContacts = count($contacts_list); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Contacts Explicitly Linked to This Escalation:
 [ Delete ]getNagiosContact()->getName();?>: getNagiosContact()->getAlias();?>
+ get_contact_list($temp_list); + $contacts_list = array(); + foreach($temp_list as $tempContact) { + $contacts_list[] = array('contact_name' => $tempContact->getName(), 'contact_id' => $tempContact->getId()); + } + ?> +
+
+ + + Add New Contact: No Contacts Available

+ element_desc("contact_groups", "nagios_escalations_desc"); ?>
+
+ +
+ return_escalation_contactgroups_list($_GET['id'], $tempList); + foreach($tempList as $contactgroup) { + $contactgroups_list[] = array("contactgroup_id" => $contactgroup->getId(), "contactgroup_name" => $contactgroup->getName()); + } + $numOfContactGroups = count($contactgroups_list); + ?> + + + + + +
+ + + + + + + + + + + + + + + +
Contact Groups Explicitly Linked to This Escalation:
 [ Delete ]return_contactgroup_name($contactgroups_list[$counter]['contactgroup_id']);?>: return_contactgroup_alias($contactgroups_list[$counter]['contactgroup_id']);?>
+ get_contactgroup_list($tempList); + foreach($tempList as $contactgroup) { + $contactgroups_list[] = array("contactgroup_id" => $contactgroup->getId(), "contactgroup_name" => $contactgroup->getName()); + } + ?> +
+
+
+ + + Add New Contact Group: No Contact Groups Available

+ element_desc("contact_groups", "nagios_escalations_desc"); ?>
+
+
+
+ + + +
+
+ +
+ diff --git a/export.php b/export.php new file mode 100755 index 0000000..d1361b3 --- /dev/null +++ b/export.php @@ -0,0 +1,439 @@ +renderConfig(); + die(); +} + + +if(isset($_GET['id'])) { + $exportJob = ExportJobPeer::retrieveByPK($_GET['id']); + if(!$exportJob) { + unset($exportJob); + } + + if(isset($_GET['action']) && $_GET['action'] == "restart") { + $exportJob->setStatusCode(ExportJob::STATUS_STARTING); + $exportJob->setStartTime(time()); + $exportJob->setStatus("Starting..."); + $exportJob->save(); + exec("php exporter/export.php " . $exportJob->getId() . " > /dev/null", $tempOutput, $retVal); + if($retVal != 42) { + $error = "Failed to run external exporter script. Return value: " . $retVal . "
Error:"; + foreach($tempOutput as $output) { + $error .= $output . "
"; + } + } + else { + // No need to show + //$success = "Restarted Export Job"; + } + } + if(isset($_GET['delete'])) { + // We want to delete the job! + $exportJob->delete(); + unset($_GET['id']); + unset($exportJob); + $success = "Removed Job"; + } +} +if(isset($_GET['request']) && $_GET['request'] == 'status') { + // We're our AJAX client wanting status information + $result = array(); + $exportJob = ExportJobPeer::retrieveByPK($_GET['id']); + if(!$exportJob) { + $result['error'] = "Invalid job specified."; + print(json_encode($result)); + exit(); + } + // Okay, let's populate the status + $result['start_time'] = $exportJob->getStartTime(); + $result['status_code'] = $exportJob->getStatusCode(); + $result['status_text'] = $exportJob->getStatus(); + $result['status_change_time'] = $exportJob->getStatusChangeTime(); + + // Build elapsed time + if(!in_array($exportJob->getStatusCode(), array(ExportJob::STATUS_FAILED, ExportJob::STATUS_FINISHED))) { + $target = time(); + } + else { + $target = strtotime($result['status_change_time']); + } + $start = strtotime($result['start_time']); + $total = $target - $start; + $hours = (int)($total / 3600); + $total = $total % 3600; + $minutes = (int)($total / 60); + $seconds = $total % 60; + + $result['elapsed_time'] = $hours . " Hours " . $minutes . " Minutes " . $seconds . " Seconds"; + + print(json_encode($result)); + exit(); +} + +if(isset($_GET['request']) && $_GET['request'] == 'fetch') { + // We're our AJAX client wanting to get new log data + $result = array(); + $c = new Criteria(); + $c->add(ExportLogEntryPeer::JOB, $_GET['id']); + $c->setLimit($_POST['rp']); + $c->setOffset(isset($_POST['page']) ? ($_POST['page'] - 1) * $_POST['rp'] : 0); + $c->addDescendingOrderByColumn(ExportLogEntryPeer::ID); + $entries = $exportJob->getExportLogEntrys($c); + foreach($entries as $entry) { + $results['rows'][] = array('id' => $entry->getId(), 'cell' => array( $entry->getTime(), + $entry->getReadableType($entry->getType()), + $entry->getText())); + } + $c = new Criteria(); + $c->add(ExportLogEntryPeer::JOB, $exportJob->getId()); + $results['page'] = $_POST['page']; + $results['total'] = ExportLogEntryPeer::doCount($c); + ?> + + validateConfig(); + } + if(empty($error)) { + // All is good. Let's create our job. + $config = new ExportConfig($engineClass); + $engine->buildConfig($config); + $exportJob = new ExportJob(); + $exportJob->setName($_POST['job_name']); + $exportJob->setDescription($_POST['job_description']); + $exportJob->setCmd(ExportJob::CMD_START); + $exportJob->setConfig(serialize($config)); + $exportJob->setStartTime(time()); + $exportJob->setStatus("Starting..."); + $exportJob->setStatusCode(ExportJob::STATUS_STARTING); + $exportJob->save(); + + // Attempt to execute the external exporter script, fork it, and love it. + exec("php exporter/export.php " . $exportJob->getId() . " > /dev/null", $tempOutput, $retVal); + if($retVal != 42) { + $error = "Failed to run external exporter script. Return value: " . $retVal . "
Error:"; + foreach($tempOutput as $output) { + $error .= $output . "
"; + } + } + } +} + + +print_header("Exporter"); + + +if(isset($exportJob)) { + ?> + + + +add(ExportJobPeer::END_TIME, null); + $exportJobs = ExportJobPeer::doSelect($c); + if($exportJobs) { + print_window_header("Existing Export Jobs", "100%"); + ?> + There appears to be existing export jobs. There should only be one running. If there are multiple showing as running, you should cancel them or purge them. Click on a job to + view it's progress and it's log. + + + + + + + + + + + + + + + + + + +
NameDescriptionStart TimeStatusActions
getName();?>getDescription();?>getStartTime();?>getStatus();?>View JobRestart
+ + + + To begin an export of your configuration, an Export Job must be defined. Configure your export job below. Once created, your export job will begin in the background. + You will be able to check on the status of your export and view it's log as it continues running. You are advised to NOT edit anything in Lilac while your export is + running. +
+
+ +

+

+ Job Definition + + + + + + + +
+

+
+ Choose an Engine to use for your Import Job from Above. +
+ + + + getStats(); + if($stats) { + $stats = unserialize($stats); + } + + print_window_header("Job Details", "100%"); + ?> + Job Name: getName();?>
+ Job Id: getId();?>
+ getDescription();?> +
+
+ Start Time: getStartTime();?>
+
+ getStatusCode(), array(ExportJob::STATUS_FAILED, ExportJob::STATUS_FINISHED) )) { + ?> + Elapsed Time: Unknown + getStatusCode() == ExportJob::STATUS_FAILED) { + ?> + Time of Failure: getStatusChangeTime();?> + + Time When Completed: getStatusChangeTime();?> + +
+ Current Status: getStatus();?>
+
+ Job Supplemental: +