Permalink
Browse files

Remove unused code

  • Loading branch information...
1 parent a073d42 commit 71e98a87d8a3990a9af950d2b7d04de634600593 @willdurand willdurand committed Jul 2, 2012
View
@@ -12,7 +12,6 @@
* Gives a model class the ability to support Equal Nest relations
*
* @author Ivan Plamenov Tanev aka Crafty_Shadow @ WEBWORLD.BG <vankata.t@gmail.com>
- * @package propel.generator.behavior.equal_nest
*/
class EqualNestBehavior extends Behavior
{
@@ -39,35 +38,35 @@ public function modifyTable()
$parentTablePrimaryKey = $parentTable->getPrimaryKey();
- if (!$this->getTable()->containsColumn($this->getRefecenceColumn1Name())) {
+ if (!$this->getTable()->containsColumn($this->getReferenceColumn1Name())) {
$this->getTable()->addColumn(array(
- 'name' => $this->getRefecenceColumn1Name(),
+ 'name' => $this->getReferenceColumn1Name(),
'primaryKey' => 'true',
'type' => 'INTEGER'
));
$fk = new ForeignKey();
- $fk->setName($this->getRefecenceColumn1Name());
+ $fk->setName($this->getReferenceColumn1Name());
$fk->setForeignTableCommonName($this->getParentTable()->getCommonName());
$fk->setOnDelete(ForeignKey::CASCADE);
$fk->setOnUpdate(null);
- $fk->addReference($this->getRefecenceColumn1Name(), $parentTablePrimaryKey[0]->getName());
+ $fk->addReference($this->getReferenceColumn1Name(), $parentTablePrimaryKey[0]->getName());
$this->getTable()->addForeignKey($fk);
}
- if (!$this->getTable()->containsColumn($this->getRefecenceColumn2Name())) {
+ if (!$this->getTable()->containsColumn($this->getReferenceColumn2Name())) {
$this->getTable()->addColumn(array(
- 'name' => $this->getRefecenceColumn2Name(),
+ 'name' => $this->getReferenceColumn2Name(),
'primaryKey' => 'true',
'type' => 'INTEGER',
));
$fk = new ForeignKey();
- $fk->setName($this->getRefecenceColumn2Name());
+ $fk->setName($this->getReferenceColumn2Name());
$fk->setForeignTableCommonName($this->getParentTable()->getCommonName());
$fk->setOnDelete(ForeignKey::CASCADE);
$fk->setOnUpdate(null);
- $fk->addReference($this->getRefecenceColumn2Name(), $parentTablePrimaryKey[0]->getName());
+ $fk->addReference($this->getReferenceColumn2Name(), $parentTablePrimaryKey[0]->getName());
$this->getTable()->addForeignKey($fk);
}
@@ -150,7 +149,7 @@ protected function getParentTable()
return $this->getTable()->getDatabase()->getTable($this->getParameter('parent_table'));
}
- public function getRefecenceColumn1Name()
+ public function getReferenceColumn1Name()
{
if (null === $this->getParameter('reference_column_1')) {
return strtolower($this->getParentTable()->getPhpName()) . '_1';
@@ -159,7 +158,7 @@ public function getRefecenceColumn1Name()
}
}
- public function getRefecenceColumn2Name()
+ public function getReferenceColumn2Name()
{
if (null === $this->getParameter('reference_column_2')) {
return strtolower($this->getParentTable()->getPhpName()) . '_2';
@@ -170,21 +169,21 @@ public function getRefecenceColumn2Name()
public function getReferenceColumn1()
{
- return $this->table->getColumn($this->getRefecenceColumn1Name());
+ return $this->table->getColumn($this->getReferenceColumn1Name());
}
public function getReferenceColumn2()
{
- return $this->table->getColumn($this->getRefecenceColumn2Name());
+ return $this->table->getColumn($this->getReferenceColumn2Name());
}
protected function getSetterForReferenceColumn1()
{
- return sprintf('set%s', $this->getTable()->getColumn($this->getRefecenceColumn1Name())->getPhpName());
+ return sprintf('set%s', $this->getTable()->getColumn($this->getReferenceColumn1Name())->getPhpName());
}
protected function getSetterForReferenceColumn2()
{
- return sprintf('set%s', $this->getTable()->getColumn($this->getRefecenceColumn2Name())->getPhpName());
+ return sprintf('set%s', $this->getTable()->getColumn($this->getReferenceColumn2Name())->getPhpName());
}
}
@@ -33,10 +33,8 @@ public function __construct($behavior, $middleTable)
public function objectAttributes($builder)
{
- $objectClassname = $builder->getStubObjectBuilder()->getClassname();
-
return $this->behavior->renderTemplate('objectAttributes', array(
- 'objectClassname' => $objectClassname,
+ 'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
'refClassName' => $this->middleTable->getPhpName(),
'collName' => $this->getEqualNestCollectionName($builder),
'listName' => $this->getEqualNestListPksName($builder),
@@ -86,27 +84,27 @@ public function objectClearReferences($builder)
), '/templates/parent/');
}
- public function addPorcessEqualNestQueries($builder)
+ protected function addPorcessEqualNestQueries($builder)
{
return $this->behavior->renderTemplate('processEqualNestQueries', array(
'collName' => $this->getEqualNestCollectionName($builder),
'listName' => $this->getEqualNestListPksName($builder),
'peerClassname' => $builder->getStubPeerBuilder()->getClassname(),
- 'refPeerClassname' => $builder->getNewStubPeerBuilder($this->behavior->getMiddleTable())->getClassname(),
+ 'refPeerClassname' => $builder->getNewStubPeerBuilder($this->middleTable)->getClassname(),
'refTableName' => $this->middleTable->getPhpName(),
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
), '/templates/parent/');
}
- public function addClearListRelatedPKs($builder)
+ protected function addClearListRelatedPKs($builder)
{
return $this->behavior->renderTemplate('clearListRelatedPks', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
'listName' => $this->getEqualNestListPksName($builder),
), '/templates/parent/');
}
- public function addInitListRelatedPKs($builder)
+ protected function addInitListRelatedPKs($builder)
{
return $this->behavior->renderTemplate('addInitListRelatedPKs', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
@@ -122,7 +120,7 @@ public function addInitListRelatedPKs($builder)
), '/templates/parent/');
}
- public function addClearRelatedCollection($builder)
+ protected function addClearRelatedCollection($builder)
{
return $this->behavior->renderTemplate('addClearRelatedCollection', array(
'refTableName' => $this->middleTable->getPhpName(),
@@ -131,7 +129,7 @@ public function addClearRelatedCollection($builder)
), '/templates/parent/');
}
- public function addInitRelatedCollection($builder)
+ protected function addInitRelatedCollection($builder)
{
return $this->behavior->renderTemplate('addInitRelatedCollection', array(
'varRelatedObjectsColl' => $this->getEqualNestCollectionName($builder),
@@ -140,15 +138,15 @@ public function addInitRelatedCollection($builder)
), '/templates/parent/');
}
- public function addRemoveAllRelations($builder)
+ protected function addRemoveAllRelations($builder)
{
return $this->behavior->renderTemplate('addRemoveAllRelations', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
'refTableName' => $this->middleTable->getPhpName(),
), '/templates/parent/');
}
- public function addGetRelatedCollection($builder)
+ protected function addGetRelatedCollection($builder)
{
return $this->behavior->renderTemplate('addGetRelatedCollection', array(
'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
@@ -160,7 +158,7 @@ public function addGetRelatedCollection($builder)
), '/templates/parent/');
}
- public function addSetRelatedCollection($builder)
+ protected function addSetRelatedCollection($builder)
{
return $this->behavior->renderTemplate('addSetRelatedCollection', array(
'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
@@ -169,7 +167,7 @@ public function addSetRelatedCollection($builder)
), '/templates/parent/');
}
- public function hasObjectInRelatedCollection($builder)
+ protected function hasObjectInRelatedCollection($builder)
{
return $this->behavior->renderTemplate('hasObjectInRelatedCollection', array(
'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
@@ -179,7 +177,7 @@ public function hasObjectInRelatedCollection($builder)
), '/templates/parent/');
}
- public function setObjectsOfRelatedCollection($builder)
+ protected function setObjectsOfRelatedCollection($builder)
{
return $this->behavior->renderTemplate('setObjectsOfRelatedCollection', array(
'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
@@ -189,7 +187,7 @@ public function setObjectsOfRelatedCollection($builder)
), '/templates/parent/');
}
- public function addObjectToRelatedCollection($builder)
+ protected function addObjectToRelatedCollection($builder)
{
return $this->behavior->renderTemplate('addObjectToRelatedCollection', array(
'objectClassname' => $builder->getStubObjectBuilder()->getClassname(),
@@ -198,7 +196,7 @@ public function addObjectToRelatedCollection($builder)
), '/templates/parent/');
}
- public function removeObjectFromRelatedCollection($builder)
+ protected function removeObjectFromRelatedCollection($builder)
{
return $this->behavior->renderTemplate('removeObjectFromRelatedCollection', array(
'refTableName' => $this->middleTable->getPhpName(),
@@ -209,7 +207,7 @@ public function removeObjectFromRelatedCollection($builder)
), '/templates/parent/');
}
- public function countObjectsInRelatedCollection($builder)
+ protected function countObjectsInRelatedCollection($builder)
{
return $this->behavior->renderTemplate('countObjectsInRelatedCollection', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
@@ -220,26 +218,6 @@ public function countObjectsInRelatedCollection($builder)
), '/templates/parent/');
}
- protected function getMiddleTable()
- {
- return $this->getTable()->getDatabase()->getTable($this->getParameter('extends'));
- }
-
- protected function getParameter($key)
- {
- return $this->behavior->getParameter($key);
- }
-
- protected function getColumnAttribute($name)
- {
- return strtolower($this->behavior->getColumnForParameter($name)->getName());
- }
-
- protected function getColumnPhpName($name)
- {
- return $this->behavior->getColumnForParameter($name)->getPhpName();
- }
-
protected function getEqualNestCollectionName($builder)
{
return 'collEqualNest' . $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName());
@@ -36,7 +36,7 @@ public function queryMethods($builder)
return $script;
}
- public function addFindRelatedObjects($builder)
+ protected function addFindRelatedObjects($builder)
{
return $this->behavior->renderTemplate('addFindRelatedObjects', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),
@@ -45,7 +45,7 @@ public function addFindRelatedObjects($builder)
), '/templates/parent/');
}
- public function addCountRelatedObjects($builder)
+ protected function addCountRelatedObjects($builder)
{
return $this->behavior->renderTemplate('addCountRelatedObjects', array(
'pluralRefTableName' => $builder->getPluralizer()->getPluralForm($this->middleTable->getPhpName()),

0 comments on commit 71e98a8

Please sign in to comment.