From 4837a1885ddebc16476669eae606a095abc8b4dc Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 22 Jun 2022 15:15:31 +0200 Subject: [PATCH] feat: remove unused cc_sess table (#1907) --- api/libretime_api/core/models/__init__.py | 2 +- api/libretime_api/core/models/auth.py | 16 - api/libretime_api/core/router.py | 2 - .../core/serializers/__init__.py | 2 +- api/libretime_api/core/serializers/auth.py | 8 +- api/libretime_api/core/views/__init__.py | 2 +- api/libretime_api/core/views/auth.py | 10 +- .../migrations/0032_3_0_0_alpha_13_6.py | 43 + .../legacy/migrations/__init__.py | 2 +- .../legacy/migrations/sql/schema.sql | 24 - api/schema.yml | 185 --- .../configs/classmap-airtime-conf.php | 7 - legacy/application/models/airtime/CcSess.php | 12 - .../application/models/airtime/CcSessPeer.php | 12 - .../models/airtime/CcSessQuery.php | 12 - .../models/airtime/map/CcSessTableMap.php | 56 - .../models/airtime/map/CcSubjsTableMap.php | 1 - .../models/airtime/om/BaseCcSess.php | 1063 ----------------- .../models/airtime/om/BaseCcSessPeer.php | 1004 ---------------- .../models/airtime/om/BaseCcSessQuery.php | 471 -------- .../models/airtime/om/BaseCcSubjs.php | 285 ----- .../models/airtime/om/BaseCcSubjsPeer.php | 3 - .../models/airtime/om/BaseCcSubjsQuery.php | 78 -- legacy/build/schema.xml | 15 - 24 files changed, 50 insertions(+), 3265 deletions(-) create mode 100644 api/libretime_api/legacy/migrations/0032_3_0_0_alpha_13_6.py delete mode 100644 legacy/application/models/airtime/CcSess.php delete mode 100644 legacy/application/models/airtime/CcSessPeer.php delete mode 100644 legacy/application/models/airtime/CcSessQuery.php delete mode 100644 legacy/application/models/airtime/map/CcSessTableMap.php delete mode 100644 legacy/application/models/airtime/om/BaseCcSess.php delete mode 100644 legacy/application/models/airtime/om/BaseCcSessPeer.php delete mode 100644 legacy/application/models/airtime/om/BaseCcSessQuery.php diff --git a/api/libretime_api/core/models/__init__.py b/api/libretime_api/core/models/__init__.py index 0f8d92473..c2f192094 100644 --- a/api/libretime_api/core/models/__init__.py +++ b/api/libretime_api/core/models/__init__.py @@ -1,4 +1,4 @@ -from .auth import LoginAttempt, Session, UserToken +from .auth import LoginAttempt, UserToken from .country import Country from .preference import Preference, StreamSetting from .role import Role diff --git a/api/libretime_api/core/models/auth.py b/api/libretime_api/core/models/auth.py index 533ad21bc..0936a2698 100644 --- a/api/libretime_api/core/models/auth.py +++ b/api/libretime_api/core/models/auth.py @@ -15,22 +15,6 @@ class UserToken(models.Model): db_table = "cc_subjs_token" -class Session(models.Model): - sessid = models.CharField(primary_key=True, max_length=32) - userid = models.ForeignKey( - "User", - on_delete=models.DO_NOTHING, - blank=True, - null=True, - ) - login = models.CharField(max_length=255, blank=True, null=True) - ts = models.DateTimeField(blank=True, null=True) - - class Meta: - managed = False - db_table = "cc_sess" - - class LoginAttempt(models.Model): ip = models.CharField(primary_key=True, max_length=32) attempts = models.IntegerField(blank=True, null=True) diff --git a/api/libretime_api/core/router.py b/api/libretime_api/core/router.py index a8a1304b9..085a2f56b 100644 --- a/api/libretime_api/core/router.py +++ b/api/libretime_api/core/router.py @@ -6,7 +6,6 @@ from .views import ( LoginAttemptViewSet, PreferenceViewSet, ServiceRegisterViewSet, - SessionViewSet, StreamSettingViewSet, ThirdPartyTrackReferenceViewSet, UserTokenViewSet, @@ -18,7 +17,6 @@ router.register("countries", CountryViewSet) router.register("login-attempts", LoginAttemptViewSet) router.register("preferences", PreferenceViewSet) router.register("service-registers", ServiceRegisterViewSet) -router.register("sessions", SessionViewSet) router.register("stream-settings", StreamSettingViewSet) router.register("users", UserViewSet) router.register("user-tokens", UserTokenViewSet) diff --git a/api/libretime_api/core/serializers/__init__.py b/api/libretime_api/core/serializers/__init__.py index 31870bcf2..c22b6cc16 100644 --- a/api/libretime_api/core/serializers/__init__.py +++ b/api/libretime_api/core/serializers/__init__.py @@ -1,4 +1,4 @@ -from .auth import LoginAttemptSerializer, SessionSerializer, UserTokenSerializer +from .auth import LoginAttemptSerializer, UserTokenSerializer from .country import CountrySerializer from .preference import PreferenceSerializer, StreamSettingSerializer from .service import ServiceRegisterSerializer diff --git a/api/libretime_api/core/serializers/auth.py b/api/libretime_api/core/serializers/auth.py index 732bd5d5c..be12c7100 100644 --- a/api/libretime_api/core/serializers/auth.py +++ b/api/libretime_api/core/serializers/auth.py @@ -1,6 +1,6 @@ from rest_framework import serializers -from ..models import LoginAttempt, Session, UserToken +from ..models import LoginAttempt, UserToken class UserTokenSerializer(serializers.HyperlinkedModelSerializer): @@ -9,12 +9,6 @@ class UserTokenSerializer(serializers.HyperlinkedModelSerializer): fields = "__all__" -class SessionSerializer(serializers.HyperlinkedModelSerializer): - class Meta: - model = Session - fields = "__all__" - - class LoginAttemptSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = LoginAttempt diff --git a/api/libretime_api/core/views/__init__.py b/api/libretime_api/core/views/__init__.py index 54cb28689..18a4c63ed 100644 --- a/api/libretime_api/core/views/__init__.py +++ b/api/libretime_api/core/views/__init__.py @@ -1,4 +1,4 @@ -from .auth import LoginAttemptViewSet, SessionViewSet, UserTokenViewSet +from .auth import LoginAttemptViewSet, UserTokenViewSet from .country import CountryViewSet from .preference import PreferenceViewSet, StreamSettingViewSet from .service import ServiceRegisterViewSet diff --git a/api/libretime_api/core/views/auth.py b/api/libretime_api/core/views/auth.py index 2f138f947..93d480a93 100644 --- a/api/libretime_api/core/views/auth.py +++ b/api/libretime_api/core/views/auth.py @@ -1,7 +1,7 @@ from rest_framework import viewsets -from ..models import LoginAttempt, Session, UserToken -from ..serializers import LoginAttemptSerializer, SessionSerializer, UserTokenSerializer +from ..models import LoginAttempt, UserToken +from ..serializers import LoginAttemptSerializer, UserTokenSerializer class UserTokenViewSet(viewsets.ModelViewSet): @@ -10,12 +10,6 @@ class UserTokenViewSet(viewsets.ModelViewSet): model_permission_name = "usertoken" -class SessionViewSet(viewsets.ModelViewSet): - queryset = Session.objects.all() - serializer_class = SessionSerializer - model_permission_name = "session" - - class LoginAttemptViewSet(viewsets.ModelViewSet): queryset = LoginAttempt.objects.all() serializer_class = LoginAttemptSerializer diff --git a/api/libretime_api/legacy/migrations/0032_3_0_0_alpha_13_6.py b/api/libretime_api/legacy/migrations/0032_3_0_0_alpha_13_6.py new file mode 100644 index 000000000..4a18ec16b --- /dev/null +++ b/api/libretime_api/legacy/migrations/0032_3_0_0_alpha_13_6.py @@ -0,0 +1,43 @@ +# pylint: disable=invalid-name + +from django.db import migrations + +from ._migrations import legacy_migration_factory + +UP = """ +DROP TABLE IF EXISTS "cc_sess"; +""" + +DOWN = """ +CREATE TABLE "cc_sess" +( + "sessid" CHAR(32) NOT NULL, + "userid" INTEGER, + "login" VARCHAR(255), + "ts" TIMESTAMP, + PRIMARY KEY ("sessid") +); + +CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login"); + +CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid"); + +ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" + FOREIGN KEY ("userid") + REFERENCES "cc_subjs" ("id") + ON DELETE CASCADE; +""" + + +class Migration(migrations.Migration): + dependencies = [ + ("legacy", "0031_3_0_0_alpha_13_5"), + ] + operations = [ + migrations.RunPython( + code=legacy_migration_factory( + target="3.0.0-alpha.13.6", + sql=UP, + ) + ) + ] diff --git a/api/libretime_api/legacy/migrations/__init__.py b/api/libretime_api/legacy/migrations/__init__.py index 772e6e7fd..31d6d7213 100644 --- a/api/libretime_api/legacy/migrations/__init__.py +++ b/api/libretime_api/legacy/migrations/__init__.py @@ -1 +1 @@ -LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.5" +LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.6" diff --git a/api/libretime_api/legacy/migrations/sql/schema.sql b/api/libretime_api/legacy/migrations/sql/schema.sql index 801bea1d5..435bb8701 100644 --- a/api/libretime_api/legacy/migrations/sql/schema.sql +++ b/api/libretime_api/legacy/migrations/sql/schema.sql @@ -386,25 +386,6 @@ CREATE TABLE "cc_schedule" CREATE INDEX "cc_schedule_instance_id_idx" ON "cc_schedule" ("instance_id"); ------------------------------------------------------------------------ --- cc_sess ------------------------------------------------------------------------ - -DROP TABLE IF EXISTS "cc_sess" CASCADE; - -CREATE TABLE "cc_sess" -( - "sessid" CHAR(32) NOT NULL, - "userid" INTEGER, - "login" VARCHAR(255), - "ts" TIMESTAMP, - PRIMARY KEY ("sessid") -); - -CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login"); - -CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid"); - ----------------------------------------------------------------------- -- cc_subjs ----------------------------------------------------------------------- @@ -884,11 +865,6 @@ ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey" REFERENCES "cc_webstream" ("id") ON DELETE CASCADE; -ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" - FOREIGN KEY ("userid") - REFERENCES "cc_subjs" ("id") - ON DELETE CASCADE; - ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey" FOREIGN KEY ("user_id") REFERENCES "cc_subjs" ("id") diff --git a/api/schema.yml b/api/schema.yml index 40d67cc31..9ad776709 100644 --- a/api/schema.yml +++ b/api/schema.yml @@ -3249,151 +3249,6 @@ paths: responses: "204": description: No response body - /api/v2/sessions/: - get: - operationId: sessions_list - tags: - - sessions - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "200": - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Session" - description: "" - post: - operationId: sessions_create - tags: - - sessions - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - application/x-www-form-urlencoded: - schema: - $ref: "#/components/schemas/Session" - multipart/form-data: - schema: - $ref: "#/components/schemas/Session" - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "201": - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - description: "" - /api/v2/sessions/{sessid}/: - get: - operationId: sessions_retrieve - parameters: - - in: path - name: sessid - schema: - type: string - description: A unique value identifying this session. - required: true - tags: - - sessions - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - description: "" - put: - operationId: sessions_update - parameters: - - in: path - name: sessid - schema: - type: string - description: A unique value identifying this session. - required: true - tags: - - sessions - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - application/x-www-form-urlencoded: - schema: - $ref: "#/components/schemas/Session" - multipart/form-data: - schema: - $ref: "#/components/schemas/Session" - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - description: "" - patch: - operationId: sessions_partial_update - parameters: - - in: path - name: sessid - schema: - type: string - description: A unique value identifying this session. - required: true - tags: - - sessions - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/PatchedSession" - application/x-www-form-urlencoded: - schema: - $ref: "#/components/schemas/PatchedSession" - multipart/form-data: - schema: - $ref: "#/components/schemas/PatchedSession" - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "200": - content: - application/json: - schema: - $ref: "#/components/schemas/Session" - description: "" - delete: - operationId: sessions_destroy - parameters: - - in: path - name: sessid - schema: - type: string - description: A unique value identifying this session. - required: true - tags: - - sessions - security: - - cookieAuth: [] - - basicAuth: [] - responses: - "204": - description: No response body /api/v2/show-days/: get: operationId: show_days_list @@ -7078,25 +6933,6 @@ components: ip: type: string maxLength: 45 - PatchedSession: - type: object - properties: - item_url: - type: string - format: uri - readOnly: true - login: - type: string - nullable: true - maxLength: 255 - ts: - type: string - format: date-time - nullable: true - userid: - type: string - format: uri - nullable: true PatchedShow: type: object properties: @@ -7992,27 +7828,6 @@ components: required: - ip - item_url - Session: - type: object - properties: - item_url: - type: string - format: uri - readOnly: true - login: - type: string - nullable: true - maxLength: 255 - ts: - type: string - format: date-time - nullable: true - userid: - type: string - format: uri - nullable: true - required: - - item_url Show: type: object properties: diff --git a/legacy/application/configs/classmap-airtime-conf.php b/legacy/application/configs/classmap-airtime-conf.php index 94993235f..1115fc022 100644 --- a/legacy/application/configs/classmap-airtime-conf.php +++ b/legacy/application/configs/classmap-airtime-conf.php @@ -59,9 +59,6 @@ return [ 'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php', 'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php', 'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php', - 'BaseCcSess' => 'airtime/om/BaseCcSess.php', - 'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php', - 'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php', 'BaseCcShow' => 'airtime/om/BaseCcShow.php', 'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php', 'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php', @@ -195,10 +192,6 @@ return [ 'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php', 'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php', 'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php', - 'CcSess' => 'airtime/CcSess.php', - 'CcSessPeer' => 'airtime/CcSessPeer.php', - 'CcSessQuery' => 'airtime/CcSessQuery.php', - 'CcSessTableMap' => 'airtime/map/CcSessTableMap.php', 'CcShow' => 'airtime/CcShow.php', 'CcShowDays' => 'airtime/CcShowDays.php', 'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php', diff --git a/legacy/application/models/airtime/CcSess.php b/legacy/application/models/airtime/CcSess.php deleted file mode 100644 index e21f50806..000000000 --- a/legacy/application/models/airtime/CcSess.php +++ /dev/null @@ -1,12 +0,0 @@ -setName('cc_sess'); - $this->setPhpName('CcSess'); - $this->setClassname('CcSess'); - $this->setPackage('airtime'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('sessid', 'Sessid', 'CHAR', true, 32, null); - $this->addForeignKey('userid', 'Userid', 'INTEGER', 'cc_subjs', 'id', false, null, null); - $this->addColumn('login', 'Login', 'VARCHAR', false, 255, null); - $this->addColumn('ts', 'Ts', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('userid' => 'id', ), 'CASCADE', null); - } // buildRelations() - -} // CcSessTableMap diff --git a/legacy/application/models/airtime/map/CcSubjsTableMap.php b/legacy/application/models/airtime/map/CcSubjsTableMap.php index 80a6a2c2c..bdb4e387a 100644 --- a/legacy/application/models/airtime/map/CcSubjsTableMap.php +++ b/legacy/application/models/airtime/map/CcSubjsTableMap.php @@ -67,7 +67,6 @@ class CcSubjsTableMap extends TableMap $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcPlaylists'); $this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcBlocks'); $this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null, 'CcPrefs'); - $this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null, 'CcSesss'); $this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null, 'CcSubjsTokens'); $this->addRelation('Podcast', 'Podcast', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), 'CASCADE', null, 'Podcasts'); } // buildRelations() diff --git a/legacy/application/models/airtime/om/BaseCcSess.php b/legacy/application/models/airtime/om/BaseCcSess.php deleted file mode 100644 index 0981b5339..000000000 --- a/legacy/application/models/airtime/om/BaseCcSess.php +++ /dev/null @@ -1,1063 +0,0 @@ -sessid; - } - - /** - * Get the [userid] column value. - * - * @return int - */ - public function getUserid() - { - - return $this->userid; - } - - /** - * Get the [login] column value. - * - * @return string - */ - public function getLogin() - { - - return $this->login; - } - - /** - * Get the [optionally formatted] temporal [ts] 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 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getTs($format = 'Y-m-d H:i:s') - { - if ($this->ts === null) { - return null; - } - - - try { - $dt = new DateTime($this->ts); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Set the value of [sessid] column. - * - * @param string $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setSessid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sessid !== $v) { - $this->sessid = $v; - $this->modifiedColumns[] = CcSessPeer::SESSID; - } - - - return $this; - } // setSessid() - - /** - * Set the value of [userid] column. - * - * @param int $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setUserid($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->userid !== $v) { - $this->userid = $v; - $this->modifiedColumns[] = CcSessPeer::USERID; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { - $this->aCcSubjs = null; - } - - - return $this; - } // setUserid() - - /** - * Set the value of [login] column. - * - * @param string $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setLogin($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->login !== $v) { - $this->login = $v; - $this->modifiedColumns[] = CcSessPeer::LOGIN; - } - - - return $this; - } // setLogin() - - /** - * Sets the value of [ts] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CcSess The current object (for fluent API support) - */ - public function setTs($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->ts !== null || $dt !== null) { - $currentDateAsString = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->ts = $newDateAsString; - $this->modifiedColumns[] = CcSessPeer::TS; - } - } // if either are not null - - - return $this; - } // setTs() - - /** - * 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() - { - // 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 resultset 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->sessid = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; - $this->userid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->login = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->ts = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 4; // 4 = CcSessPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating CcSess 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->aCcSubjs !== null && $this->userid !== $this->aCcSubjs->getDbId()) { - $this->aCcSubjs = 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(CcSessPeer::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 = CcSessPeer::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->aCcSubjs = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = CcSessQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $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 - * @throws Exception - * @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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcSessPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CcSessPeer::SESSID)) { - $modifiedColumns[':p' . $index++] = '"sessid"'; - } - if ($this->isColumnModified(CcSessPeer::USERID)) { - $modifiedColumns[':p' . $index++] = '"userid"'; - } - if ($this->isColumnModified(CcSessPeer::LOGIN)) { - $modifiedColumns[':p' . $index++] = '"login"'; - } - if ($this->isColumnModified(CcSessPeer::TS)) { - $modifiedColumns[':p' . $index++] = '"ts"'; - } - - $sql = sprintf( - 'INSERT INTO "cc_sess" (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '"sessid"': - $stmt->bindValue($identifier, $this->sessid, PDO::PARAM_STR); - break; - case '"userid"': - $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT); - break; - case '"login"': - $stmt->bindValue($identifier, $this->login, PDO::PARAM_STR); - break; - case '"ts"': - $stmt->bindValue($identifier, $this->ts, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcSessPeer::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. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSessPeer::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->getSessid(); - break; - case 1: - return $this->getUserid(); - break; - case 2: - return $this->getLogin(); - break; - case 3: - return $this->getTs(); - 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. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['CcSess'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['CcSess'][$this->getPrimaryKey()] = true; - $keys = CcSessPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getSessid(), - $keys[1] => $this->getUserid(), - $keys[2] => $this->getLogin(), - $keys[3] => $this->getTs(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - 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. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $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->setSessid($value); - break; - case 1: - $this->setUserid($value); - break; - case 2: - $this->setLogin($value); - break; - case 3: - $this->setTs($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 BasePeer::TYPE_PHPNAME - * - * @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 = CcSessPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setSessid($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setUserid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLogin($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTs($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(CcSessPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcSessPeer::SESSID)) $criteria->add(CcSessPeer::SESSID, $this->sessid); - if ($this->isColumnModified(CcSessPeer::USERID)) $criteria->add(CcSessPeer::USERID, $this->userid); - if ($this->isColumnModified(CcSessPeer::LOGIN)) $criteria->add(CcSessPeer::LOGIN, $this->login); - if ($this->isColumnModified(CcSessPeer::TS)) $criteria->add(CcSessPeer::TS, $this->ts); - - 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(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $this->sessid); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return string - */ - public function getPrimaryKey() - { - return $this->getSessid(); - } - - /** - * Generic method to set the primary key (sessid column). - * - * @param string $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setSessid($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getSessid(); - } - - /** - * 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 CcSess (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setUserid($this->getUserid()); - $copyObj->setLogin($this->getLogin()); - $copyObj->setTs($this->getTs()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setSessid(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 CcSess 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 CcSessPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcSessPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcSess The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setUserid(NULL); - } else { - $this->setUserid($v->getDbId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcSess($this); - } - - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null, $doQuery = true) - { - if ($this->aCcSubjs === null && ($this->userid !== null) && $doQuery) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->userid, $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->aCcSubjs->addCcSesss($this); - */ - } - - return $this->aCcSubjs; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->sessid = null; - $this->userid = null; - $this->login = null; - $this->ts = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->aCcSubjs instanceof Persistent) { - $this->aCcSubjs->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - $this->aCcSubjs = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(CcSessPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - -} diff --git a/legacy/application/models/airtime/om/BaseCcSessPeer.php b/legacy/application/models/airtime/om/BaseCcSessPeer.php deleted file mode 100644 index 2a13ba21e..000000000 --- a/legacy/application/models/airtime/om/BaseCcSessPeer.php +++ /dev/null @@ -1,1004 +0,0 @@ - array ('Sessid', 'Userid', 'Login', 'Ts', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('sessid', 'userid', 'login', 'ts', ), - BasePeer::TYPE_COLNAME => array (CcSessPeer::SESSID, CcSessPeer::USERID, CcSessPeer::LOGIN, CcSessPeer::TS, ), - BasePeer::TYPE_RAW_COLNAME => array ('SESSID', 'USERID', 'LOGIN', 'TS', ), - BasePeer::TYPE_FIELDNAME => array ('sessid', 'userid', 'login', 'ts', ), - 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. CcSessPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Sessid' => 0, 'Userid' => 1, 'Login' => 2, 'Ts' => 3, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), - BasePeer::TYPE_COLNAME => array (CcSessPeer::SESSID => 0, CcSessPeer::USERID => 1, CcSessPeer::LOGIN => 2, CcSessPeer::TS => 3, ), - BasePeer::TYPE_RAW_COLNAME => array ('SESSID' => 0, 'USERID' => 1, 'LOGIN' => 2, 'TS' => 3, ), - BasePeer::TYPE_FIELDNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) - ); - - /** - * 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. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = CcSessPeer::getFieldNames($toType); - $key = isset(CcSessPeer::$fieldKeys[$fromType][$name]) ? CcSessPeer::$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(CcSessPeer::$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 - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, CcSessPeer::$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 CcSessPeer::$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. CcSessPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcSessPeer::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 $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcSessPeer::SESSID); - $criteria->addSelectColumn(CcSessPeer::USERID); - $criteria->addSelectColumn(CcSessPeer::LOGIN); - $criteria->addSelectColumn(CcSessPeer::TS); - } else { - $criteria->addSelectColumn($alias . '.sessid'); - $criteria->addSelectColumn($alias . '.userid'); - $criteria->addSelectColumn($alias . '.login'); - $criteria->addSelectColumn($alias . '.ts'); - } - } - - /** - * 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(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(CcSessPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::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; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcSess - * @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 = CcSessPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @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 CcSessPeer::populateObjects(CcSessPeer::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 directly (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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcSessPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(CcSessPeer::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 CcSess $obj A CcSess object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getSessid(); - } // if key === null - CcSessPeer::$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 CcSess object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcSess) { - $key = (string) $value->getSessid(); - } 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 CcSess object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(CcSessPeer::$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 CcSess 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(CcSessPeer::$instances[$key])) { - return CcSessPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (CcSessPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - CcSessPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_sess - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * 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] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (string) $row[$startcol]; - } - - /** - * 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 = CcSessPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcSessPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcSess object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcSessPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcSessPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = CcSessPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcSessPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @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 doCountJoinCcSubjs(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(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CcSessPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::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 CcSess objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcSess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CcSessPeer::DATABASE_NAME); - } - - CcSessPeer::addSelectColumns($criteria); - $startcol = CcSessPeer::NUM_HYDRATE_COLUMNS; - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcSessPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcSessPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcSess) to $obj2 (CcSubjs) - $obj2->addCcSess($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 $criteria - * @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(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CcSessPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::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 CcSess objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcSess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CcSessPeer::DATABASE_NAME); - } - - CcSessPeer::addSelectColumns($criteria); - $startcol2 = CcSessPeer::NUM_HYDRATE_COLUMNS; - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcSessPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcSessPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcSess) to the collection in $obj2 (CcSubjs) - $obj2->addCcSess($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(CcSessPeer::DATABASE_NAME)->getTable(CcSessPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcSessPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcSessPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \CcSessTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass($row = 0, $colnum = 0) - { - return CcSessPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a CcSess or Criteria object. - * - * @param mixed $values Criteria or CcSess 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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcSess object - } - - - // Set the correct dbName - $criteria->setDbName(CcSessPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a CcSess or Criteria object. - * - * @param mixed $values Criteria or CcSess 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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(CcSessPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcSessPeer::SESSID); - $value = $criteria->remove(CcSessPeer::SESSID); - if ($value) { - $selectCriteria->add(CcSessPeer::SESSID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); - } - - } else { // $values is CcSess object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(CcSessPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the cc_sess table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::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(CcSessPeer::TABLE_NAME, $con, CcSessPeer::DATABASE_NAME); - // 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). - CcSessPeer::clearInstancePool(); - CcSessPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a CcSess or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcSess 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(CcSessPeer::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. - CcSessPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcSess) { // it's a model object - // invalidate the cache for this single object - CcSessPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcSessPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(CcSessPeer::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); - CcSessPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcSess 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 CcSess $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($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcSessPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcSessPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcSessPeer::DATABASE_NAME, CcSessPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param string $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcSess - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcSessPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $pk); - - $v = CcSessPeer::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 - * @return CcSess[] - * @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(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $pks, Criteria::IN); - $objs = CcSessPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseCcSessPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcSessPeer::buildTableMap(); diff --git a/legacy/application/models/airtime/om/BaseCcSessQuery.php b/legacy/application/models/airtime/om/BaseCcSessQuery.php deleted file mode 100644 index c2397f286..000000000 --- a/legacy/application/models/airtime/om/BaseCcSessQuery.php +++ /dev/null @@ -1,471 +0,0 @@ -mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcSess|CcSess[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CcSessPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Alias of findPk to use instance pooling - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CcSess A model object, or null if the key is not found - * @throws PropelException - */ - public function findOneBySessid($key, $con = null) - { - return $this->findPk($key, $con); - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CcSess A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT "sessid", "userid", "login", "ts" FROM "cc_sess" WHERE "sessid" = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_STR); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new CcSess(); - $obj->hydrate($row); - CcSessPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CcSess|CcSess[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|CcSess[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CcSessPeer::SESSID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CcSessPeer::SESSID, $keys, Criteria::IN); - } - - /** - * Filter the query on the sessid column - * - * Example usage: - * - * $query->filterBySessid('fooValue'); // WHERE sessid = 'fooValue' - * $query->filterBySessid('%fooValue%'); // WHERE sessid LIKE '%fooValue%' - * - * - * @param string $sessid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterBySessid($sessid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($sessid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $sessid)) { - $sessid = str_replace('*', '%', $sessid); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CcSessPeer::SESSID, $sessid, $comparison); - } - - /** - * Filter the query on the userid column - * - * Example usage: - * - * $query->filterByUserid(1234); // WHERE userid = 1234 - * $query->filterByUserid(array(12, 34)); // WHERE userid IN (12, 34) - * $query->filterByUserid(array('min' => 12)); // WHERE userid >= 12 - * $query->filterByUserid(array('max' => 12)); // WHERE userid <= 12 - * - * - * @see filterByCcSubjs() - * - * @param mixed $userid The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByUserid($userid = null, $comparison = null) - { - if (is_array($userid)) { - $useMinMax = false; - if (isset($userid['min'])) { - $this->addUsingAlias(CcSessPeer::USERID, $userid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($userid['max'])) { - $this->addUsingAlias(CcSessPeer::USERID, $userid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CcSessPeer::USERID, $userid, $comparison); - } - - /** - * Filter the query on the login column - * - * Example usage: - * - * $query->filterByLogin('fooValue'); // WHERE login = 'fooValue' - * $query->filterByLogin('%fooValue%'); // WHERE login LIKE '%fooValue%' - * - * - * @param string $login The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByLogin($login = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($login)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $login)) { - $login = str_replace('*', '%', $login); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CcSessPeer::LOGIN, $login, $comparison); - } - - /** - * Filter the query on the ts column - * - * Example usage: - * - * $query->filterByTs('2011-03-14'); // WHERE ts = '2011-03-14' - * $query->filterByTs('now'); // WHERE ts = '2011-03-14' - * $query->filterByTs(array('max' => 'yesterday')); // WHERE ts < '2011-03-13' - * - * - * @param mixed $ts The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByTs($ts = null, $comparison = null) - { - if (is_array($ts)) { - $useMinMax = false; - if (isset($ts['min'])) { - $this->addUsingAlias(CcSessPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($ts['max'])) { - $this->addUsingAlias(CcSessPeer::TS, $ts['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CcSessPeer::TS, $ts, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - if ($ccSubjs instanceof CcSubjs) { - return $this - ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->getDbId(), $comparison); - } elseif ($ccSubjs instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison); - } else { - throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSessQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Exclude object from result - * - * @param CcSess $ccSess Object to remove from the list of results - * - * @return CcSessQuery The current query, for fluid interface - */ - public function prune($ccSess = null) - { - if ($ccSess) { - $this->addUsingAlias(CcSessPeer::SESSID, $ccSess->getSessid(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} diff --git a/legacy/application/models/airtime/om/BaseCcSubjs.php b/legacy/application/models/airtime/om/BaseCcSubjs.php index 42046aa66..af05a2c5a 100644 --- a/legacy/application/models/airtime/om/BaseCcSubjs.php +++ b/legacy/application/models/airtime/om/BaseCcSubjs.php @@ -155,12 +155,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent protected $collCcPrefs; protected $collCcPrefsPartial; - /** - * @var PropelObjectCollection|CcSess[] Collection to store aggregation of CcSess objects. - */ - protected $collCcSesss; - protected $collCcSesssPartial; - /** * @var PropelObjectCollection|CcSubjsToken[] Collection to store aggregation of CcSubjsToken objects. */ @@ -235,12 +229,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent */ protected $ccPrefsScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var PropelObjectCollection - */ - protected $ccSesssScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var PropelObjectCollection @@ -901,8 +889,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collCcPrefs = null; - $this->collCcSesss = null; - $this->collCcSubjsTokens = null; $this->collPodcasts = null; @@ -1152,23 +1138,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - if ($this->ccSesssScheduledForDeletion !== null) { - if (!$this->ccSesssScheduledForDeletion->isEmpty()) { - CcSessQuery::create() - ->filterByPrimaryKeys($this->ccSesssScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->ccSesssScheduledForDeletion = null; - } - } - - if ($this->collCcSesss !== null) { - foreach ($this->collCcSesss as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->ccSubjsTokensScheduledForDeletion !== null) { if (!$this->ccSubjsTokensScheduledForDeletion->isEmpty()) { CcSubjsTokenQuery::create() @@ -1476,14 +1445,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - if ($this->collCcSesss !== null) { - foreach ($this->collCcSesss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - if ($this->collCcSubjsTokens !== null) { foreach ($this->collCcSubjsTokens as $referrerFK) { if (!$referrerFK->validate($columns)) { @@ -1644,9 +1605,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if (null !== $this->collCcPrefs) { $result['CcPrefs'] = $this->collCcPrefs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collCcSesss) { - $result['CcSesss'] = $this->collCcSesss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collCcSubjsTokens) { $result['CcSubjsTokens'] = $this->collCcSubjsTokens->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1912,12 +1870,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - foreach ($this->getCcSesss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcSess($relObj->copy($deepCopy)); - } - } - foreach ($this->getCcSubjsTokens() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCcSubjsToken($relObj->copy($deepCopy)); @@ -2012,9 +1964,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ('CcPref' == $relationName) { $this->initCcPrefs(); } - if ('CcSess' == $relationName) { - $this->initCcSesss(); - } if ('CcSubjsToken' == $relationName) { $this->initCcSubjsTokens(); } @@ -3623,231 +3572,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent return $this; } - /** - * Clears out the collCcSesss collection - * - * 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 CcSubjs The current object (for fluent API support) - * @see addCcSesss() - */ - public function clearCcSesss() - { - $this->collCcSesss = null; // important to set this to null since that means it is uninitialized - $this->collCcSesssPartial = null; - - return $this; - } - - /** - * reset is the collCcSesss collection loaded partially - * - * @return void - */ - public function resetPartialCcSesss($v = true) - { - $this->collCcSesssPartial = $v; - } - - /** - * Initializes the collCcSesss collection. - * - * By default this just sets the collCcSesss collection to an empty array (like clearcollCcSesss()); - * 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. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initCcSesss($overrideExisting = true) - { - if (null !== $this->collCcSesss && !$overrideExisting) { - return; - } - $this->collCcSesss = new PropelObjectCollection(); - $this->collCcSesss->setModel('CcSess'); - } - - /** - * Gets an array of CcSess objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|CcSess[] List of CcSess objects - * @throws PropelException - */ - public function getCcSesss($criteria = null, PropelPDO $con = null) - { - $partial = $this->collCcSesssPartial && !$this->isNew(); - if (null === $this->collCcSesss || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCcSesss) { - // return empty collection - $this->initCcSesss(); - } else { - $collCcSesss = CcSessQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collCcSesssPartial && count($collCcSesss)) { - $this->initCcSesss(false); - - foreach ($collCcSesss as $obj) { - if (false == $this->collCcSesss->contains($obj)) { - $this->collCcSesss->append($obj); - } - } - - $this->collCcSesssPartial = true; - } - - $collCcSesss->getInternalIterator()->rewind(); - - return $collCcSesss; - } - - if ($partial && $this->collCcSesss) { - foreach ($this->collCcSesss as $obj) { - if ($obj->isNew()) { - $collCcSesss[] = $obj; - } - } - } - - $this->collCcSesss = $collCcSesss; - $this->collCcSesssPartial = false; - } - } - - return $this->collCcSesss; - } - - /** - * Sets a collection of CcSess objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $ccSesss A Propel collection. - * @param PropelPDO $con Optional connection object - * @return CcSubjs The current object (for fluent API support) - */ - public function setCcSesss(PropelCollection $ccSesss, PropelPDO $con = null) - { - $ccSesssToDelete = $this->getCcSesss(new Criteria(), $con)->diff($ccSesss); - - - $this->ccSesssScheduledForDeletion = $ccSesssToDelete; - - foreach ($ccSesssToDelete as $ccSessRemoved) { - $ccSessRemoved->setCcSubjs(null); - } - - $this->collCcSesss = null; - foreach ($ccSesss as $ccSess) { - $this->addCcSess($ccSess); - } - - $this->collCcSesss = $ccSesss; - $this->collCcSesssPartial = false; - - return $this; - } - - /** - * Returns the number of related CcSess objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcSess objects. - * @throws PropelException - */ - public function countCcSesss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collCcSesssPartial && !$this->isNew(); - if (null === $this->collCcSesss || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCcSesss) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getCcSesss()); - } - $query = CcSessQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCcSubjs($this) - ->count($con); - } - - return count($this->collCcSesss); - } - - /** - * Method called to associate a CcSess object to this object - * through the CcSess foreign key attribute. - * - * @param CcSess $l CcSess - * @return CcSubjs The current object (for fluent API support) - */ - public function addCcSess(CcSess $l) - { - if ($this->collCcSesss === null) { - $this->initCcSesss(); - $this->collCcSesssPartial = true; - } - - if (!in_array($l, $this->collCcSesss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddCcSess($l); - - if ($this->ccSesssScheduledForDeletion and $this->ccSesssScheduledForDeletion->contains($l)) { - $this->ccSesssScheduledForDeletion->remove($this->ccSesssScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param CcSess $ccSess The ccSess object to add. - */ - protected function doAddCcSess($ccSess) - { - $this->collCcSesss[]= $ccSess; - $ccSess->setCcSubjs($this); - } - - /** - * @param CcSess $ccSess The ccSess object to remove. - * @return CcSubjs The current object (for fluent API support) - */ - public function removeCcSess($ccSess) - { - if ($this->getCcSesss()->contains($ccSess)) { - $this->collCcSesss->remove($this->collCcSesss->search($ccSess)); - if (null === $this->ccSesssScheduledForDeletion) { - $this->ccSesssScheduledForDeletion = clone $this->collCcSesss; - $this->ccSesssScheduledForDeletion->clear(); - } - $this->ccSesssScheduledForDeletion[]= $ccSess; - $ccSess->setCcSubjs(null); - } - - return $this; - } - /** * Clears out the collCcSubjsTokens collection * @@ -4374,11 +4098,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $o->clearAllReferences($deep); } } - if ($this->collCcSesss) { - foreach ($this->collCcSesss as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collCcSubjsTokens) { foreach ($this->collCcSubjsTokens as $o) { $o->clearAllReferences($deep); @@ -4421,10 +4140,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collCcPrefs->clearIterator(); } $this->collCcPrefs = null; - if ($this->collCcSesss instanceof PropelCollection) { - $this->collCcSesss->clearIterator(); - } - $this->collCcSesss = null; if ($this->collCcSubjsTokens instanceof PropelCollection) { $this->collCcSubjsTokens->clearIterator(); } diff --git a/legacy/application/models/airtime/om/BaseCcSubjsPeer.php b/legacy/application/models/airtime/om/BaseCcSubjsPeer.php index e6baad439..83e2aef47 100644 --- a/legacy/application/models/airtime/om/BaseCcSubjsPeer.php +++ b/legacy/application/models/airtime/om/BaseCcSubjsPeer.php @@ -430,9 +430,6 @@ abstract class BaseCcSubjsPeer // Invalidate objects in CcPrefPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcPrefPeer::clearInstancePool(); - // Invalidate objects in CcSessPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcSessPeer::clearInstancePool(); // Invalidate objects in CcSubjsTokenPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcSubjsTokenPeer::clearInstancePool(); diff --git a/legacy/application/models/airtime/om/BaseCcSubjsQuery.php b/legacy/application/models/airtime/om/BaseCcSubjsQuery.php index 11fab88b1..aae052046 100644 --- a/legacy/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/legacy/application/models/airtime/om/BaseCcSubjsQuery.php @@ -66,10 +66,6 @@ * @method CcSubjsQuery rightJoinCcPref($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPref relation * @method CcSubjsQuery innerJoinCcPref($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPref relation * - * @method CcSubjsQuery leftJoinCcSess($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSess relation - * @method CcSubjsQuery rightJoinCcSess($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSess relation - * @method CcSubjsQuery innerJoinCcSess($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSess relation - * * @method CcSubjsQuery leftJoinCcSubjsToken($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjsToken relation * @method CcSubjsQuery rightJoinCcSubjsToken($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsToken relation * @method CcSubjsQuery innerJoinCcSubjsToken($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsToken relation @@ -1252,80 +1248,6 @@ abstract class BaseCcSubjsQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcPref', 'CcPrefQuery'); } - /** - * Filter the query by a related CcSess object - * - * @param CcSess|PropelObjectCollection $ccSess the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCcSess($ccSess, $comparison = null) - { - if ($ccSess instanceof CcSess) { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccSess->getUserid(), $comparison); - } elseif ($ccSess instanceof PropelObjectCollection) { - return $this - ->useCcSessQuery() - ->filterByPrimaryKeys($ccSess->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByCcSess() only accepts arguments of type CcSess or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the CcSess relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcSess($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSess'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSess'); - } - - return $this; - } - - /** - * Use the CcSess relation CcSess object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSessQuery A secondary query class using the current class as primary query - */ - public function useCcSessQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSess($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSess', 'CcSessQuery'); - } - /** * Filter the query by a related CcSubjsToken object * diff --git a/legacy/build/schema.xml b/legacy/build/schema.xml index e901bc556..40e89a4db 100644 --- a/legacy/build/schema.xml +++ b/legacy/build/schema.xml @@ -373,21 +373,6 @@ - - - - - - - - - - - - - - -