first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,122 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_draft_message' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessage extends BaseNewsletterDraftMessage
{
public function getSubject()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getSubject();
if (is_null($v)) {
$v = stLanguage::getDefaultValue($this, __METHOD__);
}
return $v;
}
/**
* Przeciążenie setName
*
* @param string
*/
public function setSubject($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setSubject($v);
}
public function getContent()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setContent($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setContent($v);
}
public function getCtaDescriptionHead()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaDescriptionHead($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaDescriptionHead($v);
}
public function getCtaDescriptionFoot()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaDescriptionFoot($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaDescriptionFoot($v);
}
public function getCtaButtonName()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaButtonName($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaButtonName($v);
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_draft_message_has_blog' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageHasBlog extends BaseNewsletterDraftMessageHasBlog
{
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_draft_message_has_blog' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageHasBlogPeer extends BaseNewsletterDraftMessageHasBlogPeer
{
public static function doSelectBlogForTokenInput(NewsletterDraftMessage $newsletterDraftMessage)
{
$c = new Criteria();
$c->add(NewsletterDraftMessageHasBlogPeer::NEWSLETTER_DRAFT_MESSAGE_ID, $newsletterDraftMessage->getId());
$c->addJoin(BlogPeer::ID, NewsletterDraftMessageHasBlogPeer::BLOG_ID);
$c->addAscendingOrderByColumn(NewsletterDraftMessageHasBlogPeer::ID);
return BlogPeer::doSelectTokens($c);
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_draft_message_has_product' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageHasProduct extends BaseNewsletterDraftMessageHasProduct
{
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_draft_message_has_product' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageHasProductPeer extends BaseNewsletterDraftMessageHasProductPeer
{
public static function doSelectProductForTokenInput(NewsletterDraftMessage $newsletterDraftMessage)
{
$c = new Criteria();
$c->add(NewsletterDraftMessageHasProductPeer::NEWSLETTER_DRAFT_MESSAGE_ID, $newsletterDraftMessage->getId());
$c->addJoin(ProductPeer::ID, NewsletterDraftMessageHasProductPeer::PRODUCT_ID);
$c->addAscendingOrderByColumn(NewsletterDraftMessageHasProductPeer::ID);
return ProductPeer::doSelectTokens($c);
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_draft_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageI18n extends BaseNewsletterDraftMessageI18n
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_draft_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessageI18nPeer extends BaseNewsletterDraftMessageI18nPeer
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_draft_message' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterDraftMessagePeer extends BaseNewsletterDraftMessagePeer
{
}

View File

@@ -0,0 +1,108 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_group' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterGroup extends BaseNewsletterGroup
{
public function getCountUsers()
{
$c = new Criteria();
$c->add(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID, $this->getId());
$c->add(NewsletterUserPeer::ACTIVE, 1);
$c->add(NewsletterUserPeer::CONFIRM, 1);
return NewsletterUserHasNewsletterGroupPeer::doCountJoinAll($c);
}
/**
* Przeciążenie hydrate
*
* @param ResultSet $rs
* @param int $startcol
* @return object
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
$this->setCulture(stLanguage::getHydrateCulture());
return parent::hydrate($rs, $startcol);
}
/**
* Przeciążenie getName
*
* @return string
*/
public function getName()
{
if ($this->getCulture() == stLanguage::getOptLanguage())
{
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getName();
if (is_null($v))
{
$v = stLanguage::getDefaultValue($this, __METHOD__);
}
return $v;
}
/**
* Przeciążenie setName
*
* @param string $v Nazwa producenta
*/
public function setName($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage())
{
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setName($v);
}
/**
* Przeciążenie getDescription
*
* @return string
*/
public function getDescription()
{
if ($this->getCulture() == stLanguage::getOptLanguage())
{
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getDescription();
if (is_null($v))
{
$v = stLanguage::getDefaultValue($this, __METHOD__);
}
return $v;
}
/**
* Przeciążenie setDescription
*
* @param string $v Nazwa producenta
*/
public function setDescription($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage())
{
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setDescription($v);
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_group_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterGroupI18n extends BaseNewsletterGroupI18n
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_group_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterGroupI18nPeer extends BaseNewsletterGroupI18nPeer
{
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* SOTESHOP/stNewsletterPlugin
*
* Ten plik należy do aplikacji stNewsletterPlugin opartej na licencji (Open License SOTE) Otwarta Licencja SOTE.
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stNewsletterPlugin
* @subpackage libs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
* @version $Id: NewsletterGroupPeer.php 10556 2011-01-27 12:27:02Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa NewsletterGroupPeer
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterGroupPeer extends BaseNewsletterGroupPeer
{
/**
* Przeciążenie metody doSelectWithI18n
*
* @param Criteria $c
* @param mixed $culture
* @param CreoleConnection $con
* @return array
*/
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
{
if ($culture === null)
{
$culture = stLanguage::getHydrateCulture();
}
if ($c->getDbName() == Propel::getDefaultDB())
{
$c->setDbName(self::DATABASE_NAME);
}
NewsletterGroupPeer::addSelectColumns($c);
$startcol = (NewsletterGroupPeer::NUM_COLUMNS - NewsletterGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
NewsletterGroupI18nPeer::addSelectColumns($c);
$c->addJoin(NewsletterGroupPeer::ID, sprintf("%s AND %s = '%s'", NewsletterGroupI18nPeer::ID, NewsletterGroupI18nPeer::CULTURE, $culture), Criteria::LEFT_JOIN);
$rs = BasePeer::doSelect($c, $con);
$results = array();
while($rs->next())
{
$omClass = NewsletterGroupPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
$obj1->setCulture($culture);
$omClass = NewsletterGroupI18nPeer::getOMClass($rs, $startcol);
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol);
$obj1->setNewsletterGroupI18nForCulture($obj2, $culture);
$obj2->setNewsletterGroup($obj1);
$results[] = $obj1;
}
return $results;
}
/**
* Metoda doCountWithI18n
*
* @param Criteria $c
* @param CreoleConnection $con
* @return integer
*/
public static function doCountWithI18n(Criteria $c, $con = null)
{
$c->addJoin(NewsletterGroupI18nPeer::ID, NewsletterGroupPeer::ID);
$c->add(NewsletterGroupI18nPeer::CULTURE, stLanguage::getHydrateCulture());
return self::doCount($c, $con);
}
}

View File

@@ -0,0 +1,187 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_message' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterMessage extends BaseNewsletterMessage
{
public function getUsers(Criteria $c)
{
$c = clone $c;
$this->addUserCriteria($c);
$c->addGroupByColumn(NewsletterUserPeer::ID);
return NewsletterUserPeer::doSelect($c);
}
public function countUsers(Criteria $c)
{
$c = clone $c;
$this->addUserCriteria($c);
return NewsletterUserPeer::doCount($c, true);
}
public function countGmailUsers(Criteria $c, $id)
{
$c = clone $c;
$this->addUserCriteria($c);
$c->addGroupByColumn(NewsletterUserPeer::ID);
$c->add(NewsletterUserPeer::ACTIVE, 1);
$c->add(NewsletterUserPeer::CONFIRM, 1);
$emails = NewsletterUserPeer::doSelect($c);
$i = 0;
foreach ($emails as $email) {
if (strpos($email->getEmail(),'gmail.com') !== false) {
$i++;
}
}
$newsletterMessage = NewsletterMessagePeer::retrieveByPK($id);
$newsletterMessage->setNumberSentGmail($i);
$newsletterMessage->save();
/*echo $i;
echo "<pre>";
print_r($emails);
echo "</pre>";*/
}
protected function addUserCriteria(Criteria $c)
{
$c->addJoin(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_USER_ID, NewsletterUserPeer::ID);
$c->addJoin(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID, NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID);
$c->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
$c->add(NewsletterUserPeer::ACTIVE, true);
$c->add(NewsletterUserPeer::CONFIRM, true);
}
public function getSubject()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getSubject();
if (is_null($v)) {
$v = stLanguage::getDefaultValue($this, __METHOD__);
}
return $v;
}
/**
* Przeciążenie setName
*
* @param string
*/
public function setSubject($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setSubject($v);
}
public function getContent()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setContent($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setContent($v);
}
public function getCtaDescriptionHead()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaDescriptionHead($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaDescriptionHead($v);
}
public function getCtaDescriptionFoot()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaDescriptionFoot($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaDescriptionFoot($v);
}
public function getCtaButtonName()
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
return stLanguage::getDefaultValue($this, __METHOD__);
}
$v = parent::getContent();
if (is_null($v))
$v = stLanguage::getDefaultValue($this, __METHOD__);
return $v;
}
public function setCtaButtonName($v)
{
if ($this->getCulture() == stLanguage::getOptLanguage()) {
stLanguage::setDefaultValue($this, __METHOD__, $v);
}
parent::setCtaButtonName($v);
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_message_has_blog' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasBlog extends BaseNewsletterMessageHasBlog
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_message_has_blog' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasBlogPeer extends BaseNewsletterMessageHasBlogPeer
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_message_has_newsletter_group' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasNewsletterGroup extends BaseNewsletterMessageHasNewsletterGroup
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_message_has_newsletter_group' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasNewsletterGroupPeer extends BaseNewsletterMessageHasNewsletterGroupPeer
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_message_has_product' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasProduct extends BaseNewsletterMessageHasProduct
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_message_has_product' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageHasProductPeer extends BaseNewsletterMessageHasProductPeer
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageI18n extends BaseNewsletterMessageI18n
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model
*/
class NewsletterMessageI18nPeer extends BaseNewsletterMessageI18nPeer
{
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_message' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterMessagePeer extends BaseNewsletterMessagePeer
{
public static function getAssignedById($id)
{
$c = new Criteria();
$c->addSelectColumn(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID);
$c->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $id);
NewsletterMessageHasNewsletterGroupPeer::setHydrateMethod(array('NewsletterMessagePeer', 'hydrateAssigned'));
$ret = NewsletterMessageHasNewsletterGroupPeer::doSelect($c);
NewsletterMessageHasNewsletterGroupPeer::setHydrateMethod(null);
return $ret;
}
public static function hydrateAssigned(ResultSet $rs)
{
$results = array();
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while($rs->next())
{
$results[$rs->getInt('NEWSLETTER_GROUP_ID')] = true;
}
return $results;
}
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_user' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterUser extends BaseNewsletterUser
{
public function getAdminGeneratorTitle()
{
return $this->getEmail();
}
public function save($con = null)
{
if ($this->isNew())
{
$this->generateHash();
}
parent::save($con);
}
public function setUserId($v)
{
$this->setSfGuardUserId($v);
}
public function getUserId()
{
return $this->getSfGuardUserId();
}
public function generateHash()
{
$this->setHash(md5(microtime()));
}
public function getHash()
{
if (parent::getHash() === null)
{
$this->generateHash();
$this->save();
}
return parent::getHash();
}
}

View File

@@ -0,0 +1,11 @@
<?php
/**
* Subclass for representing a row from the 'st_newsletter_user_has_newsletter_group' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterUserHasNewsletterGroup extends BaseNewsletterUserHasNewsletterGroup
{
}

View File

@@ -0,0 +1,11 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_user_has_newsletter_group' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterUserHasNewsletterGroupPeer extends BaseNewsletterUserHasNewsletterGroupPeer
{
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_newsletter_user' table.
*
* @package stNewsletterPlugin
* @subpackage libs
*/
class NewsletterUserPeer extends BaseNewsletterUserPeer
{
public static function retrieveByEmail($email)
{
$c = new Criteria();
$c->add(self::EMAIL, $email);
return self::doSelectOne($c);
}
public static function retrieveByHash($hash)
{
$c = new Criteria();
$c->add(self::HASH, $hash);
return self::doSelectOne($c);
}
public static function getAssignedById($id)
{
$c = new Criteria();
$c->addSelectColumn(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID);
$c->add(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_USER_ID, $id);
NewsletterUserHasNewsletterGroupPeer::setHydrateMethod(array('NewsletterUserPeer', 'hydrateAssigned'));
$ret = NewsletterUserHasNewsletterGroupPeer::doSelect($c);
NewsletterUserHasNewsletterGroupPeer::setHydrateMethod(null);
return $ret;
}
public static function hydrateAssigned(ResultSet $rs)
{
$results = array();
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while($rs->next())
{
$results[$rs->getInt('NEWSLETTER_GROUP_ID')] = true;
}
return $results;
}
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* This class adds structure of 'st_newsletter_draft_message_has_blog' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterDraftMessageHasBlogMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageHasBlogMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_draft_message_has_blog');
$tMap->setPhpName('NewsletterDraftMessageHasBlog');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_DRAFT_MESSAGE_ID', 'NewsletterDraftMessageId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_draft_message', 'ID', true, null);
$tMap->addForeignPrimaryKey('BLOG_ID', 'BlogId', 'int' , CreoleTypes::INTEGER, 'st_blog', 'ID', true, null);
} // doBuild()
} // NewsletterDraftMessageHasBlogMapBuilder

View File

@@ -0,0 +1,76 @@
<?php
/**
* This class adds structure of 'st_newsletter_draft_message_has_product' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterDraftMessageHasProductMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageHasProductMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_draft_message_has_product');
$tMap->setPhpName('NewsletterDraftMessageHasProduct');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_DRAFT_MESSAGE_ID', 'NewsletterDraftMessageId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_draft_message', 'ID', true, null);
$tMap->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'int' , CreoleTypes::INTEGER, 'st_product', 'ID', true, null);
} // doBuild()
} // NewsletterDraftMessageHasProductMapBuilder

View File

@@ -0,0 +1,84 @@
<?php
/**
* This class adds structure of 'st_newsletter_draft_message_i18n' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterDraftMessageI18nMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageI18nMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_draft_message_i18n');
$tMap->setPhpName('NewsletterDraftMessageI18n');
$tMap->setUseIdGenerator(false);
$tMap->addForeignPrimaryKey('ID', 'Id', 'int' , CreoleTypes::INTEGER, 'st_newsletter_draft_message', 'ID', true, null);
$tMap->addPrimaryKey('CULTURE', 'Culture', 'string', CreoleTypes::VARCHAR, true, 7);
$tMap->addColumn('SUBJECT', 'Subject', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CONTENT', 'Content', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_DESCRIPTION_HEAD', 'CtaDescriptionHead', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_DESCRIPTION_FOOT', 'CtaDescriptionFoot', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_BUTTON_NAME', 'CtaButtonName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('PRODUCTS_NAME', 'ProductsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('RECOMMENDS_NAME', 'RecommendsName', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // NewsletterDraftMessageI18nMapBuilder

View File

@@ -0,0 +1,98 @@
<?php
/**
* This class adds structure of 'st_newsletter_draft_message' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterDraftMessageMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_draft_message');
$tMap->setPhpName('NewsletterDraftMessage');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('OPT_SUBJECT', 'OptSubject', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('OPT_CONTENT', 'OptContent', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('MAIN_IMAGE', 'MainImage', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MAIN_IMAGE_URL', 'MainImageUrl', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_CTA_BUTTON_NAME', 'OptCtaButtonName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CTA_BUTTON_URL', 'CtaButtonUrl', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CTA_BUTTON_POSITION', 'CtaButtonPosition', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_CTA_DESCRIPTION_HEAD', 'OptCtaDescriptionHead', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('OPT_CTA_DESCRIPTION_FOOT', 'OptCtaDescriptionFoot', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('OPT_PRODUCTS_NAME', 'OptProductsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_RECOMMENDS_NAME', 'OptRecommendsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('TEST_EMAILS', 'TestEmails', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('HASH', 'Hash', 'string', CreoleTypes::VARCHAR, true, 255);
} // doBuild()
} // NewsletterDraftMessageMapBuilder

View File

@@ -0,0 +1,74 @@
<?php
/**
* This class adds structure of 'st_newsletter_group_i18n' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterGroupI18nMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupI18nMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_group_i18n');
$tMap->setPhpName('NewsletterGroupI18n');
$tMap->setUseIdGenerator(false);
$tMap->addForeignPrimaryKey('ID', 'Id', 'int' , CreoleTypes::INTEGER, 'st_newsletter_group', 'ID', true, null);
$tMap->addPrimaryKey('CULTURE', 'Culture', 'string', CreoleTypes::VARCHAR, true, 7);
$tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('DESCRIPTION', 'Description', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // NewsletterGroupI18nMapBuilder

View File

@@ -0,0 +1,82 @@
<?php
/**
* This class adds structure of 'st_newsletter_group' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterGroupMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_group');
$tMap->setPhpName('NewsletterGroup');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('OPT_NAME', 'OptName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_DESCRIPTION', 'OptDescription', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('SHORTCUT', 'Shortcut', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('IS_PUBLIC', 'IsPublic', 'boolean', CreoleTypes::BOOLEAN, false, null);
$tMap->addColumn('IS_DEFAULT', 'IsDefault', 'boolean', CreoleTypes::BOOLEAN, false, null);
} // doBuild()
} // NewsletterGroupMapBuilder

View File

@@ -0,0 +1,76 @@
<?php
/**
* This class adds structure of 'st_newsletter_message_has_blog' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterMessageHasBlogMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageHasBlogMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_message_has_blog');
$tMap->setPhpName('NewsletterMessageHasBlog');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_MESSAGE_ID', 'NewsletterMessageId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_message', 'ID', true, null);
$tMap->addForeignPrimaryKey('BLOG_ID', 'BlogId', 'int' , CreoleTypes::INTEGER, 'st_blog', 'ID', true, null);
} // doBuild()
} // NewsletterMessageHasBlogMapBuilder

View File

@@ -0,0 +1,74 @@
<?php
/**
* This class adds structure of 'st_newsletter_message_has_newsletter_group' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterMessageHasNewsletterGroupMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageHasNewsletterGroupMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_message_has_newsletter_group');
$tMap->setPhpName('NewsletterMessageHasNewsletterGroup');
$tMap->setUseIdGenerator(false);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_MESSAGE_ID', 'NewsletterMessageId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_message', 'ID', true, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_GROUP_ID', 'NewsletterGroupId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_group', 'ID', true, null);
} // doBuild()
} // NewsletterMessageHasNewsletterGroupMapBuilder

View File

@@ -0,0 +1,76 @@
<?php
/**
* This class adds structure of 'st_newsletter_message_has_product' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterMessageHasProductMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageHasProductMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_message_has_product');
$tMap->setPhpName('NewsletterMessageHasProduct');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignPrimaryKey('NEWSLETTER_MESSAGE_ID', 'NewsletterMessageId', 'int' , CreoleTypes::INTEGER, 'st_newsletter_message', 'ID', true, null);
$tMap->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'int' , CreoleTypes::INTEGER, 'st_product', 'ID', true, null);
} // doBuild()
} // NewsletterMessageHasProductMapBuilder

View File

@@ -0,0 +1,84 @@
<?php
/**
* This class adds structure of 'st_newsletter_message_i18n' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterMessageI18nMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageI18nMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_message_i18n');
$tMap->setPhpName('NewsletterMessageI18n');
$tMap->setUseIdGenerator(false);
$tMap->addForeignPrimaryKey('ID', 'Id', 'int' , CreoleTypes::INTEGER, 'st_newsletter_message', 'ID', true, null);
$tMap->addPrimaryKey('CULTURE', 'Culture', 'string', CreoleTypes::VARCHAR, true, 7);
$tMap->addColumn('SUBJECT', 'Subject', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CONTENT', 'Content', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_DESCRIPTION_HEAD', 'CtaDescriptionHead', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_DESCRIPTION_FOOT', 'CtaDescriptionFoot', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('CTA_BUTTON_NAME', 'CtaButtonName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('PRODUCTS_NAME', 'ProductsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('RECOMMENDS_NAME', 'RecommendsName', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // NewsletterMessageI18nMapBuilder

View File

@@ -0,0 +1,110 @@
<?php
/**
* This class adds structure of 'st_newsletter_message' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterMessageMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_message');
$tMap->setPhpName('NewsletterMessage');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignKey('NEWSLETTER_DRAFT_MESSAGE_ID', 'NewsletterDraftMessageId', 'int', CreoleTypes::INTEGER, 'st_newsletter_draft_message', 'ID', false, null);
$tMap->addColumn('OPT_SUBJECT', 'OptSubject', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('OPT_CONTENT', 'OptContent', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('MAIN_IMAGE', 'MainImage', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MAIN_IMAGE_URL', 'MainImageUrl', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_CTA_BUTTON_NAME', 'OptCtaButtonName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CTA_BUTTON_URL', 'CtaButtonUrl', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('CTA_BUTTON_POSITION', 'CtaButtonPosition', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_CTA_DESCRIPTION_HEAD', 'OptCtaDescriptionHead', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('OPT_CTA_DESCRIPTION_FOOT', 'OptCtaDescriptionFoot', 'string', CreoleTypes::LONGTEXT, false, null);
$tMap->addColumn('OPT_PRODUCTS_NAME', 'OptProductsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('OPT_RECOMMENDS_NAME', 'OptRecommendsName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('SENT_AT', 'SentAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('NUMBER_SENT', 'NumberSent', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('NUMBER_SENT_GMAIL', 'NumberSentGmail', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('NUMBER_RECEIVED', 'NumberReceived', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('NUMBER_READ', 'NumberRead', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('TEMPLATE_VERSION', 'TemplateVersion', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('HASH', 'Hash', 'string', CreoleTypes::VARCHAR, true, 255);
} // doBuild()
} // NewsletterMessageMapBuilder

View File

@@ -0,0 +1,76 @@
<?php
/**
* This class adds structure of 'st_newsletter_user_has_newsletter_group' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterUserHasNewsletterGroupMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterUserHasNewsletterGroupMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_user_has_newsletter_group');
$tMap->setPhpName('NewsletterUserHasNewsletterGroup');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignKey('NEWSLETTER_GROUP_ID', 'NewsletterGroupId', 'int', CreoleTypes::INTEGER, 'st_newsletter_group', 'ID', true, null);
$tMap->addForeignKey('NEWSLETTER_USER_ID', 'NewsletterUserId', 'int', CreoleTypes::INTEGER, 'st_newsletter_user', 'ID', true, null);
} // doBuild()
} // NewsletterUserHasNewsletterGroupMapBuilder

View File

@@ -0,0 +1,84 @@
<?php
/**
* This class adds structure of 'st_newsletter_user' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stNewsletterPlugin.lib.model.map
*/
class NewsletterUserMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stNewsletterPlugin.lib.model.map.NewsletterUserMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_newsletter_user');
$tMap->setPhpName('NewsletterUser');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignKey('SF_GUARD_USER_ID', 'SfGuardUserId', 'int', CreoleTypes::INTEGER, 'sf_guard_user', 'ID', false, null);
$tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('ACTIVE', 'Active', 'boolean', CreoleTypes::BOOLEAN, false, null);
$tMap->addColumn('CONFIRM', 'Confirm', 'boolean', CreoleTypes::BOOLEAN, false, null);
$tMap->addColumn('HASH', 'Hash', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('LANGUAGE', 'Language', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // NewsletterUserMapBuilder

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,864 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_draft_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterDraftMessageI18nPeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_draft_message_i18n';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterDraftMessageI18n';
/** The total number of columns. */
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'st_newsletter_draft_message_i18n.ID';
/** the column name for the CULTURE field */
const CULTURE = 'st_newsletter_draft_message_i18n.CULTURE';
/** the column name for the SUBJECT field */
const SUBJECT = 'st_newsletter_draft_message_i18n.SUBJECT';
/** the column name for the CONTENT field */
const CONTENT = 'st_newsletter_draft_message_i18n.CONTENT';
/** the column name for the CTA_DESCRIPTION_HEAD field */
const CTA_DESCRIPTION_HEAD = 'st_newsletter_draft_message_i18n.CTA_DESCRIPTION_HEAD';
/** the column name for the CTA_DESCRIPTION_FOOT field */
const CTA_DESCRIPTION_FOOT = 'st_newsletter_draft_message_i18n.CTA_DESCRIPTION_FOOT';
/** the column name for the CTA_BUTTON_NAME field */
const CTA_BUTTON_NAME = 'st_newsletter_draft_message_i18n.CTA_BUTTON_NAME';
/** the column name for the PRODUCTS_NAME field */
const PRODUCTS_NAME = 'st_newsletter_draft_message_i18n.PRODUCTS_NAME';
/** the column name for the RECOMMENDS_NAME field */
const RECOMMENDS_NAME = 'st_newsletter_draft_message_i18n.RECOMMENDS_NAME';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Culture', 'Subject', 'Content', 'CtaDescriptionHead', 'CtaDescriptionFoot', 'CtaButtonName', 'ProductsName', 'RecommendsName', ),
BasePeer::TYPE_COLNAME => array (NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessageI18nPeer::CULTURE, NewsletterDraftMessageI18nPeer::SUBJECT, NewsletterDraftMessageI18nPeer::CONTENT, NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_HEAD, NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_FOOT, NewsletterDraftMessageI18nPeer::CTA_BUTTON_NAME, NewsletterDraftMessageI18nPeer::PRODUCTS_NAME, NewsletterDraftMessageI18nPeer::RECOMMENDS_NAME, ),
BasePeer::TYPE_FIELDNAME => array ('id', 'culture', 'subject', 'content', 'cta_description_head', 'cta_description_foot', 'cta_button_name', 'products_name', 'recommends_name', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Culture' => 1, 'Subject' => 2, 'Content' => 3, 'CtaDescriptionHead' => 4, 'CtaDescriptionFoot' => 5, 'CtaButtonName' => 6, 'ProductsName' => 7, 'RecommendsName' => 8, ),
BasePeer::TYPE_COLNAME => array (NewsletterDraftMessageI18nPeer::ID => 0, NewsletterDraftMessageI18nPeer::CULTURE => 1, NewsletterDraftMessageI18nPeer::SUBJECT => 2, NewsletterDraftMessageI18nPeer::CONTENT => 3, NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_HEAD => 4, NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_FOOT => 5, NewsletterDraftMessageI18nPeer::CTA_BUTTON_NAME => 6, NewsletterDraftMessageI18nPeer::PRODUCTS_NAME => 7, NewsletterDraftMessageI18nPeer::RECOMMENDS_NAME => 8, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'culture' => 1, 'subject' => 2, 'content' => 3, 'cta_description_head' => 4, 'cta_description_foot' => 5, 'cta_button_name' => 6, 'products_name' => 7, 'recommends_name' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageI18nMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterDraftMessageI18nPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterDraftMessageI18nPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterDraftMessageI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::ID);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::CULTURE);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::SUBJECT);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::CONTENT);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_HEAD);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::CTA_DESCRIPTION_FOOT);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::CTA_BUTTON_NAME);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::PRODUCTS_NAME);
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::RECOMMENDS_NAME);
if (stEventDispatcher::getInstance()->getListeners('NewsletterDraftMessageI18nPeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterDraftMessageI18nPeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_draft_message_i18n.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_draft_message_i18n.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterDraftMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterDraftMessageI18n
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterDraftMessageI18nPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterDraftMessageI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterDraftMessageI18nPeer::populateObjects(NewsletterDraftMessageI18nPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterDraftMessageI18nPeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterDraftMessageI18nPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining the related NewsletterDraftMessage table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinNewsletterDraftMessage(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessagePeer::ID);
$rs = NewsletterDraftMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterDraftMessageI18n objects pre-filled with their NewsletterDraftMessage objects.
*
* @return NewsletterDraftMessageI18n[] Array of NewsletterDraftMessageI18n objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinNewsletterDraftMessage(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterDraftMessageI18nPeer::addSelectColumns($c);
NewsletterDraftMessagePeer::addSelectColumns($c);
$c->addJoin(NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessagePeer::ID);
$rs = NewsletterDraftMessageI18nPeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterDraftMessageI18n();
$startcol = $obj1->hydrate($rs);
if ($obj1->getId())
{
$obj2 = new NewsletterDraftMessage();
$obj2->hydrate($rs, $startcol);
$obj2->addNewsletterDraftMessageI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterDraftMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessagePeer::ID);
$rs = NewsletterDraftMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterDraftMessageI18n objects pre-filled with all related objects.
*
* @return NewsletterDraftMessageI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterDraftMessageI18nPeer::addSelectColumns($c);
$startcol2 = (NewsletterDraftMessageI18nPeer::NUM_COLUMNS - NewsletterDraftMessageI18nPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
NewsletterDraftMessagePeer::addSelectColumns($c);
$startcol3 = $startcol2 + NewsletterDraftMessagePeer::NUM_COLUMNS;
$c->addJoin(NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessagePeer::ID);
$rs = BasePeer::doSelect($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$omClass = NewsletterDraftMessageI18nPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
// Add objects for joined NewsletterDraftMessage rows
$omClass = NewsletterDraftMessagePeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getNewsletterDraftMessage(); // CHECKME
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addNewsletterDraftMessageI18n($obj1); // CHECKME
break;
}
}
if ($newObject) {
$obj2->initNewsletterDraftMessageI18ns();
$obj2->addNewsletterDraftMessageI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterDraftMessageI18nPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterDraftMessageI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterDraftMessageI18n object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterDraftMessageI18nPeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterDraftMessageI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterDraftMessageI18n object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterDraftMessageI18nPeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterDraftMessageI18nPeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterDraftMessageI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterDraftMessageI18n object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterDraftMessageI18nPeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterDraftMessageI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterDraftMessageI18nPeer::ID);
$selectCriteria->add(NewsletterDraftMessageI18nPeer::ID, $criteria->remove(NewsletterDraftMessageI18nPeer::ID), $comparison);
$comparison = $criteria->getComparison(NewsletterDraftMessageI18nPeer::CULTURE);
$selectCriteria->add(NewsletterDraftMessageI18nPeer::CULTURE, $criteria->remove(NewsletterDraftMessageI18nPeer::CULTURE), $comparison);
} else { // $values is NewsletterDraftMessageI18n object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterDraftMessageI18nPeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterDraftMessageI18nPeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_draft_message_i18n table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(NewsletterDraftMessageI18nPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterDraftMessageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterDraftMessageI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterDraftMessageI18nPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterDraftMessageI18n) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if(count($values) == count($values, COUNT_RECURSIVE))
{
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach($values as $value)
{
$vals[0][] = $value[0];
$vals[1][] = $value[1];
}
$criteria->add(NewsletterDraftMessageI18nPeer::ID, $vals[0], Criteria::IN);
$criteria->add(NewsletterDraftMessageI18nPeer::CULTURE, $vals[1], Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given NewsletterDraftMessageI18n 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 NewsletterDraftMessageI18n $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(NewsletterDraftMessageI18n $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterDraftMessageI18nPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterDraftMessageI18nPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterDraftMessageI18nPeer::DATABASE_NAME, NewsletterDraftMessageI18nPeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterDraftMessageI18nPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve object using using composite pkey values.
* @param int $id
@param string $culture
* @param Connection $con
* @return NewsletterDraftMessageI18n
*/
public static function retrieveByPK( $id, $culture, $con = null) {
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria();
$criteria->add(NewsletterDraftMessageI18nPeer::ID, $id);
$criteria->add(NewsletterDraftMessageI18nPeer::CULTURE, $culture);
$v = NewsletterDraftMessageI18nPeer::doSelect($criteria, $con);
return !empty($v) ? $v[0] : null;
}
} // BaseNewsletterDraftMessageI18nPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterDraftMessageI18nPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageI18nMapBuilder');
}

View File

@@ -0,0 +1,848 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_draft_message' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterDraftMessagePeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_draft_message';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterDraftMessage';
/** The total number of columns. */
const NUM_COLUMNS = 16;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the CREATED_AT field */
const CREATED_AT = 'st_newsletter_draft_message.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'st_newsletter_draft_message.UPDATED_AT';
/** the column name for the ID field */
const ID = 'st_newsletter_draft_message.ID';
/** the column name for the OPT_SUBJECT field */
const OPT_SUBJECT = 'st_newsletter_draft_message.OPT_SUBJECT';
/** the column name for the OPT_CONTENT field */
const OPT_CONTENT = 'st_newsletter_draft_message.OPT_CONTENT';
/** the column name for the MAIN_IMAGE field */
const MAIN_IMAGE = 'st_newsletter_draft_message.MAIN_IMAGE';
/** the column name for the MAIN_IMAGE_URL field */
const MAIN_IMAGE_URL = 'st_newsletter_draft_message.MAIN_IMAGE_URL';
/** the column name for the OPT_CTA_BUTTON_NAME field */
const OPT_CTA_BUTTON_NAME = 'st_newsletter_draft_message.OPT_CTA_BUTTON_NAME';
/** the column name for the CTA_BUTTON_URL field */
const CTA_BUTTON_URL = 'st_newsletter_draft_message.CTA_BUTTON_URL';
/** the column name for the CTA_BUTTON_POSITION field */
const CTA_BUTTON_POSITION = 'st_newsletter_draft_message.CTA_BUTTON_POSITION';
/** the column name for the OPT_CTA_DESCRIPTION_HEAD field */
const OPT_CTA_DESCRIPTION_HEAD = 'st_newsletter_draft_message.OPT_CTA_DESCRIPTION_HEAD';
/** the column name for the OPT_CTA_DESCRIPTION_FOOT field */
const OPT_CTA_DESCRIPTION_FOOT = 'st_newsletter_draft_message.OPT_CTA_DESCRIPTION_FOOT';
/** the column name for the OPT_PRODUCTS_NAME field */
const OPT_PRODUCTS_NAME = 'st_newsletter_draft_message.OPT_PRODUCTS_NAME';
/** the column name for the OPT_RECOMMENDS_NAME field */
const OPT_RECOMMENDS_NAME = 'st_newsletter_draft_message.OPT_RECOMMENDS_NAME';
/** the column name for the TEST_EMAILS field */
const TEST_EMAILS = 'st_newsletter_draft_message.TEST_EMAILS';
/** the column name for the HASH field */
const HASH = 'st_newsletter_draft_message.HASH';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt', 'UpdatedAt', 'Id', 'OptSubject', 'OptContent', 'MainImage', 'MainImageUrl', 'OptCtaButtonName', 'CtaButtonUrl', 'CtaButtonPosition', 'OptCtaDescriptionHead', 'OptCtaDescriptionFoot', 'OptProductsName', 'OptRecommendsName', 'TestEmails', 'Hash', ),
BasePeer::TYPE_COLNAME => array (NewsletterDraftMessagePeer::CREATED_AT, NewsletterDraftMessagePeer::UPDATED_AT, NewsletterDraftMessagePeer::ID, NewsletterDraftMessagePeer::OPT_SUBJECT, NewsletterDraftMessagePeer::OPT_CONTENT, NewsletterDraftMessagePeer::MAIN_IMAGE, NewsletterDraftMessagePeer::MAIN_IMAGE_URL, NewsletterDraftMessagePeer::OPT_CTA_BUTTON_NAME, NewsletterDraftMessagePeer::CTA_BUTTON_URL, NewsletterDraftMessagePeer::CTA_BUTTON_POSITION, NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_HEAD, NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_FOOT, NewsletterDraftMessagePeer::OPT_PRODUCTS_NAME, NewsletterDraftMessagePeer::OPT_RECOMMENDS_NAME, NewsletterDraftMessagePeer::TEST_EMAILS, NewsletterDraftMessagePeer::HASH, ),
BasePeer::TYPE_FIELDNAME => array ('created_at', 'updated_at', 'id', 'opt_subject', 'opt_content', 'main_image', 'main_image_url', 'opt_cta_button_name', 'cta_button_url', 'cta_button_position', 'opt_cta_description_head', 'opt_cta_description_foot', 'opt_products_name', 'opt_recommends_name', 'test_emails', 'hash', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt' => 0, 'UpdatedAt' => 1, 'Id' => 2, 'OptSubject' => 3, 'OptContent' => 4, 'MainImage' => 5, 'MainImageUrl' => 6, 'OptCtaButtonName' => 7, 'CtaButtonUrl' => 8, 'CtaButtonPosition' => 9, 'OptCtaDescriptionHead' => 10, 'OptCtaDescriptionFoot' => 11, 'OptProductsName' => 12, 'OptRecommendsName' => 13, 'TestEmails' => 14, 'Hash' => 15, ),
BasePeer::TYPE_COLNAME => array (NewsletterDraftMessagePeer::CREATED_AT => 0, NewsletterDraftMessagePeer::UPDATED_AT => 1, NewsletterDraftMessagePeer::ID => 2, NewsletterDraftMessagePeer::OPT_SUBJECT => 3, NewsletterDraftMessagePeer::OPT_CONTENT => 4, NewsletterDraftMessagePeer::MAIN_IMAGE => 5, NewsletterDraftMessagePeer::MAIN_IMAGE_URL => 6, NewsletterDraftMessagePeer::OPT_CTA_BUTTON_NAME => 7, NewsletterDraftMessagePeer::CTA_BUTTON_URL => 8, NewsletterDraftMessagePeer::CTA_BUTTON_POSITION => 9, NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_HEAD => 10, NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_FOOT => 11, NewsletterDraftMessagePeer::OPT_PRODUCTS_NAME => 12, NewsletterDraftMessagePeer::OPT_RECOMMENDS_NAME => 13, NewsletterDraftMessagePeer::TEST_EMAILS => 14, NewsletterDraftMessagePeer::HASH => 15, ),
BasePeer::TYPE_FIELDNAME => array ('created_at' => 0, 'updated_at' => 1, 'id' => 2, 'opt_subject' => 3, 'opt_content' => 4, 'main_image' => 5, 'main_image_url' => 6, 'opt_cta_button_name' => 7, 'cta_button_url' => 8, 'cta_button_position' => 9, 'opt_cta_description_head' => 10, 'opt_cta_description_foot' => 11, 'opt_products_name' => 12, 'opt_recommends_name' => 13, 'test_emails' => 14, 'hash' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterDraftMessagePeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterDraftMessagePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterDraftMessagePeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterDraftMessagePeer::CREATED_AT);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::UPDATED_AT);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::ID);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_SUBJECT);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_CONTENT);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::MAIN_IMAGE);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::MAIN_IMAGE_URL);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_CTA_BUTTON_NAME);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::CTA_BUTTON_URL);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::CTA_BUTTON_POSITION);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_HEAD);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_CTA_DESCRIPTION_FOOT);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_PRODUCTS_NAME);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::OPT_RECOMMENDS_NAME);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::TEST_EMAILS);
$criteria->addSelectColumn(NewsletterDraftMessagePeer::HASH);
if (stEventDispatcher::getInstance()->getListeners('NewsletterDraftMessagePeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterDraftMessagePeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_draft_message.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_draft_message.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterDraftMessagePeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterDraftMessagePeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterDraftMessagePeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterDraftMessage
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterDraftMessagePeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterDraftMessage[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterDraftMessagePeer::populateObjects(NewsletterDraftMessagePeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterDraftMessagePeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterDraftMessagePeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Selects a collection of NewsletterDraftMessage objects pre-filled with their i18n objects.
*
* @return array Array of NewsletterDraftMessage objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
{
$c = clone $c;
if ($culture === null)
{
$culture = sfContext::getInstance()->getUser()->getCulture();
}
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB())
{
$c->setDbName(self::DATABASE_NAME);
}
if (!$c->getSelectColumns())
{
NewsletterDraftMessagePeer::addSelectColumns($c);
NewsletterDraftMessageI18nPeer::addSelectColumns($c);
}
$c->addJoin(NewsletterDraftMessagePeer::ID, sprintf('%s AND %s = \'%s\'', NewsletterDraftMessageI18nPeer::ID, NewsletterDraftMessageI18nPeer::CULTURE, $culture), Criteria::LEFT_JOIN);
$rs = NewsletterDraftMessagePeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterDraftMessage();
$startcol = $obj1->hydrate($rs);
$obj1->setCulture($culture);
$obj2 = new NewsletterDraftMessageI18n();
$obj2->hydrate($rs, $startcol);
$obj1->setNewsletterDraftMessageI18nForCulture($obj2, $culture);
$obj2->setNewsletterDraftMessage($obj1);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterDraftMessagePeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterDraftMessage or Criteria object.
*
* @param mixed $values Criteria or NewsletterDraftMessage object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterDraftMessagePeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterDraftMessagePeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterDraftMessage object
}
$criteria->remove(NewsletterDraftMessagePeer::ID); // remove pkey col since this table uses auto-increment
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterDraftMessagePeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterDraftMessagePeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterDraftMessage or Criteria object.
*
* @param mixed $values Criteria or NewsletterDraftMessage object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterDraftMessagePeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterDraftMessagePeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterDraftMessagePeer::ID);
$selectCriteria->add(NewsletterDraftMessagePeer::ID, $criteria->remove(NewsletterDraftMessagePeer::ID), $comparison);
} else { // $values is NewsletterDraftMessage object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterDraftMessagePeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterDraftMessagePeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_draft_message table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterDraftMessagePeer::doOnDeleteCascade(new Criteria(), $con);
NewsletterDraftMessagePeer::doOnDeleteSetNull(new Criteria(), $con);
$affectedRows += BasePeer::doDeleteAll(NewsletterDraftMessagePeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterDraftMessage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterDraftMessage object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterDraftMessagePeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterDraftMessage) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(NewsletterDraftMessagePeer::ID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterDraftMessagePeer::doOnDeleteCascade($criteria, $con);NewsletterDraftMessagePeer::doOnDeleteSetNull($criteria, $con);
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param Connection $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = NewsletterDraftMessagePeer::doSelect($criteria, $con);
foreach($objects as $obj) {
// delete related NewsletterDraftMessageHasProduct objects
$c = new Criteria();
$c->add(NewsletterDraftMessageHasProductPeer::NEWSLETTER_DRAFT_MESSAGE_ID, $obj->getId());
$affectedRows += NewsletterDraftMessageHasProductPeer::doDelete($c, $con);
// delete related NewsletterDraftMessageHasBlog objects
$c = new Criteria();
$c->add(NewsletterDraftMessageHasBlogPeer::NEWSLETTER_DRAFT_MESSAGE_ID, $obj->getId());
$affectedRows += NewsletterDraftMessageHasBlogPeer::doDelete($c, $con);
// delete related NewsletterDraftMessageI18n objects
$c = new Criteria();
$c->add(NewsletterDraftMessageI18nPeer::ID, $obj->getId());
$affectedRows += NewsletterDraftMessageI18nPeer::doDelete($c, $con);
}
return $affectedRows;
}
/**
* This is a method for emulating ON DELETE SET NULL DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param Connection $con
* @return void
*/
protected static function doOnDeleteSetNull(Criteria $criteria, Connection $con)
{
// first find the objects that are implicated by the $criteria
$objects = NewsletterDraftMessagePeer::doSelect($criteria, $con);
foreach($objects as $obj) {
// set fkey col in related NewsletterMessage rows to NULL
$selectCriteria = new Criteria(NewsletterDraftMessagePeer::DATABASE_NAME);
$updateValues = new Criteria(NewsletterDraftMessagePeer::DATABASE_NAME);
$selectCriteria->add(NewsletterMessagePeer::NEWSLETTER_DRAFT_MESSAGE_ID, $obj->getId());
$updateValues->add(NewsletterMessagePeer::NEWSLETTER_DRAFT_MESSAGE_ID, null);
BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey
}
}
/**
* Validates all modified columns of given NewsletterDraftMessage 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 NewsletterDraftMessage $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(NewsletterDraftMessage $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterDraftMessagePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterDraftMessagePeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterDraftMessagePeer::DATABASE_NAME, NewsletterDraftMessagePeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterDraftMessagePeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return NewsletterDraftMessage
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(NewsletterDraftMessagePeer::DATABASE_NAME);
$criteria->add(NewsletterDraftMessagePeer::ID, $pk);
$v = NewsletterDraftMessagePeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return NewsletterDraftMessage[]
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(NewsletterDraftMessagePeer::ID, $pks, Criteria::IN);
$objs = NewsletterDraftMessagePeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseNewsletterDraftMessagePeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterDraftMessagePeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterDraftMessageMapBuilder');
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,827 @@
<?php
/**
* Base class that represents a row from the 'st_newsletter_group_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterGroupI18n extends BaseObject implements Persistent {
protected static $dispatcher = null;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the culture field.
* @var string
*/
protected $culture;
/**
* The value for the name field.
* @var string
*/
protected $name;
/**
* The value for the description field.
* @var string
*/
protected $description;
/**
* @var NewsletterGroup
*/
protected $aNewsletterGroup;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [id] column value.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get the [culture] column value.
*
* @return string
*/
public function getCulture()
{
return $this->culture;
}
/**
* Get the [name] column value.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Get the [description] column value.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return void
*/
public function setId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = NewsletterGroupI18nPeer::ID;
}
if ($this->aNewsletterGroup !== null && $this->aNewsletterGroup->getId() !== $v) {
$this->aNewsletterGroup = null;
}
} // setId()
/**
* Set the value of [culture] column.
*
* @param string $v new value
* @return void
*/
public function setCulture($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->culture !== $v) {
$this->culture = $v;
$this->modifiedColumns[] = NewsletterGroupI18nPeer::CULTURE;
}
} // setCulture()
/**
* Set the value of [name] column.
*
* @param string $v new value
* @return void
*/
public function setName($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->name !== $v) {
$this->name = $v;
$this->modifiedColumns[] = NewsletterGroupI18nPeer::NAME;
}
} // setName()
/**
* Set the value of [description] column.
*
* @param string $v new value
* @return void
*/
public function setDescription($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->description !== $v) {
$this->description = $v;
$this->modifiedColumns[] = NewsletterGroupI18nPeer::DESCRIPTION;
}
} // setDescription()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (1-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.preHydrate')) {
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.preHydrate', array('resultset' => $rs, 'startcol' => $startcol)));
$startcol = $event['startcol'];
}
$this->id = $rs->getInt($startcol + 0);
$this->culture = $rs->getString($startcol + 1);
$this->name = $rs->getString($startcol + 2);
$this->description = $rs->getString($startcol + 3);
$this->resetModified();
$this->setNew(false);
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.postHydrate')) {
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 4)));
return $event['startcol'];
}
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = NewsletterGroupI18nPeer::NUM_COLUMNS - NewsletterGroupI18nPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating NewsletterGroupI18n object", $e);
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param Connection $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.preDelete')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.preDelete', array('con' => $con)));
}
if (sfMixer::hasCallables('BaseNewsletterGroupI18n:delete:pre'))
{
foreach (sfMixer::getCallables('BaseNewsletterGroupI18n:delete:pre') as $callable)
{
$ret = call_user_func($callable, $this, $con);
if ($ret)
{
return;
}
}
}
if ($con === null) {
$con = Propel::getConnection(NewsletterGroupI18nPeer::DATABASE_NAME);
}
try {
$con->begin();
NewsletterGroupI18nPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.postDelete')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.postDelete', array('con' => $con)));
}
if (sfMixer::hasCallables('BaseNewsletterGroupI18n:delete:post'))
{
foreach (sfMixer::getCallables('BaseNewsletterGroupI18n:delete:post') as $callable)
{
call_user_func($callable, $this, $con);
}
}
}
/**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see doSave()
*/
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if (!$this->alreadyInSave) {
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.preSave')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.preSave', array('con' => $con)));
}
foreach (sfMixer::getCallables('BaseNewsletterGroupI18n:save:pre') as $callable)
{
$affectedRows = call_user_func($callable, $this, $con);
if (is_int($affectedRows))
{
return $affectedRows;
}
}
}
if ($con === null) {
$con = Propel::getConnection(NewsletterGroupI18nPeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
if (!$this->alreadyInSave) {
if ($this->getDispatcher()->getListeners('NewsletterGroupI18n.postSave')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterGroupI18n.postSave', array('con' => $con)));
}
foreach (sfMixer::getCallables('BaseNewsletterGroupI18n:save:post') as $callable)
{
call_user_func($callable, $this, $con, $affectedRows);
}
}
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave($con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aNewsletterGroup !== null) {
if ($this->aNewsletterGroup->isModified() || $this->aNewsletterGroup->getCurrentNewsletterGroupI18n()->isModified()) {
$affectedRows += $this->aNewsletterGroup->save($con);
}
$this->setNewsletterGroup($this->aNewsletterGroup);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = NewsletterGroupI18nPeer::doInsert($this, $con);
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += NewsletterGroupI18nPeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aNewsletterGroup !== null) {
if (!$this->aNewsletterGroup->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aNewsletterGroup->getValidationFailures());
}
}
if (($retval = NewsletterGroupI18nPeer::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 TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = NewsletterGroupI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getCulture();
break;
case 2:
return $this->getName();
break;
case 3:
return $this->getDescription();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = NewsletterGroupI18nPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getCulture(),
$keys[2] => $this->getName(),
$keys[3] => $this->getDescription(),
);
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = NewsletterGroupI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setCulture($value);
break;
case 2:
$this->setName($value);
break;
case 3:
$this->setDescription($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = NewsletterGroupI18nPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCulture($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(NewsletterGroupI18nPeer::DATABASE_NAME);
if ($this->isColumnModified(NewsletterGroupI18nPeer::ID)) $criteria->add(NewsletterGroupI18nPeer::ID, $this->id);
if ($this->isColumnModified(NewsletterGroupI18nPeer::CULTURE)) $criteria->add(NewsletterGroupI18nPeer::CULTURE, $this->culture);
if ($this->isColumnModified(NewsletterGroupI18nPeer::NAME)) $criteria->add(NewsletterGroupI18nPeer::NAME, $this->name);
if ($this->isColumnModified(NewsletterGroupI18nPeer::DESCRIPTION)) $criteria->add(NewsletterGroupI18nPeer::DESCRIPTION, $this->description);
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(NewsletterGroupI18nPeer::DATABASE_NAME);
$criteria->add(NewsletterGroupI18nPeer::ID, $this->id);
$criteria->add(NewsletterGroupI18nPeer::CULTURE, $this->culture);
return $criteria;
}
/**
* Returns the composite primary key for this object.
* The array elements will be in same order as specified in XML.
* @return array
*/
public function getPrimaryKey()
{
return array($this->getId(), $this->getCulture());
}
/**
* Returns [composite] primary key fields
*
* @param string $keyType
* @return array
*/
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
{
return array(NewsletterGroupI18nPeer::translateFieldName('id', BasePeer::TYPE_FIELDNAME, $keyType), NewsletterGroupI18nPeer::translateFieldName('culture', BasePeer::TYPE_FIELDNAME, $keyType));
}
/**
* Set the [composite] primary key.
*
* @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void
*/
public function setPrimaryKey($keys)
{
$this->setId($keys[0]);
$this->setCulture($keys[1]);
}
/**
* 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 NewsletterGroupI18n (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setName($this->name);
$copyObj->setDescription($this->description);
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a pkey column, so set to default value
$copyObj->setCulture(NULL); // this is a pkey column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return NewsletterGroupI18n 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.
*
* @return string Peer class name
*/
public function getPeer()
{
return 'NewsletterGroupI18nPeer';
}
/**
* Declares an association between this object and a NewsletterGroup object.
*
* @param NewsletterGroup $v
* @return void
* @throws PropelException
*/
public function setNewsletterGroup($v)
{
if ($v === null) {
$this->setId(NULL);
} else {
$this->setId($v->getId());
}
$this->aNewsletterGroup = $v;
}
/**
* Get the associated NewsletterGroup object
*
* @param Connection Optional Connection object.
* @return NewsletterGroup The associated NewsletterGroup object.
* @throws PropelException
*/
public function getNewsletterGroup($con = null)
{
if ($this->aNewsletterGroup === null && ($this->id !== null)) {
// include the related Peer class
$this->aNewsletterGroup = NewsletterGroupPeer::retrieveByPK($this->id, $con);
/* The following can be used instead of the line above to
guarantee the related object contains a reference
to this object, but this level of coupling
may be undesirable in many circumstances.
As it can lead to a db query with many results that may
never be used.
$obj = NewsletterGroupPeer::retrieveByPK($this->id, $con);
$obj->addNewsletterGroups($this);
*/
}
return $this->aNewsletterGroup;
}
public function getDispatcher()
{
if (null === self::$dispatcher)
{
self::$dispatcher = stEventDispatcher::getInstance();
}
return self::$dispatcher;
}
public function __call($method, $arguments)
{
$event = $this->getDispatcher()->notifyUntil(new sfEvent($this, 'NewsletterGroupI18n.' . $method, array('arguments' => $arguments, 'method' => $method)));
if ($event->isProcessed())
{
return $event->getReturnValue();
}
if (!$callable = sfMixer::getCallable('BaseNewsletterGroupI18n:'.$method))
{
throw new sfException(sprintf('Call to undefined method BaseNewsletterGroupI18n::%s', $method));
}
array_unshift($arguments, $this);
return call_user_func_array($callable, $arguments);
}
} // BaseNewsletterGroupI18n

View File

@@ -0,0 +1,839 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_group_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterGroupI18nPeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_group_i18n';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterGroupI18n';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'st_newsletter_group_i18n.ID';
/** the column name for the CULTURE field */
const CULTURE = 'st_newsletter_group_i18n.CULTURE';
/** the column name for the NAME field */
const NAME = 'st_newsletter_group_i18n.NAME';
/** the column name for the DESCRIPTION field */
const DESCRIPTION = 'st_newsletter_group_i18n.DESCRIPTION';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Culture', 'Name', 'Description', ),
BasePeer::TYPE_COLNAME => array (NewsletterGroupI18nPeer::ID, NewsletterGroupI18nPeer::CULTURE, NewsletterGroupI18nPeer::NAME, NewsletterGroupI18nPeer::DESCRIPTION, ),
BasePeer::TYPE_FIELDNAME => array ('id', 'culture', 'name', 'description', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Culture' => 1, 'Name' => 2, 'Description' => 3, ),
BasePeer::TYPE_COLNAME => array (NewsletterGroupI18nPeer::ID => 0, NewsletterGroupI18nPeer::CULTURE => 1, NewsletterGroupI18nPeer::NAME => 2, NewsletterGroupI18nPeer::DESCRIPTION => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'culture' => 1, 'name' => 2, 'description' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupI18nMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterGroupI18nPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterGroupI18nPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterGroupI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterGroupI18nPeer::ID);
$criteria->addSelectColumn(NewsletterGroupI18nPeer::CULTURE);
$criteria->addSelectColumn(NewsletterGroupI18nPeer::NAME);
$criteria->addSelectColumn(NewsletterGroupI18nPeer::DESCRIPTION);
if (stEventDispatcher::getInstance()->getListeners('NewsletterGroupI18nPeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterGroupI18nPeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_group_i18n.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_group_i18n.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterGroupI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterGroupI18n
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterGroupI18nPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterGroupI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterGroupI18nPeer::populateObjects(NewsletterGroupI18nPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterGroupI18nPeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterGroupI18nPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining the related NewsletterGroup table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinNewsletterGroup(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterGroupI18nPeer::ID, NewsletterGroupPeer::ID);
$rs = NewsletterGroupI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterGroupI18n objects pre-filled with their NewsletterGroup objects.
*
* @return NewsletterGroupI18n[] Array of NewsletterGroupI18n objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinNewsletterGroup(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterGroupI18nPeer::addSelectColumns($c);
NewsletterGroupPeer::addSelectColumns($c);
$c->addJoin(NewsletterGroupI18nPeer::ID, NewsletterGroupPeer::ID);
$rs = NewsletterGroupI18nPeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterGroupI18n();
$startcol = $obj1->hydrate($rs);
if ($obj1->getId())
{
$obj2 = new NewsletterGroup();
$obj2->hydrate($rs, $startcol);
$obj2->addNewsletterGroupI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterGroupI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterGroupI18nPeer::ID, NewsletterGroupPeer::ID);
$rs = NewsletterGroupI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterGroupI18n objects pre-filled with all related objects.
*
* @return NewsletterGroupI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterGroupI18nPeer::addSelectColumns($c);
$startcol2 = (NewsletterGroupI18nPeer::NUM_COLUMNS - NewsletterGroupI18nPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
NewsletterGroupPeer::addSelectColumns($c);
$startcol3 = $startcol2 + NewsletterGroupPeer::NUM_COLUMNS;
$c->addJoin(NewsletterGroupI18nPeer::ID, NewsletterGroupPeer::ID);
$rs = BasePeer::doSelect($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$omClass = NewsletterGroupI18nPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
// Add objects for joined NewsletterGroup rows
$omClass = NewsletterGroupPeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getNewsletterGroup(); // CHECKME
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addNewsletterGroupI18n($obj1); // CHECKME
break;
}
}
if ($newObject) {
$obj2->initNewsletterGroupI18ns();
$obj2->addNewsletterGroupI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterGroupI18nPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterGroupI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterGroupI18n object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterGroupI18nPeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterGroupI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterGroupI18n object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterGroupI18nPeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterGroupI18nPeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterGroupI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterGroupI18n object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterGroupI18nPeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterGroupI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterGroupI18nPeer::ID);
$selectCriteria->add(NewsletterGroupI18nPeer::ID, $criteria->remove(NewsletterGroupI18nPeer::ID), $comparison);
$comparison = $criteria->getComparison(NewsletterGroupI18nPeer::CULTURE);
$selectCriteria->add(NewsletterGroupI18nPeer::CULTURE, $criteria->remove(NewsletterGroupI18nPeer::CULTURE), $comparison);
} else { // $values is NewsletterGroupI18n object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterGroupI18nPeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterGroupI18nPeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_group_i18n table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(NewsletterGroupI18nPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterGroupI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterGroupI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterGroupI18nPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterGroupI18n) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if(count($values) == count($values, COUNT_RECURSIVE))
{
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach($values as $value)
{
$vals[0][] = $value[0];
$vals[1][] = $value[1];
}
$criteria->add(NewsletterGroupI18nPeer::ID, $vals[0], Criteria::IN);
$criteria->add(NewsletterGroupI18nPeer::CULTURE, $vals[1], Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given NewsletterGroupI18n 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 NewsletterGroupI18n $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(NewsletterGroupI18n $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterGroupI18nPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterGroupI18nPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterGroupI18nPeer::DATABASE_NAME, NewsletterGroupI18nPeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterGroupI18nPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve object using using composite pkey values.
* @param int $id
@param string $culture
* @param Connection $con
* @return NewsletterGroupI18n
*/
public static function retrieveByPK( $id, $culture, $con = null) {
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria();
$criteria->add(NewsletterGroupI18nPeer::ID, $id);
$criteria->add(NewsletterGroupI18nPeer::CULTURE, $culture);
$v = NewsletterGroupI18nPeer::doSelect($criteria, $con);
return !empty($v) ? $v[0] : null;
}
} // BaseNewsletterGroupI18nPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterGroupI18nPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupI18nMapBuilder');
}

View File

@@ -0,0 +1,770 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_group' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterGroupPeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_group';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterGroup';
/** The total number of columns. */
const NUM_COLUMNS = 8;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the CREATED_AT field */
const CREATED_AT = 'st_newsletter_group.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'st_newsletter_group.UPDATED_AT';
/** the column name for the ID field */
const ID = 'st_newsletter_group.ID';
/** the column name for the OPT_NAME field */
const OPT_NAME = 'st_newsletter_group.OPT_NAME';
/** the column name for the OPT_DESCRIPTION field */
const OPT_DESCRIPTION = 'st_newsletter_group.OPT_DESCRIPTION';
/** the column name for the SHORTCUT field */
const SHORTCUT = 'st_newsletter_group.SHORTCUT';
/** the column name for the IS_PUBLIC field */
const IS_PUBLIC = 'st_newsletter_group.IS_PUBLIC';
/** the column name for the IS_DEFAULT field */
const IS_DEFAULT = 'st_newsletter_group.IS_DEFAULT';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt', 'UpdatedAt', 'Id', 'OptName', 'OptDescription', 'Shortcut', 'IsPublic', 'IsDefault', ),
BasePeer::TYPE_COLNAME => array (NewsletterGroupPeer::CREATED_AT, NewsletterGroupPeer::UPDATED_AT, NewsletterGroupPeer::ID, NewsletterGroupPeer::OPT_NAME, NewsletterGroupPeer::OPT_DESCRIPTION, NewsletterGroupPeer::SHORTCUT, NewsletterGroupPeer::IS_PUBLIC, NewsletterGroupPeer::IS_DEFAULT, ),
BasePeer::TYPE_FIELDNAME => array ('created_at', 'updated_at', 'id', 'opt_name', 'opt_description', 'shortcut', 'is_public', 'is_default', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt' => 0, 'UpdatedAt' => 1, 'Id' => 2, 'OptName' => 3, 'OptDescription' => 4, 'Shortcut' => 5, 'IsPublic' => 6, 'IsDefault' => 7, ),
BasePeer::TYPE_COLNAME => array (NewsletterGroupPeer::CREATED_AT => 0, NewsletterGroupPeer::UPDATED_AT => 1, NewsletterGroupPeer::ID => 2, NewsletterGroupPeer::OPT_NAME => 3, NewsletterGroupPeer::OPT_DESCRIPTION => 4, NewsletterGroupPeer::SHORTCUT => 5, NewsletterGroupPeer::IS_PUBLIC => 6, NewsletterGroupPeer::IS_DEFAULT => 7, ),
BasePeer::TYPE_FIELDNAME => array ('created_at' => 0, 'updated_at' => 1, 'id' => 2, 'opt_name' => 3, 'opt_description' => 4, 'shortcut' => 5, 'is_public' => 6, 'is_default' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterGroupPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterGroupPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterGroupPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterGroupPeer::CREATED_AT);
$criteria->addSelectColumn(NewsletterGroupPeer::UPDATED_AT);
$criteria->addSelectColumn(NewsletterGroupPeer::ID);
$criteria->addSelectColumn(NewsletterGroupPeer::OPT_NAME);
$criteria->addSelectColumn(NewsletterGroupPeer::OPT_DESCRIPTION);
$criteria->addSelectColumn(NewsletterGroupPeer::SHORTCUT);
$criteria->addSelectColumn(NewsletterGroupPeer::IS_PUBLIC);
$criteria->addSelectColumn(NewsletterGroupPeer::IS_DEFAULT);
if (stEventDispatcher::getInstance()->getListeners('NewsletterGroupPeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterGroupPeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_group.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_group.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterGroupPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterGroupPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterGroupPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterGroup
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterGroupPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterGroup[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterGroupPeer::populateObjects(NewsletterGroupPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterGroupPeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterGroupPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Selects a collection of NewsletterGroup objects pre-filled with their i18n objects.
*
* @return array Array of NewsletterGroup objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
{
$c = clone $c;
if ($culture === null)
{
$culture = sfContext::getInstance()->getUser()->getCulture();
}
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB())
{
$c->setDbName(self::DATABASE_NAME);
}
if (!$c->getSelectColumns())
{
NewsletterGroupPeer::addSelectColumns($c);
NewsletterGroupI18nPeer::addSelectColumns($c);
}
$c->addJoin(NewsletterGroupPeer::ID, sprintf('%s AND %s = \'%s\'', NewsletterGroupI18nPeer::ID, NewsletterGroupI18nPeer::CULTURE, $culture), Criteria::LEFT_JOIN);
$rs = NewsletterGroupPeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterGroup();
$startcol = $obj1->hydrate($rs);
$obj1->setCulture($culture);
$obj2 = new NewsletterGroupI18n();
$obj2->hydrate($rs, $startcol);
$obj1->setNewsletterGroupI18nForCulture($obj2, $culture);
$obj2->setNewsletterGroup($obj1);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterGroupPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterGroup or Criteria object.
*
* @param mixed $values Criteria or NewsletterGroup object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterGroupPeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterGroupPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterGroup object
}
$criteria->remove(NewsletterGroupPeer::ID); // remove pkey col since this table uses auto-increment
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterGroupPeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterGroupPeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterGroup or Criteria object.
*
* @param mixed $values Criteria or NewsletterGroup object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterGroupPeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterGroupPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterGroupPeer::ID);
$selectCriteria->add(NewsletterGroupPeer::ID, $criteria->remove(NewsletterGroupPeer::ID), $comparison);
} else { // $values is NewsletterGroup object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterGroupPeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterGroupPeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_group table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterGroupPeer::doOnDeleteCascade(new Criteria(), $con);
$affectedRows += BasePeer::doDeleteAll(NewsletterGroupPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterGroup or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterGroup object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterGroupPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterGroup) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(NewsletterGroupPeer::ID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterGroupPeer::doOnDeleteCascade($criteria, $con);
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param Connection $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = NewsletterGroupPeer::doSelect($criteria, $con);
foreach($objects as $obj) {
// delete related NewsletterUserHasNewsletterGroup objects
$c = new Criteria();
$c->add(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID, $obj->getId());
$affectedRows += NewsletterUserHasNewsletterGroupPeer::doDelete($c, $con);
// delete related NewsletterGroupI18n objects
$c = new Criteria();
$c->add(NewsletterGroupI18nPeer::ID, $obj->getId());
$affectedRows += NewsletterGroupI18nPeer::doDelete($c, $con);
}
return $affectedRows;
}
/**
* Validates all modified columns of given NewsletterGroup 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 NewsletterGroup $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(NewsletterGroup $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterGroupPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterGroupPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterGroupPeer::DATABASE_NAME, NewsletterGroupPeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterGroupPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return NewsletterGroup
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(NewsletterGroupPeer::DATABASE_NAME);
$criteria->add(NewsletterGroupPeer::ID, $pk);
$v = NewsletterGroupPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return NewsletterGroup[]
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(NewsletterGroupPeer::ID, $pks, Criteria::IN);
$objs = NewsletterGroupPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseNewsletterGroupPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterGroupPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterGroupMapBuilder');
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,955 @@
<?php
/**
* Base class that represents a row from the 'st_newsletter_message_has_newsletter_group' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterMessageHasNewsletterGroup extends BaseObject implements Persistent {
protected static $dispatcher = null;
/**
* The value for the created_at field.
* @var int
*/
protected $created_at;
/**
* The value for the updated_at field.
* @var int
*/
protected $updated_at;
/**
* The value for the newsletter_message_id field.
* @var int
*/
protected $newsletter_message_id;
/**
* The value for the newsletter_group_id field.
* @var int
*/
protected $newsletter_group_id;
/**
* @var NewsletterMessage
*/
protected $aNewsletterMessage;
/**
* @var NewsletterGroup
*/
protected $aNewsletterGroup;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [optionally formatted] [created_at] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function getCreatedAt($format = 'Y-m-d H:i:s')
{
if ($this->created_at === null || $this->created_at === '') {
return null;
} elseif (!is_int($this->created_at)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->created_at);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
}
} else {
$ts = $this->created_at;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
/**
* Get the [optionally formatted] [updated_at] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function getUpdatedAt($format = 'Y-m-d H:i:s')
{
if ($this->updated_at === null || $this->updated_at === '') {
return null;
} elseif (!is_int($this->updated_at)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->updated_at);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
}
} else {
$ts = $this->updated_at;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
/**
* Get the [newsletter_message_id] column value.
*
* @return int
*/
public function getNewsletterMessageId()
{
return $this->newsletter_message_id;
}
/**
* Get the [newsletter_group_id] column value.
*
* @return int
*/
public function getNewsletterGroupId()
{
return $this->newsletter_group_id;
}
/**
* Set the value of [created_at] column.
*
* @param int $v new value
* @return void
*/
public function setCreatedAt($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->created_at !== $ts) {
$this->created_at = $ts;
$this->modifiedColumns[] = NewsletterMessageHasNewsletterGroupPeer::CREATED_AT;
}
} // setCreatedAt()
/**
* Set the value of [updated_at] column.
*
* @param int $v new value
* @return void
*/
public function setUpdatedAt($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->updated_at !== $ts) {
$this->updated_at = $ts;
$this->modifiedColumns[] = NewsletterMessageHasNewsletterGroupPeer::UPDATED_AT;
}
} // setUpdatedAt()
/**
* Set the value of [newsletter_message_id] column.
*
* @param int $v new value
* @return void
*/
public function setNewsletterMessageId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->newsletter_message_id !== $v) {
$this->newsletter_message_id = $v;
$this->modifiedColumns[] = NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID;
}
if ($this->aNewsletterMessage !== null && $this->aNewsletterMessage->getId() !== $v) {
$this->aNewsletterMessage = null;
}
} // setNewsletterMessageId()
/**
* Set the value of [newsletter_group_id] column.
*
* @param int $v new value
* @return void
*/
public function setNewsletterGroupId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->newsletter_group_id !== $v) {
$this->newsletter_group_id = $v;
$this->modifiedColumns[] = NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID;
}
if ($this->aNewsletterGroup !== null && $this->aNewsletterGroup->getId() !== $v) {
$this->aNewsletterGroup = null;
}
} // setNewsletterGroupId()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (1-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.preHydrate')) {
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.preHydrate', array('resultset' => $rs, 'startcol' => $startcol)));
$startcol = $event['startcol'];
}
$this->created_at = $rs->getTimestamp($startcol + 0, null);
$this->updated_at = $rs->getTimestamp($startcol + 1, null);
$this->newsletter_message_id = $rs->getInt($startcol + 2);
$this->newsletter_group_id = $rs->getInt($startcol + 3);
$this->resetModified();
$this->setNew(false);
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.postHydrate')) {
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 4)));
return $event['startcol'];
}
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = NewsletterMessageHasNewsletterGroupPeer::NUM_COLUMNS - NewsletterMessageHasNewsletterGroupPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating NewsletterMessageHasNewsletterGroup object", $e);
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param Connection $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.preDelete')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.preDelete', array('con' => $con)));
}
if (sfMixer::hasCallables('BaseNewsletterMessageHasNewsletterGroup:delete:pre'))
{
foreach (sfMixer::getCallables('BaseNewsletterMessageHasNewsletterGroup:delete:pre') as $callable)
{
$ret = call_user_func($callable, $this, $con);
if ($ret)
{
return;
}
}
}
if ($con === null) {
$con = Propel::getConnection(NewsletterMessageHasNewsletterGroupPeer::DATABASE_NAME);
}
try {
$con->begin();
NewsletterMessageHasNewsletterGroupPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.postDelete')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.postDelete', array('con' => $con)));
}
if (sfMixer::hasCallables('BaseNewsletterMessageHasNewsletterGroup:delete:post'))
{
foreach (sfMixer::getCallables('BaseNewsletterMessageHasNewsletterGroup:delete:post') as $callable)
{
call_user_func($callable, $this, $con);
}
}
}
/**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see doSave()
*/
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if (!$this->alreadyInSave) {
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.preSave')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.preSave', array('con' => $con)));
}
foreach (sfMixer::getCallables('BaseNewsletterMessageHasNewsletterGroup:save:pre') as $callable)
{
$affectedRows = call_user_func($callable, $this, $con);
if (is_int($affectedRows))
{
return $affectedRows;
}
}
}
if ($this->isNew() && !$this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::CREATED_AT))
{
$this->setCreatedAt(time());
}
if ($this->isModified() && !$this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::UPDATED_AT))
{
$this->setUpdatedAt(time());
}
if ($con === null) {
$con = Propel::getConnection(NewsletterMessageHasNewsletterGroupPeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
if (!$this->alreadyInSave) {
if ($this->getDispatcher()->getListeners('NewsletterMessageHasNewsletterGroup.postSave')) {
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.postSave', array('con' => $con)));
}
foreach (sfMixer::getCallables('BaseNewsletterMessageHasNewsletterGroup:save:post') as $callable)
{
call_user_func($callable, $this, $con, $affectedRows);
}
}
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave($con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aNewsletterMessage !== null) {
if ($this->aNewsletterMessage->isModified() || $this->aNewsletterMessage->getCurrentNewsletterMessageI18n()->isModified()) {
$affectedRows += $this->aNewsletterMessage->save($con);
}
$this->setNewsletterMessage($this->aNewsletterMessage);
}
if ($this->aNewsletterGroup !== null) {
if ($this->aNewsletterGroup->isModified() || $this->aNewsletterGroup->getCurrentNewsletterGroupI18n()->isModified()) {
$affectedRows += $this->aNewsletterGroup->save($con);
}
$this->setNewsletterGroup($this->aNewsletterGroup);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = NewsletterMessageHasNewsletterGroupPeer::doInsert($this, $con);
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += NewsletterMessageHasNewsletterGroupPeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aNewsletterMessage !== null) {
if (!$this->aNewsletterMessage->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aNewsletterMessage->getValidationFailures());
}
}
if ($this->aNewsletterGroup !== null) {
if (!$this->aNewsletterGroup->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aNewsletterGroup->getValidationFailures());
}
}
if (($retval = NewsletterMessageHasNewsletterGroupPeer::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 TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = NewsletterMessageHasNewsletterGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
/**
* 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->getCreatedAt();
break;
case 1:
return $this->getUpdatedAt();
break;
case 2:
return $this->getNewsletterMessageId();
break;
case 3:
return $this->getNewsletterGroupId();
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 One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = NewsletterMessageHasNewsletterGroupPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getCreatedAt(),
$keys[1] => $this->getUpdatedAt(),
$keys[2] => $this->getNewsletterMessageId(),
$keys[3] => $this->getNewsletterGroupId(),
);
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 TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = NewsletterMessageHasNewsletterGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setCreatedAt($value);
break;
case 1:
$this->setUpdatedAt($value);
break;
case 2:
$this->setNewsletterMessageId($value);
break;
case 3:
$this->setNewsletterGroupId($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 TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = NewsletterMessageHasNewsletterGroupPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setCreatedAt($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUpdatedAt($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setNewsletterMessageId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setNewsletterGroupId($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(NewsletterMessageHasNewsletterGroupPeer::DATABASE_NAME);
if ($this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::CREATED_AT)) $criteria->add(NewsletterMessageHasNewsletterGroupPeer::CREATED_AT, $this->created_at);
if ($this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::UPDATED_AT)) $criteria->add(NewsletterMessageHasNewsletterGroupPeer::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID)) $criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->newsletter_message_id);
if ($this->isColumnModified(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID)) $criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID, $this->newsletter_group_id);
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(NewsletterMessageHasNewsletterGroupPeer::DATABASE_NAME);
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->newsletter_message_id);
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_GROUP_ID, $this->newsletter_group_id);
return $criteria;
}
/**
* Returns the composite primary key for this object.
* The array elements will be in same order as specified in XML.
* @return array
*/
public function getPrimaryKey()
{
return array($this->getNewsletterMessageId(), $this->getNewsletterGroupId());
}
/**
* Returns [composite] primary key fields
*
* @param string $keyType
* @return array
*/
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
{
return array(NewsletterMessageHasNewsletterGroupPeer::translateFieldName('newsletter_message_id', BasePeer::TYPE_FIELDNAME, $keyType), NewsletterMessageHasNewsletterGroupPeer::translateFieldName('newsletter_group_id', BasePeer::TYPE_FIELDNAME, $keyType));
}
/**
* Set the [composite] primary key.
*
* @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void
*/
public function setPrimaryKey($keys)
{
$this->setNewsletterMessageId($keys[0]);
$this->setNewsletterGroupId($keys[1]);
}
/**
* 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 NewsletterMessageHasNewsletterGroup (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setCreatedAt($this->created_at);
$copyObj->setUpdatedAt($this->updated_at);
$copyObj->setNew(true);
$copyObj->setNewsletterMessageId(NULL); // this is a pkey column, so set to default value
$copyObj->setNewsletterGroupId(NULL); // this is a pkey column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return NewsletterMessageHasNewsletterGroup 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.
*
* @return string Peer class name
*/
public function getPeer()
{
return 'NewsletterMessageHasNewsletterGroupPeer';
}
/**
* Declares an association between this object and a NewsletterMessage object.
*
* @param NewsletterMessage $v
* @return void
* @throws PropelException
*/
public function setNewsletterMessage($v)
{
if ($v === null) {
$this->setNewsletterMessageId(NULL);
} else {
$this->setNewsletterMessageId($v->getId());
}
$this->aNewsletterMessage = $v;
}
/**
* Get the associated NewsletterMessage object
*
* @param Connection Optional Connection object.
* @return NewsletterMessage The associated NewsletterMessage object.
* @throws PropelException
*/
public function getNewsletterMessage($con = null)
{
if ($this->aNewsletterMessage === null && ($this->newsletter_message_id !== null)) {
// include the related Peer class
$this->aNewsletterMessage = NewsletterMessagePeer::retrieveByPK($this->newsletter_message_id, $con);
/* The following can be used instead of the line above to
guarantee the related object contains a reference
to this object, but this level of coupling
may be undesirable in many circumstances.
As it can lead to a db query with many results that may
never be used.
$obj = NewsletterMessagePeer::retrieveByPK($this->newsletter_message_id, $con);
$obj->addNewsletterMessages($this);
*/
}
return $this->aNewsletterMessage;
}
/**
* Declares an association between this object and a NewsletterGroup object.
*
* @param NewsletterGroup $v
* @return void
* @throws PropelException
*/
public function setNewsletterGroup($v)
{
if ($v === null) {
$this->setNewsletterGroupId(NULL);
} else {
$this->setNewsletterGroupId($v->getId());
}
$this->aNewsletterGroup = $v;
}
/**
* Get the associated NewsletterGroup object
*
* @param Connection Optional Connection object.
* @return NewsletterGroup The associated NewsletterGroup object.
* @throws PropelException
*/
public function getNewsletterGroup($con = null)
{
if ($this->aNewsletterGroup === null && ($this->newsletter_group_id !== null)) {
// include the related Peer class
$this->aNewsletterGroup = NewsletterGroupPeer::retrieveByPK($this->newsletter_group_id, $con);
/* The following can be used instead of the line above to
guarantee the related object contains a reference
to this object, but this level of coupling
may be undesirable in many circumstances.
As it can lead to a db query with many results that may
never be used.
$obj = NewsletterGroupPeer::retrieveByPK($this->newsletter_group_id, $con);
$obj->addNewsletterGroups($this);
*/
}
return $this->aNewsletterGroup;
}
public function getDispatcher()
{
if (null === self::$dispatcher)
{
self::$dispatcher = stEventDispatcher::getInstance();
}
return self::$dispatcher;
}
public function __call($method, $arguments)
{
$event = $this->getDispatcher()->notifyUntil(new sfEvent($this, 'NewsletterMessageHasNewsletterGroup.' . $method, array('arguments' => $arguments, 'method' => $method)));
if ($event->isProcessed())
{
return $event->getReturnValue();
}
if (!$callable = sfMixer::getCallable('BaseNewsletterMessageHasNewsletterGroup:'.$method))
{
throw new sfException(sprintf('Call to undefined method BaseNewsletterMessageHasNewsletterGroup::%s', $method));
}
array_unshift($arguments, $this);
return call_user_func_array($callable, $arguments);
}
} // BaseNewsletterMessageHasNewsletterGroup

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,864 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_message_i18n' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterMessageI18nPeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_message_i18n';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterMessageI18n';
/** The total number of columns. */
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'st_newsletter_message_i18n.ID';
/** the column name for the CULTURE field */
const CULTURE = 'st_newsletter_message_i18n.CULTURE';
/** the column name for the SUBJECT field */
const SUBJECT = 'st_newsletter_message_i18n.SUBJECT';
/** the column name for the CONTENT field */
const CONTENT = 'st_newsletter_message_i18n.CONTENT';
/** the column name for the CTA_DESCRIPTION_HEAD field */
const CTA_DESCRIPTION_HEAD = 'st_newsletter_message_i18n.CTA_DESCRIPTION_HEAD';
/** the column name for the CTA_DESCRIPTION_FOOT field */
const CTA_DESCRIPTION_FOOT = 'st_newsletter_message_i18n.CTA_DESCRIPTION_FOOT';
/** the column name for the CTA_BUTTON_NAME field */
const CTA_BUTTON_NAME = 'st_newsletter_message_i18n.CTA_BUTTON_NAME';
/** the column name for the PRODUCTS_NAME field */
const PRODUCTS_NAME = 'st_newsletter_message_i18n.PRODUCTS_NAME';
/** the column name for the RECOMMENDS_NAME field */
const RECOMMENDS_NAME = 'st_newsletter_message_i18n.RECOMMENDS_NAME';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Culture', 'Subject', 'Content', 'CtaDescriptionHead', 'CtaDescriptionFoot', 'CtaButtonName', 'ProductsName', 'RecommendsName', ),
BasePeer::TYPE_COLNAME => array (NewsletterMessageI18nPeer::ID, NewsletterMessageI18nPeer::CULTURE, NewsletterMessageI18nPeer::SUBJECT, NewsletterMessageI18nPeer::CONTENT, NewsletterMessageI18nPeer::CTA_DESCRIPTION_HEAD, NewsletterMessageI18nPeer::CTA_DESCRIPTION_FOOT, NewsletterMessageI18nPeer::CTA_BUTTON_NAME, NewsletterMessageI18nPeer::PRODUCTS_NAME, NewsletterMessageI18nPeer::RECOMMENDS_NAME, ),
BasePeer::TYPE_FIELDNAME => array ('id', 'culture', 'subject', 'content', 'cta_description_head', 'cta_description_foot', 'cta_button_name', 'products_name', 'recommends_name', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Culture' => 1, 'Subject' => 2, 'Content' => 3, 'CtaDescriptionHead' => 4, 'CtaDescriptionFoot' => 5, 'CtaButtonName' => 6, 'ProductsName' => 7, 'RecommendsName' => 8, ),
BasePeer::TYPE_COLNAME => array (NewsletterMessageI18nPeer::ID => 0, NewsletterMessageI18nPeer::CULTURE => 1, NewsletterMessageI18nPeer::SUBJECT => 2, NewsletterMessageI18nPeer::CONTENT => 3, NewsletterMessageI18nPeer::CTA_DESCRIPTION_HEAD => 4, NewsletterMessageI18nPeer::CTA_DESCRIPTION_FOOT => 5, NewsletterMessageI18nPeer::CTA_BUTTON_NAME => 6, NewsletterMessageI18nPeer::PRODUCTS_NAME => 7, NewsletterMessageI18nPeer::RECOMMENDS_NAME => 8, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'culture' => 1, 'subject' => 2, 'content' => 3, 'cta_description_head' => 4, 'cta_description_foot' => 5, 'cta_button_name' => 6, 'products_name' => 7, 'recommends_name' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageI18nMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterMessageI18nPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterMessageI18nPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterMessageI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterMessageI18nPeer::ID);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::CULTURE);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::SUBJECT);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::CONTENT);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::CTA_DESCRIPTION_HEAD);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::CTA_DESCRIPTION_FOOT);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::CTA_BUTTON_NAME);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::PRODUCTS_NAME);
$criteria->addSelectColumn(NewsletterMessageI18nPeer::RECOMMENDS_NAME);
if (stEventDispatcher::getInstance()->getListeners('NewsletterMessageI18nPeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterMessageI18nPeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_message_i18n.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_message_i18n.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterMessageI18n
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterMessageI18nPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterMessageI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterMessageI18nPeer::populateObjects(NewsletterMessageI18nPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterMessageI18nPeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterMessageI18nPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining the related NewsletterMessage table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinNewsletterMessage(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterMessageI18nPeer::ID, NewsletterMessagePeer::ID);
$rs = NewsletterMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterMessageI18n objects pre-filled with their NewsletterMessage objects.
*
* @return NewsletterMessageI18n[] Array of NewsletterMessageI18n objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinNewsletterMessage(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterMessageI18nPeer::addSelectColumns($c);
NewsletterMessagePeer::addSelectColumns($c);
$c->addJoin(NewsletterMessageI18nPeer::ID, NewsletterMessagePeer::ID);
$rs = NewsletterMessageI18nPeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterMessageI18n();
$startcol = $obj1->hydrate($rs);
if ($obj1->getId())
{
$obj2 = new NewsletterMessage();
$obj2->hydrate($rs, $startcol);
$obj2->addNewsletterMessageI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterMessageI18nPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterMessageI18nPeer::ID, NewsletterMessagePeer::ID);
$rs = NewsletterMessageI18nPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterMessageI18n objects pre-filled with all related objects.
*
* @return NewsletterMessageI18n[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterMessageI18nPeer::addSelectColumns($c);
$startcol2 = (NewsletterMessageI18nPeer::NUM_COLUMNS - NewsletterMessageI18nPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
NewsletterMessagePeer::addSelectColumns($c);
$startcol3 = $startcol2 + NewsletterMessagePeer::NUM_COLUMNS;
$c->addJoin(NewsletterMessageI18nPeer::ID, NewsletterMessagePeer::ID);
$rs = BasePeer::doSelect($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$omClass = NewsletterMessageI18nPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
// Add objects for joined NewsletterMessage rows
$omClass = NewsletterMessagePeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getNewsletterMessage(); // CHECKME
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addNewsletterMessageI18n($obj1); // CHECKME
break;
}
}
if ($newObject) {
$obj2->initNewsletterMessageI18ns();
$obj2->addNewsletterMessageI18n($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterMessageI18nPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterMessageI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterMessageI18n object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterMessageI18nPeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterMessageI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterMessageI18n object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterMessageI18nPeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterMessageI18nPeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterMessageI18n or Criteria object.
*
* @param mixed $values Criteria or NewsletterMessageI18n object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterMessageI18nPeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterMessageI18nPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterMessageI18nPeer::ID);
$selectCriteria->add(NewsletterMessageI18nPeer::ID, $criteria->remove(NewsletterMessageI18nPeer::ID), $comparison);
$comparison = $criteria->getComparison(NewsletterMessageI18nPeer::CULTURE);
$selectCriteria->add(NewsletterMessageI18nPeer::CULTURE, $criteria->remove(NewsletterMessageI18nPeer::CULTURE), $comparison);
} else { // $values is NewsletterMessageI18n object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterMessageI18nPeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterMessageI18nPeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_message_i18n table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(NewsletterMessageI18nPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterMessageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterMessageI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterMessageI18nPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterMessageI18n) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if(count($values) == count($values, COUNT_RECURSIVE))
{
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach($values as $value)
{
$vals[0][] = $value[0];
$vals[1][] = $value[1];
}
$criteria->add(NewsletterMessageI18nPeer::ID, $vals[0], Criteria::IN);
$criteria->add(NewsletterMessageI18nPeer::CULTURE, $vals[1], Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given NewsletterMessageI18n 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 NewsletterMessageI18n $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(NewsletterMessageI18n $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterMessageI18nPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterMessageI18nPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterMessageI18nPeer::DATABASE_NAME, NewsletterMessageI18nPeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterMessageI18nPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve object using using composite pkey values.
* @param int $id
@param string $culture
* @param Connection $con
* @return NewsletterMessageI18n
*/
public static function retrieveByPK( $id, $culture, $con = null) {
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria();
$criteria->add(NewsletterMessageI18nPeer::ID, $id);
$criteria->add(NewsletterMessageI18nPeer::CULTURE, $culture);
$v = NewsletterMessageI18nPeer::doSelect($criteria, $con);
return !empty($v) ? $v[0] : null;
}
} // BaseNewsletterMessageI18nPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterMessageI18nPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterMessageI18nMapBuilder');
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,909 @@
<?php
/**
* Base static class for performing query and update operations on the 'st_newsletter_user' table.
*
*
*
* @package plugins.stNewsletterPlugin.lib.model.om
*/
abstract class BaseNewsletterUserPeer {
/** the default database name for this class */
const DATABASE_NAME = 'propel';
/** the table name for this class */
const TABLE_NAME = 'st_newsletter_user';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'plugins.stNewsletterPlugin.lib.model.NewsletterUser';
/** The total number of columns. */
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the CREATED_AT field */
const CREATED_AT = 'st_newsletter_user.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'st_newsletter_user.UPDATED_AT';
/** the column name for the ID field */
const ID = 'st_newsletter_user.ID';
/** the column name for the SF_GUARD_USER_ID field */
const SF_GUARD_USER_ID = 'st_newsletter_user.SF_GUARD_USER_ID';
/** the column name for the EMAIL field */
const EMAIL = 'st_newsletter_user.EMAIL';
/** the column name for the ACTIVE field */
const ACTIVE = 'st_newsletter_user.ACTIVE';
/** the column name for the CONFIRM field */
const CONFIRM = 'st_newsletter_user.CONFIRM';
/** the column name for the HASH field */
const HASH = 'st_newsletter_user.HASH';
/** the column name for the LANGUAGE field */
const LANGUAGE = 'st_newsletter_user.LANGUAGE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt', 'UpdatedAt', 'Id', 'SfGuardUserId', 'Email', 'Active', 'Confirm', 'Hash', 'Language', ),
BasePeer::TYPE_COLNAME => array (NewsletterUserPeer::CREATED_AT, NewsletterUserPeer::UPDATED_AT, NewsletterUserPeer::ID, NewsletterUserPeer::SF_GUARD_USER_ID, NewsletterUserPeer::EMAIL, NewsletterUserPeer::ACTIVE, NewsletterUserPeer::CONFIRM, NewsletterUserPeer::HASH, NewsletterUserPeer::LANGUAGE, ),
BasePeer::TYPE_FIELDNAME => array ('created_at', 'updated_at', 'id', 'sf_guard_user_id', 'email', 'active', 'confirm', 'hash', 'language', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('CreatedAt' => 0, 'UpdatedAt' => 1, 'Id' => 2, 'SfGuardUserId' => 3, 'Email' => 4, 'Active' => 5, 'Confirm' => 6, 'Hash' => 7, 'Language' => 8, ),
BasePeer::TYPE_COLNAME => array (NewsletterUserPeer::CREATED_AT => 0, NewsletterUserPeer::UPDATED_AT => 1, NewsletterUserPeer::ID => 2, NewsletterUserPeer::SF_GUARD_USER_ID => 3, NewsletterUserPeer::EMAIL => 4, NewsletterUserPeer::ACTIVE => 5, NewsletterUserPeer::CONFIRM => 6, NewsletterUserPeer::HASH => 7, NewsletterUserPeer::LANGUAGE => 8, ),
BasePeer::TYPE_FIELDNAME => array ('created_at' => 0, 'updated_at' => 1, 'id' => 2, 'sf_guard_user_id' => 3, 'email' => 4, 'active' => 5, 'confirm' => 6, 'hash' => 7, 'language' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
protected static $hydrateMethod = null;
protected static $postHydrateMethod = null;
public static function setHydrateMethod($callback)
{
self::$hydrateMethod = $callback;
}
public static function setPostHydrateMethod($callback)
{
self::$postHydrateMethod = $callback;
}
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
return BasePeer::getMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterUserMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = NewsletterUserPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. NewsletterUserPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(NewsletterUserPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(NewsletterUserPeer::CREATED_AT);
$criteria->addSelectColumn(NewsletterUserPeer::UPDATED_AT);
$criteria->addSelectColumn(NewsletterUserPeer::ID);
$criteria->addSelectColumn(NewsletterUserPeer::SF_GUARD_USER_ID);
$criteria->addSelectColumn(NewsletterUserPeer::EMAIL);
$criteria->addSelectColumn(NewsletterUserPeer::ACTIVE);
$criteria->addSelectColumn(NewsletterUserPeer::CONFIRM);
$criteria->addSelectColumn(NewsletterUserPeer::HASH);
$criteria->addSelectColumn(NewsletterUserPeer::LANGUAGE);
if (stEventDispatcher::getInstance()->getListeners('NewsletterUserPeer.postAddSelectColumns')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'NewsletterUserPeer.postAddSelectColumns'));
}
}
const COUNT = 'COUNT(st_newsletter_user.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT st_newsletter_user.ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$rs = NewsletterUserPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return NewsletterUser
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = NewsletterUserPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return NewsletterUser[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return NewsletterUserPeer::populateObjects(NewsletterUserPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
NewsletterUserPeer::addSelectColumns($criteria);
}
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
$rs = BasePeer::doSelect($criteria, $con);
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
}
return $rs;
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
// set the class once to avoid overhead in the loop
$cls = NewsletterUserPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining the related sfGuardUser table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinsfGuardUser(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterUserPeer::SF_GUARD_USER_ID, sfGuardUserPeer::ID, Criteria::LEFT_JOIN);
$rs = NewsletterUserPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterUser objects pre-filled with their sfGuardUser objects.
*
* @return NewsletterUser[] Array of NewsletterUser objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinsfGuardUser(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterUserPeer::addSelectColumns($c);
sfGuardUserPeer::addSelectColumns($c);
$c->addJoin(NewsletterUserPeer::SF_GUARD_USER_ID, sfGuardUserPeer::ID, Criteria::LEFT_JOIN);
$rs = NewsletterUserPeer::doSelectRs($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$obj1 = new NewsletterUser();
$startcol = $obj1->hydrate($rs);
if ($obj1->getSfGuardUserId())
{
$obj2 = new sfGuardUser();
$obj2->hydrate($rs, $startcol);
$obj2->addNewsletterUser($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
}
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(NewsletterUserPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
$criteria->addSelectColumn($column);
}
$criteria->addJoin(NewsletterUserPeer::SF_GUARD_USER_ID, sfGuardUserPeer::ID, Criteria::LEFT_JOIN);
$rs = NewsletterUserPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Selects a collection of NewsletterUser objects pre-filled with all related objects.
*
* @return NewsletterUser[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $c, $con = null)
{
$c = clone $c;
// Set the correct dbName if it has not been overridden
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
NewsletterUserPeer::addSelectColumns($c);
$startcol2 = (NewsletterUserPeer::NUM_COLUMNS - NewsletterUserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
sfGuardUserPeer::addSelectColumns($c);
$startcol3 = $startcol2 + sfGuardUserPeer::NUM_COLUMNS;
$c->addJoin(NewsletterUserPeer::SF_GUARD_USER_ID, sfGuardUserPeer::ID, Criteria::LEFT_JOIN);
$rs = BasePeer::doSelect($c, $con);
if (self::$hydrateMethod)
{
return call_user_func(self::$hydrateMethod, $rs);
}
$results = array();
while($rs->next()) {
$omClass = NewsletterUserPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
// Add objects for joined sfGuardUser rows
$omClass = sfGuardUserPeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getsfGuardUser(); // CHECKME
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addNewsletterUser($obj1); // CHECKME
break;
}
}
if ($newObject) {
$obj2->initNewsletterUsers();
$obj2->addNewsletterUser($obj1);
}
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return NewsletterUserPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a NewsletterUser or Criteria object.
*
* @param mixed $values Criteria or NewsletterUser object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterUserPeer:doInsert:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterUserPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from NewsletterUser object
}
$criteria->remove(NewsletterUserPeer::ID); // remove pkey col since this table uses auto-increment
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollback();
throw $e;
}
foreach (sfMixer::getCallables('BaseNewsletterUserPeer:doInsert:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterUserPeer', $values, $con, $pk);
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a NewsletterUser or Criteria object.
*
* @param mixed $values Criteria or NewsletterUser object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
foreach (sfMixer::getCallables('BaseNewsletterUserPeer:doUpdate:pre') as $callable)
{
$ret = call_user_func($callable, 'BaseNewsletterUserPeer', $values, $con);
if (false !== $ret)
{
return $ret;
}
}
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(NewsletterUserPeer::ID);
$selectCriteria->add(NewsletterUserPeer::ID, $criteria->remove(NewsletterUserPeer::ID), $comparison);
} else { // $values is NewsletterUser object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
foreach (sfMixer::getCallables('BaseNewsletterUserPeer:doUpdate:post') as $callable)
{
call_user_func($callable, 'BaseNewsletterUserPeer', $values, $con, $ret);
}
return $ret;
}
/**
* Method to DELETE all rows from the st_newsletter_user table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterUserPeer::doOnDeleteCascade(new Criteria(), $con);
$affectedRows += BasePeer::doDeleteAll(NewsletterUserPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a NewsletterUser or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or NewsletterUser object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(NewsletterUserPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof NewsletterUser) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(NewsletterUserPeer::ID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += NewsletterUserPeer::doOnDeleteCascade($criteria, $con);
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param Connection $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = NewsletterUserPeer::doSelect($criteria, $con);
foreach($objects as $obj) {
// delete related NewsletterUserHasNewsletterGroup objects
$c = new Criteria();
$c->add(NewsletterUserHasNewsletterGroupPeer::NEWSLETTER_USER_ID, $obj->getId());
$affectedRows += NewsletterUserHasNewsletterGroupPeer::doDelete($c, $con);
}
return $affectedRows;
}
/**
* Validates all modified columns of given NewsletterUser 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 NewsletterUser $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(NewsletterUser $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(NewsletterUserPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(NewsletterUserPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
$res = BasePeer::doValidate(NewsletterUserPeer::DATABASE_NAME, NewsletterUserPeer::TABLE_NAME, $columns);
if ($res !== true) {
$request = sfContext::getInstance()->getRequest();
foreach ($res as $failed) {
$col = NewsletterUserPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
$request->setError($col, $failed->getMessage());
}
}
return $res;
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return NewsletterUser
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(NewsletterUserPeer::DATABASE_NAME);
$criteria->add(NewsletterUserPeer::ID, $pk);
$v = NewsletterUserPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return NewsletterUser[]
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(NewsletterUserPeer::ID, $pks, Criteria::IN);
$objs = NewsletterUserPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseNewsletterUserPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseNewsletterUserPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
Propel::registerMapBuilder('plugins.stNewsletterPlugin.lib.model.map.NewsletterUserMapBuilder');
}