cc-3936: Made phpName of foreign key conform to Fk prefix convention.

This commit is contained in:
Rudi Grinberg 2012-08-24 11:10:05 -04:00
parent 857be6b702
commit 4efdf71aea
7 changed files with 49 additions and 49 deletions

View file

@ -110,7 +110,7 @@ class CcFilesTableMap extends TableMap {
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('Owner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null); $this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
$this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); $this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null); $this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);

View file

@ -419,7 +419,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
/** /**
* @var CcSubjs * @var CcSubjs
*/ */
protected $aOwner; protected $aFkOwner;
/** /**
* @var CcSubjs * @var CcSubjs
@ -2626,8 +2626,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->modifiedColumns[] = CcFilesPeer::OWNER_ID; $this->modifiedColumns[] = CcFilesPeer::OWNER_ID;
} }
if ($this->aOwner !== null && $this->aOwner->getDbId() !== $v) { if ($this->aFkOwner !== null && $this->aFkOwner->getDbId() !== $v) {
$this->aOwner = null; $this->aFkOwner = null;
} }
return $this; return $this;
@ -2798,8 +2798,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) { if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) {
$this->aCcSubjsRelatedByDbEditedby = null; $this->aCcSubjsRelatedByDbEditedby = null;
} }
if ($this->aOwner !== null && $this->owner_id !== $this->aOwner->getDbId()) { if ($this->aFkOwner !== null && $this->owner_id !== $this->aFkOwner->getDbId()) {
$this->aOwner = null; $this->aFkOwner = null;
} }
} // ensureConsistency } // ensureConsistency
@ -2840,7 +2840,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aOwner = null; $this->aFkOwner = null;
$this->aCcSubjsRelatedByDbEditedby = null; $this->aCcSubjsRelatedByDbEditedby = null;
$this->aCcMusicDirs = null; $this->aCcMusicDirs = null;
$this->collCcShowInstancess = null; $this->collCcShowInstancess = null;
@ -2966,11 +2966,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
// method. This object relates to these object(s) by a // method. This object relates to these object(s) by a
// foreign key reference. // foreign key reference.
if ($this->aOwner !== null) { if ($this->aFkOwner !== null) {
if ($this->aOwner->isModified() || $this->aOwner->isNew()) { if ($this->aFkOwner->isModified() || $this->aFkOwner->isNew()) {
$affectedRows += $this->aOwner->save($con); $affectedRows += $this->aFkOwner->save($con);
} }
$this->setOwner($this->aOwner); $this->setFkOwner($this->aFkOwner);
} }
if ($this->aCcSubjsRelatedByDbEditedby !== null) { if ($this->aCcSubjsRelatedByDbEditedby !== null) {
@ -3113,9 +3113,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
// method. This object relates to these object(s) by a // method. This object relates to these object(s) by a
// foreign key reference. // foreign key reference.
if ($this->aOwner !== null) { if ($this->aFkOwner !== null) {
if (!$this->aOwner->validate($columns)) { if (!$this->aFkOwner->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aOwner->getValidationFailures()); $failureMap = array_merge($failureMap, $this->aFkOwner->getValidationFailures());
} }
} }
@ -3484,8 +3484,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$keys[63] => $this->getDbOwnerId(), $keys[63] => $this->getDbOwnerId(),
); );
if ($includeForeignObjects) { if ($includeForeignObjects) {
if (null !== $this->aOwner) { if (null !== $this->aFkOwner) {
$result['Owner'] = $this->aOwner->toArray($keyType, $includeLazyLoadColumns, true); $result['FkOwner'] = $this->aFkOwner->toArray($keyType, $includeLazyLoadColumns, true);
} }
if (null !== $this->aCcSubjsRelatedByDbEditedby) { if (null !== $this->aCcSubjsRelatedByDbEditedby) {
$result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, true); $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, true);
@ -4085,7 +4085,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
* @return CcFiles The current object (for fluent API support) * @return CcFiles The current object (for fluent API support)
* @throws PropelException * @throws PropelException
*/ */
public function setOwner(CcSubjs $v = null) public function setFkOwner(CcSubjs $v = null)
{ {
if ($v === null) { if ($v === null) {
$this->setDbOwnerId(NULL); $this->setDbOwnerId(NULL);
@ -4093,7 +4093,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->setDbOwnerId($v->getDbId()); $this->setDbOwnerId($v->getDbId());
} }
$this->aOwner = $v; $this->aFkOwner = $v;
// Add binding for other direction of this n:n relationship. // 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 this object has already been added to the CcSubjs object, it will not be re-added.
@ -4112,19 +4112,19 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
* @return CcSubjs The associated CcSubjs object. * @return CcSubjs The associated CcSubjs object.
* @throws PropelException * @throws PropelException
*/ */
public function getOwner(PropelPDO $con = null) public function getFkOwner(PropelPDO $con = null)
{ {
if ($this->aOwner === null && ($this->owner_id !== null)) { if ($this->aFkOwner === null && ($this->owner_id !== null)) {
$this->aOwner = CcSubjsQuery::create()->findPk($this->owner_id, $con); $this->aFkOwner = CcSubjsQuery::create()->findPk($this->owner_id, $con);
/* The following can be used additionally to /* The following can be used additionally to
guarantee the related object contains a reference guarantee the related object contains a reference
to this object. This level of coupling may, however, be to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection undesirable since it could result in an only partially populated collection
in the referenced object. in the referenced object.
$this->aOwner->addCcFilessRelatedByDbOwnerId($this); $this->aFkOwner->addCcFilessRelatedByDbOwnerId($this);
*/ */
} }
return $this->aOwner; return $this->aFkOwner;
} }
/** /**
@ -4952,7 +4952,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->collCcPlaylistcontentss = null; $this->collCcPlaylistcontentss = null;
$this->collCcBlockcontentss = null; $this->collCcBlockcontentss = null;
$this->collCcSchedules = null; $this->collCcSchedules = null;
$this->aOwner = null; $this->aFkOwner = null;
$this->aCcSubjsRelatedByDbEditedby = null; $this->aCcSubjsRelatedByDbEditedby = null;
$this->aCcMusicDirs = null; $this->aCcMusicDirs = null;
} }

View file

@ -758,7 +758,7 @@ abstract class BaseCcFilesPeer {
} }
/** /**
* Returns the number of rows matching criteria, joining the related Owner table * Returns the number of rows matching criteria, joining the related FkOwner table
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
@ -766,7 +766,7 @@ abstract class BaseCcFilesPeer {
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows. * @return int Number of matching rows.
*/ */
public static function doCountJoinOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doCountJoinFkOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
// we're going to modify criteria, so copy it first // we're going to modify criteria, so copy it first
$criteria = clone $criteria; $criteria = clone $criteria;
@ -916,7 +916,7 @@ abstract class BaseCcFilesPeer {
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doSelectJoinOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doSelectJoinFkOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
$criteria = clone $criteria; $criteria = clone $criteria;
@ -1274,7 +1274,7 @@ abstract class BaseCcFilesPeer {
/** /**
* Returns the number of rows matching criteria, joining the related Owner table * Returns the number of rows matching criteria, joining the related FkOwner table
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
@ -1282,7 +1282,7 @@ abstract class BaseCcFilesPeer {
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows. * @return int Number of matching rows.
*/ */
public static function doCountJoinAllExceptOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doCountJoinAllExceptFkOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
// we're going to modify criteria, so copy it first // we're going to modify criteria, so copy it first
$criteria = clone $criteria; $criteria = clone $criteria;
@ -1426,7 +1426,7 @@ abstract class BaseCcFilesPeer {
/** /**
* Selects a collection of CcFiles objects pre-filled with all related objects except Owner. * Selects a collection of CcFiles objects pre-filled with all related objects except FkOwner.
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param PropelPDO $con * @param PropelPDO $con
@ -1435,7 +1435,7 @@ abstract class BaseCcFilesPeer {
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doSelectJoinAllExceptOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doSelectJoinAllExceptFkOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
$criteria = clone $criteria; $criteria = clone $criteria;

View file

@ -140,9 +140,9 @@
* @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method CcFilesQuery leftJoinOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the Owner relation * @method CcFilesQuery leftJoinFkOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the FkOwner relation
* @method CcFilesQuery rightJoinOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the Owner relation * @method CcFilesQuery rightJoinFkOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the FkOwner relation
* @method CcFilesQuery innerJoinOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the Owner relation * @method CcFilesQuery innerJoinFkOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the FkOwner relation
* *
* @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
* @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
@ -1950,24 +1950,24 @@ abstract class BaseCcFilesQuery extends ModelCriteria
* *
* @return CcFilesQuery The current query, for fluid interface * @return CcFilesQuery The current query, for fluid interface
*/ */
public function filterByOwner($ccSubjs, $comparison = null) public function filterByFkOwner($ccSubjs, $comparison = null)
{ {
return $this return $this
->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison); ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison);
} }
/** /**
* Adds a JOIN clause to the query using the Owner relation * Adds a JOIN clause to the query using the FkOwner relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return CcFilesQuery The current query, for fluid interface * @return CcFilesQuery The current query, for fluid interface
*/ */
public function joinOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN) public function joinFkOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Owner'); $relationMap = $tableMap->getRelation('FkOwner');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@ -1982,14 +1982,14 @@ abstract class BaseCcFilesQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Owner'); $this->addJoinObject($join, 'FkOwner');
} }
return $this; return $this;
} }
/** /**
* Use the Owner relation CcSubjs object * Use the FkOwner relation CcSubjs object
* *
* @see useQuery() * @see useQuery()
* *
@ -1999,11 +1999,11 @@ abstract class BaseCcFilesQuery extends ModelCriteria
* *
* @return CcSubjsQuery A secondary query class using the current class as primary query * @return CcSubjsQuery A secondary query class using the current class as primary query
*/ */
public function useOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) public function useFkOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{ {
return $this return $this
->joinOwner($relationAlias, $joinType) ->joinFkOwner($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Owner', 'CcSubjsQuery'); ->useQuery($relationAlias ? $relationAlias : 'FkOwner', 'CcSubjsQuery');
} }
/** /**

View file

@ -999,10 +999,10 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcFiles[] List of CcFiles objects * @return PropelCollection|array CcFiles[] List of CcFiles objects
*/ */
public function getCcFilessJoinOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) public function getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
$query = CcFilesQuery::create(null, $criteria); $query = CcFilesQuery::create(null, $criteria);
$query->joinWith('Owner', $join_behavior); $query->joinWith('FkOwner', $join_behavior);
return $this->getCcFiless($query, $con); return $this->getCcFiless($query, $con);
} }

View file

@ -1660,7 +1660,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->initCcFilessRelatedByDbOwnerId(); $this->initCcFilessRelatedByDbOwnerId();
} else { } else {
$collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria) $collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria)
->filterByOwner($this) ->filterByFkOwner($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
return $collCcFilessRelatedByDbOwnerId; return $collCcFilessRelatedByDbOwnerId;
@ -1691,7 +1691,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$query->distinct(); $query->distinct();
} }
return $query return $query
->filterByOwner($this) ->filterByFkOwner($this)
->count($con); ->count($con);
} }
} else { } else {
@ -1714,7 +1714,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
} }
if (!$this->collCcFilessRelatedByDbOwnerId->contains($l)) { // only add it if the **same** object is not already associated if (!$this->collCcFilessRelatedByDbOwnerId->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcFilessRelatedByDbOwnerId[]= $l; $this->collCcFilessRelatedByDbOwnerId[]= $l;
$l->setOwner($this); $l->setFkOwner($this);
} }
} }

View file

@ -76,7 +76,7 @@
<column name="soundcloud_upload_time" phpName="DbSoundCloundUploadTime" type="TIMESTAMP" size="6" required="false"/> <column name="soundcloud_upload_time" phpName="DbSoundCloundUploadTime" type="TIMESTAMP" size="6" required="false"/>
<column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false"/> <column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false"/>
<column name="owner_id" phpName="DbOwnerId" type="INTEGER" required="false"/> <column name="owner_id" phpName="DbOwnerId" type="INTEGER" required="false"/>
<foreign-key foreignTable="cc_subjs" phpName="Owner" name="cc_files_owner_fkey"> <foreign-key foreignTable="cc_subjs" phpName="FkOwner" name="cc_files_owner_fkey">
<reference local="owner_id" foreign="id"/> <reference local="owner_id" foreign="id"/>
</foreign-key> </foreign-key>
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey"> <foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">