Skip to content

Commit

Permalink
Introducing ConnectionInterface.
Browse files Browse the repository at this point in the history
This is the first step before using an adapter logic for the connection objects.
All PropelPDO type hints were turned into a ConnectionInterface type hint.
  • Loading branch information
fzaninotto committed Nov 1, 2011
1 parent 57c4518 commit 5cc8910
Show file tree
Hide file tree
Showing 54 changed files with 885 additions and 676 deletions.
Expand Up @@ -2,11 +2,11 @@
/**
* Computes the value of the aggregate column <?php echo $column->getName() ?>
*
* @param PropelPDO $con A connection object
* @param ConnectionInterface $con A connection object
*
* @return mixed The scalar result from the aggregate query
*/
public function compute<?php echo $column->getPhpName() ?>(PropelPDO $con)
public function compute<?php echo $column->getPhpName() ?>(ConnectionInterface $con)
{
$stmt = $con->prepare('<?php echo $sql ?>');
<?php foreach ($bindings as $key => $binding): ?>
Expand Down
Expand Up @@ -2,9 +2,9 @@
/**
* Updates the aggregate column <?php echo $column->getName() ?>
*
* @param PropelPDO $con A connection object
* @param ConnectionInterface $con A connection object
*/
public function update<?php echo $column->getPhpName() ?>(PropelPDO $con)
public function update<?php echo $column->getPhpName() ?>(ConnectionInterface $con)
{
$this->set<?php echo $column->getPhpName() ?>($this->compute<?php echo $column->getPhpName() ?>($con));
$this->save($con);
Expand Down
Expand Up @@ -2,9 +2,9 @@
/**
* Update the aggregate column in the related <?php echo $relationName ?> object
*
* @param PropelPDO $con A connection object
* @param ConnectionInterface $con A connection object
*/
protected function updateRelated<?php echo $relationName ?>(PropelPDO $con)
protected function updateRelated<?php echo $relationName ?>(ConnectionInterface $con)
{
if ($<?php echo $variableName ?> = $this->get<?php echo $relationName ?>()) {
$<?php echo $variableName ?>-><?php echo $updateMethodName ?>($con);
Expand Down
Expand Up @@ -2,7 +2,7 @@
/**
* Finds the related <?php echo $foreignTable->getPhpName() ?> objects and keep them for later
*
* @param PropelPDO $con A connection object
* @param ConnectionInterface $con A connection object
*/
protected function findRelated<?php echo $relationName ?>s($con)
{
Expand Down
Expand Up @@ -4,13 +4,13 @@
* If the current object has already been archived, the archived object
* is updated and not duplicated.
*
* @param PropelPDO $con Optional connection object
* @param ConnectionInterface $con Optional connection object
*
* @throws PropelException If the object is new
*
* @return <?php echo $archiveTablePhpName ?> The archive object based on this object
*/
public function archive(PropelPDO $con = null)
public function archive(ConnectionInterface $con = null)
{
if ($this->isNew()) {
throw new PropelException('New objects cannot be archived. You must save the current object before calling archive().');
Expand Down
Expand Up @@ -2,11 +2,11 @@
/**
* Removes the object from the database without archiving it.
*
* @param PropelPDO $con Optional connection object
* @param ConnectionInterface $con Optional connection object
*
* @return <?php echo $objectClassname ?> The current object (for fluent API support)
*/
public function deleteWithoutArchive(PropelPDO $con = null)
public function deleteWithoutArchive(ConnectionInterface $con = null)
{
$this->archiveOnDelete = false;

Expand Down
Expand Up @@ -2,11 +2,11 @@
/**
* Get an archived version of the current object.
*
* @param PropelPDO $con Optional connection object
* @param ConnectionInterface $con Optional connection object
*
* @return <?php echo $archiveTablePhpName ?> An archive object, or null if the current object was never archived
*/
public function getArchive(PropelPDO $con = null)
public function getArchive(ConnectionInterface $con = null)
{
if ($this->isNew()) {
return null;
Expand Down
Expand Up @@ -3,13 +3,13 @@
* Revert the the current object to the state it had when it was last archived.
* The object must be saved afterwards if the changes must persist.
*
* @param PropelPDO $con Optional connection object
* @param ConnectionInterface $con Optional connection object
*
* @throws PropelException If the object has no corresponding archive.
*
* @return <?php echo $objectClassname ?> The current object (for fluent API support)
*/
public function restoreFromArchive(PropelPDO $con = null)
public function restoreFromArchive(ConnectionInterface $con = null)
{
if (!$archive = $this->getArchive($con)) {
throw new PropelException('The current object has never been archived and cannot be restored');
Expand Down
Expand Up @@ -2,11 +2,11 @@
/**
* Persists the object to the database without archiving it.
*
* @param PropelPDO $con Optional connection object
* @param ConnectionInterface $con Optional connection object
*
* @return <?php echo $objectClassname ?> The current object (for fluent API support)
*/
public function saveWithoutArchive(PropelPDO $con = null)
public function saveWithoutArchive(ConnectionInterface $con = null)
{
<?php if (!$isArchiveOnInsert): ?>
if (!$this->isNew()) {
Expand Down
Expand Up @@ -6,7 +6,7 @@
* is updated and not duplicated.
* Warning: This termination methods issues 2n+1 queries.
*
* @param PropelPDO $con Connection to use.
* @param ConnectionInterface $con Connection to use.
* @param Boolean $useLittleMemory Whether or not to use PropelOnDemandFormatter to retrieve objects.
* Set to false if the identity map matters.
* Set to true (default) to use less memory.
Expand Down
Expand Up @@ -2,7 +2,7 @@
/**
* Delete records matching the current query without archiving them.
*
* @param PropelPDO $con Connection to use.
* @param ConnectionInterface $con Connection to use.
*
* @return integer the number of deleted rows
*/
Expand All @@ -16,7 +16,7 @@ public function deleteWithoutArchive($con = null)
/**
* Delete all records without archiving them.
*
* @param PropelPDO $con Connection to use.
* @param ConnectionInterface $con Connection to use.
*
* @return integer the number of deleted rows
*/
Expand Down
Expand Up @@ -3,7 +3,7 @@
* Delete records matching the current query without archiving them.
*
* @param array $values Associative array of keys and values to replace
* @param PropelPDO $con an optional connection object
* @param ConnectionInterface $con an optional connection object
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
*
* @return integer the number of deleted rows
Expand Down
Expand Up @@ -2,11 +2,11 @@
/**
* Returns the current translation
*
* @param PropelPDO $con an optional connection object
* @param ConnectionInterface $con an optional connection object
*
* @return <?php echo $i18nTablePhpName ?>
*/
public function getCurrentTranslation(PropelPDO $con = null)
public function getCurrentTranslation(ConnectionInterface $con = null)
{
return $this->getTranslation($this->getLocale(), $con);
}
Expand Up @@ -3,11 +3,11 @@
* Returns the current translation for a given locale
*
* @param string $locale Locale to use for the translation, e.g. 'fr_FR'
* @param PropelPDO $con an optional connection object
* @param ConnectionInterface $con an optional connection object
*
* @return <?php echo $i18nTablePhpName ?>
*/
public function getTranslation($locale = '<?php echo $defaultLocale ?>', PropelPDO $con = null)
public function getTranslation($locale = '<?php echo $defaultLocale ?>', ConnectionInterface $con = null)
{
if (!isset($this->currentTranslations[$locale])) {
if (null !== $this-><?php echo $i18nListVariable ?>) {
Expand Down
Expand Up @@ -3,11 +3,11 @@
* Remove the translation for a given locale
*
* @param string $locale Locale to use for the translation, e.g. 'fr_FR'
* @param PropelPDO $con an optional connection object
* @param ConnectionInterface $con an optional connection object
*
* @return <?php echo $objectClassname ?> The current object (for fluent API support)
*/
public function removeTranslation($locale = '<?php echo $defaultLocale ?>', PropelPDO $con = null)
public function removeTranslation($locale = '<?php echo $defaultLocale ?>', ConnectionInterface $con = null)
{
if (!$this->isNew()) {
<?php echo $i18nQueryName ?>::create()
Expand Down

0 comments on commit 5cc8910

Please sign in to comment.