2661 lines
75 KiB
PHP
2661 lines
75 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Base class that represents a row from the 'st_newsletter_message' table.
|
|
*
|
|
*
|
|
*
|
|
* @package plugins.stNewsletterPlugin.lib.model.om
|
|
*/
|
|
abstract class BaseNewsletterMessage 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 id field.
|
|
* @var int
|
|
*/
|
|
protected $id;
|
|
|
|
|
|
/**
|
|
* The value for the newsletter_draft_message_id field.
|
|
* @var int
|
|
*/
|
|
protected $newsletter_draft_message_id;
|
|
|
|
|
|
/**
|
|
* The value for the opt_subject field.
|
|
* @var string
|
|
*/
|
|
protected $opt_subject;
|
|
|
|
|
|
/**
|
|
* The value for the opt_content field.
|
|
* @var string
|
|
*/
|
|
protected $opt_content;
|
|
|
|
|
|
/**
|
|
* The value for the main_image field.
|
|
* @var string
|
|
*/
|
|
protected $main_image;
|
|
|
|
|
|
/**
|
|
* The value for the main_image_url field.
|
|
* @var string
|
|
*/
|
|
protected $main_image_url;
|
|
|
|
|
|
/**
|
|
* The value for the opt_cta_button_name field.
|
|
* @var string
|
|
*/
|
|
protected $opt_cta_button_name;
|
|
|
|
|
|
/**
|
|
* The value for the cta_button_url field.
|
|
* @var string
|
|
*/
|
|
protected $cta_button_url;
|
|
|
|
|
|
/**
|
|
* The value for the cta_button_position field.
|
|
* @var string
|
|
*/
|
|
protected $cta_button_position;
|
|
|
|
|
|
/**
|
|
* The value for the opt_cta_description_head field.
|
|
* @var string
|
|
*/
|
|
protected $opt_cta_description_head;
|
|
|
|
|
|
/**
|
|
* The value for the opt_cta_description_foot field.
|
|
* @var string
|
|
*/
|
|
protected $opt_cta_description_foot;
|
|
|
|
|
|
/**
|
|
* The value for the opt_products_name field.
|
|
* @var string
|
|
*/
|
|
protected $opt_products_name;
|
|
|
|
|
|
/**
|
|
* The value for the opt_recommends_name field.
|
|
* @var string
|
|
*/
|
|
protected $opt_recommends_name;
|
|
|
|
|
|
/**
|
|
* The value for the sent_at field.
|
|
* @var int
|
|
*/
|
|
protected $sent_at;
|
|
|
|
|
|
/**
|
|
* The value for the number_sent field.
|
|
* @var int
|
|
*/
|
|
protected $number_sent;
|
|
|
|
|
|
/**
|
|
* The value for the number_sent_gmail field.
|
|
* @var int
|
|
*/
|
|
protected $number_sent_gmail;
|
|
|
|
|
|
/**
|
|
* The value for the number_received field.
|
|
* @var int
|
|
*/
|
|
protected $number_received;
|
|
|
|
|
|
/**
|
|
* The value for the number_read field.
|
|
* @var int
|
|
*/
|
|
protected $number_read;
|
|
|
|
|
|
/**
|
|
* The value for the template_version field.
|
|
* @var int
|
|
*/
|
|
protected $template_version;
|
|
|
|
|
|
/**
|
|
* The value for the hash field.
|
|
* @var string
|
|
*/
|
|
protected $hash;
|
|
|
|
/**
|
|
* @var NewsletterDraftMessage
|
|
*/
|
|
protected $aNewsletterDraftMessage;
|
|
|
|
/**
|
|
* Collection to store aggregation of collNewsletterMessageHasNewsletterGroups.
|
|
* @var array
|
|
*/
|
|
protected $collNewsletterMessageHasNewsletterGroups;
|
|
|
|
/**
|
|
* The criteria used to select the current contents of collNewsletterMessageHasNewsletterGroups.
|
|
* @var Criteria
|
|
*/
|
|
protected $lastNewsletterMessageHasNewsletterGroupCriteria = null;
|
|
|
|
/**
|
|
* Collection to store aggregation of collNewsletterMessageHasProducts.
|
|
* @var array
|
|
*/
|
|
protected $collNewsletterMessageHasProducts;
|
|
|
|
/**
|
|
* The criteria used to select the current contents of collNewsletterMessageHasProducts.
|
|
* @var Criteria
|
|
*/
|
|
protected $lastNewsletterMessageHasProductCriteria = null;
|
|
|
|
/**
|
|
* Collection to store aggregation of collNewsletterMessageHasBlogs.
|
|
* @var array
|
|
*/
|
|
protected $collNewsletterMessageHasBlogs;
|
|
|
|
/**
|
|
* The criteria used to select the current contents of collNewsletterMessageHasBlogs.
|
|
* @var Criteria
|
|
*/
|
|
protected $lastNewsletterMessageHasBlogCriteria = null;
|
|
|
|
/**
|
|
* Collection to store aggregation of collNewsletterMessageI18ns.
|
|
* @var array
|
|
*/
|
|
protected $collNewsletterMessageI18ns;
|
|
|
|
/**
|
|
* The criteria used to select the current contents of collNewsletterMessageI18ns.
|
|
* @var Criteria
|
|
*/
|
|
protected $lastNewsletterMessageI18nCriteria = null;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* The value for the culture field.
|
|
* @var string
|
|
*/
|
|
protected $culture;
|
|
|
|
/**
|
|
* 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 [id] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getId()
|
|
{
|
|
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Get the [newsletter_draft_message_id] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getNewsletterDraftMessageId()
|
|
{
|
|
|
|
return $this->newsletter_draft_message_id;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_subject] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptSubject()
|
|
{
|
|
|
|
return $this->opt_subject;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_content] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptContent()
|
|
{
|
|
|
|
return $this->opt_content;
|
|
}
|
|
|
|
/**
|
|
* Get the [main_image] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getMainImage()
|
|
{
|
|
|
|
return $this->main_image;
|
|
}
|
|
|
|
/**
|
|
* Get the [main_image_url] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getMainImageUrl()
|
|
{
|
|
|
|
return $this->main_image_url;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_cta_button_name] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptCtaButtonName()
|
|
{
|
|
|
|
return $this->opt_cta_button_name;
|
|
}
|
|
|
|
/**
|
|
* Get the [cta_button_url] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getCtaButtonUrl()
|
|
{
|
|
|
|
return $this->cta_button_url;
|
|
}
|
|
|
|
/**
|
|
* Get the [cta_button_position] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getCtaButtonPosition()
|
|
{
|
|
|
|
return $this->cta_button_position;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_cta_description_head] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptCtaDescriptionHead()
|
|
{
|
|
|
|
return $this->opt_cta_description_head;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_cta_description_foot] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptCtaDescriptionFoot()
|
|
{
|
|
|
|
return $this->opt_cta_description_foot;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_products_name] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptProductsName()
|
|
{
|
|
|
|
return $this->opt_products_name;
|
|
}
|
|
|
|
/**
|
|
* Get the [opt_recommends_name] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getOptRecommendsName()
|
|
{
|
|
|
|
return $this->opt_recommends_name;
|
|
}
|
|
|
|
/**
|
|
* Get the [optionally formatted] [sent_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 getSentAt($format = 'Y-m-d H:i:s')
|
|
{
|
|
|
|
if ($this->sent_at === null || $this->sent_at === '') {
|
|
return null;
|
|
} elseif (!is_int($this->sent_at)) {
|
|
// a non-timestamp value was set externally, so we convert it
|
|
$ts = strtotime($this->sent_at);
|
|
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
|
|
throw new PropelException("Unable to parse value of [sent_at] as date/time value: " . var_export($this->sent_at, true));
|
|
}
|
|
} else {
|
|
$ts = $this->sent_at;
|
|
}
|
|
if ($format === null) {
|
|
return $ts;
|
|
} elseif (strpos($format, '%') !== false) {
|
|
return strftime($format, $ts);
|
|
} else {
|
|
return date($format, $ts);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get the [number_sent] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getNumberSent()
|
|
{
|
|
|
|
return $this->number_sent;
|
|
}
|
|
|
|
/**
|
|
* Get the [number_sent_gmail] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getNumberSentGmail()
|
|
{
|
|
|
|
return $this->number_sent_gmail;
|
|
}
|
|
|
|
/**
|
|
* Get the [number_received] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getNumberReceived()
|
|
{
|
|
|
|
return $this->number_received;
|
|
}
|
|
|
|
/**
|
|
* Get the [number_read] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getNumberRead()
|
|
{
|
|
|
|
return $this->number_read;
|
|
}
|
|
|
|
/**
|
|
* Get the [template_version] column value.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getTemplateVersion()
|
|
{
|
|
|
|
return $this->template_version;
|
|
}
|
|
|
|
/**
|
|
* Get the [hash] column value.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getHash()
|
|
{
|
|
|
|
return $this->hash;
|
|
}
|
|
|
|
/**
|
|
* 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[] = NewsletterMessagePeer::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[] = NewsletterMessagePeer::UPDATED_AT;
|
|
}
|
|
|
|
} // setUpdatedAt()
|
|
|
|
/**
|
|
* 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[] = NewsletterMessagePeer::ID;
|
|
}
|
|
|
|
} // setId()
|
|
|
|
/**
|
|
* Set the value of [newsletter_draft_message_id] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setNewsletterDraftMessageId($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->newsletter_draft_message_id !== $v) {
|
|
$this->newsletter_draft_message_id = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::NEWSLETTER_DRAFT_MESSAGE_ID;
|
|
}
|
|
|
|
if ($this->aNewsletterDraftMessage !== null && $this->aNewsletterDraftMessage->getId() !== $v) {
|
|
$this->aNewsletterDraftMessage = null;
|
|
}
|
|
|
|
} // setNewsletterDraftMessageId()
|
|
|
|
/**
|
|
* Set the value of [opt_subject] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptSubject($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_subject !== $v) {
|
|
$this->opt_subject = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_SUBJECT;
|
|
}
|
|
|
|
} // setOptSubject()
|
|
|
|
/**
|
|
* Set the value of [opt_content] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptContent($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_content !== $v) {
|
|
$this->opt_content = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_CONTENT;
|
|
}
|
|
|
|
} // setOptContent()
|
|
|
|
/**
|
|
* Set the value of [main_image] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setMainImage($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->main_image !== $v) {
|
|
$this->main_image = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::MAIN_IMAGE;
|
|
}
|
|
|
|
} // setMainImage()
|
|
|
|
/**
|
|
* Set the value of [main_image_url] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setMainImageUrl($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->main_image_url !== $v) {
|
|
$this->main_image_url = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::MAIN_IMAGE_URL;
|
|
}
|
|
|
|
} // setMainImageUrl()
|
|
|
|
/**
|
|
* Set the value of [opt_cta_button_name] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptCtaButtonName($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_cta_button_name !== $v) {
|
|
$this->opt_cta_button_name = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_CTA_BUTTON_NAME;
|
|
}
|
|
|
|
} // setOptCtaButtonName()
|
|
|
|
/**
|
|
* Set the value of [cta_button_url] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setCtaButtonUrl($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->cta_button_url !== $v) {
|
|
$this->cta_button_url = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::CTA_BUTTON_URL;
|
|
}
|
|
|
|
} // setCtaButtonUrl()
|
|
|
|
/**
|
|
* Set the value of [cta_button_position] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setCtaButtonPosition($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->cta_button_position !== $v) {
|
|
$this->cta_button_position = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::CTA_BUTTON_POSITION;
|
|
}
|
|
|
|
} // setCtaButtonPosition()
|
|
|
|
/**
|
|
* Set the value of [opt_cta_description_head] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptCtaDescriptionHead($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_cta_description_head !== $v) {
|
|
$this->opt_cta_description_head = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_CTA_DESCRIPTION_HEAD;
|
|
}
|
|
|
|
} // setOptCtaDescriptionHead()
|
|
|
|
/**
|
|
* Set the value of [opt_cta_description_foot] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptCtaDescriptionFoot($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_cta_description_foot !== $v) {
|
|
$this->opt_cta_description_foot = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_CTA_DESCRIPTION_FOOT;
|
|
}
|
|
|
|
} // setOptCtaDescriptionFoot()
|
|
|
|
/**
|
|
* Set the value of [opt_products_name] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptProductsName($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_products_name !== $v) {
|
|
$this->opt_products_name = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_PRODUCTS_NAME;
|
|
}
|
|
|
|
} // setOptProductsName()
|
|
|
|
/**
|
|
* Set the value of [opt_recommends_name] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setOptRecommendsName($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->opt_recommends_name !== $v) {
|
|
$this->opt_recommends_name = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::OPT_RECOMMENDS_NAME;
|
|
}
|
|
|
|
} // setOptRecommendsName()
|
|
|
|
/**
|
|
* Set the value of [sent_at] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setSentAt($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 [sent_at] from input: " . var_export($v, true));
|
|
}
|
|
} else {
|
|
$ts = $v;
|
|
}
|
|
if ($this->sent_at !== $ts) {
|
|
$this->sent_at = $ts;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::SENT_AT;
|
|
}
|
|
|
|
} // setSentAt()
|
|
|
|
/**
|
|
* Set the value of [number_sent] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setNumberSent($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->number_sent !== $v) {
|
|
$this->number_sent = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::NUMBER_SENT;
|
|
}
|
|
|
|
} // setNumberSent()
|
|
|
|
/**
|
|
* Set the value of [number_sent_gmail] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setNumberSentGmail($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->number_sent_gmail !== $v) {
|
|
$this->number_sent_gmail = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::NUMBER_SENT_GMAIL;
|
|
}
|
|
|
|
} // setNumberSentGmail()
|
|
|
|
/**
|
|
* Set the value of [number_received] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setNumberReceived($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->number_received !== $v) {
|
|
$this->number_received = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::NUMBER_RECEIVED;
|
|
}
|
|
|
|
} // setNumberReceived()
|
|
|
|
/**
|
|
* Set the value of [number_read] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setNumberRead($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->number_read !== $v) {
|
|
$this->number_read = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::NUMBER_READ;
|
|
}
|
|
|
|
} // setNumberRead()
|
|
|
|
/**
|
|
* Set the value of [template_version] column.
|
|
*
|
|
* @param int $v new value
|
|
* @return void
|
|
*/
|
|
public function setTemplateVersion($v)
|
|
{
|
|
|
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
|
$v = (int) $v;
|
|
}
|
|
|
|
if ($this->template_version !== $v) {
|
|
$this->template_version = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::TEMPLATE_VERSION;
|
|
}
|
|
|
|
} // setTemplateVersion()
|
|
|
|
/**
|
|
* Set the value of [hash] column.
|
|
*
|
|
* @param string $v new value
|
|
* @return void
|
|
*/
|
|
public function setHash($v)
|
|
{
|
|
|
|
if ($v !== null && !is_string($v)) {
|
|
$v = (string) $v;
|
|
}
|
|
|
|
if ($this->hash !== $v) {
|
|
$this->hash = $v;
|
|
$this->modifiedColumns[] = NewsletterMessagePeer::HASH;
|
|
}
|
|
|
|
} // setHash()
|
|
|
|
/**
|
|
* 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('NewsletterMessage.preHydrate')) {
|
|
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.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->id = $rs->getInt($startcol + 2);
|
|
|
|
$this->newsletter_draft_message_id = $rs->getInt($startcol + 3);
|
|
|
|
$this->opt_subject = $rs->getString($startcol + 4);
|
|
|
|
$this->opt_content = $rs->getString($startcol + 5);
|
|
|
|
$this->main_image = $rs->getString($startcol + 6);
|
|
|
|
$this->main_image_url = $rs->getString($startcol + 7);
|
|
|
|
$this->opt_cta_button_name = $rs->getString($startcol + 8);
|
|
|
|
$this->cta_button_url = $rs->getString($startcol + 9);
|
|
|
|
$this->cta_button_position = $rs->getString($startcol + 10);
|
|
|
|
$this->opt_cta_description_head = $rs->getString($startcol + 11);
|
|
|
|
$this->opt_cta_description_foot = $rs->getString($startcol + 12);
|
|
|
|
$this->opt_products_name = $rs->getString($startcol + 13);
|
|
|
|
$this->opt_recommends_name = $rs->getString($startcol + 14);
|
|
|
|
$this->sent_at = $rs->getTimestamp($startcol + 15, null);
|
|
|
|
$this->number_sent = $rs->getInt($startcol + 16);
|
|
|
|
$this->number_sent_gmail = $rs->getInt($startcol + 17);
|
|
|
|
$this->number_received = $rs->getInt($startcol + 18);
|
|
|
|
$this->number_read = $rs->getInt($startcol + 19);
|
|
|
|
$this->template_version = $rs->getInt($startcol + 20);
|
|
|
|
$this->hash = $rs->getString($startcol + 21);
|
|
|
|
$this->resetModified();
|
|
|
|
$this->setNew(false);
|
|
if ($this->getDispatcher()->getListeners('NewsletterMessage.postHydrate')) {
|
|
$event = $this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 22)));
|
|
return $event['startcol'];
|
|
}
|
|
|
|
// FIXME - using NUM_COLUMNS may be clearer.
|
|
return $startcol + 22; // 22 = NewsletterMessagePeer::NUM_COLUMNS - NewsletterMessagePeer::NUM_LAZY_LOAD_COLUMNS).
|
|
|
|
} catch (Exception $e) {
|
|
throw new PropelException("Error populating NewsletterMessage 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('NewsletterMessage.preDelete')) {
|
|
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.preDelete', array('con' => $con)));
|
|
}
|
|
|
|
if (sfMixer::hasCallables('BaseNewsletterMessage:delete:pre'))
|
|
{
|
|
foreach (sfMixer::getCallables('BaseNewsletterMessage:delete:pre') as $callable)
|
|
{
|
|
$ret = call_user_func($callable, $this, $con);
|
|
if ($ret)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($con === null) {
|
|
$con = Propel::getConnection(NewsletterMessagePeer::DATABASE_NAME);
|
|
}
|
|
|
|
try {
|
|
$con->begin();
|
|
NewsletterMessagePeer::doDelete($this, $con);
|
|
$this->setDeleted(true);
|
|
$con->commit();
|
|
} catch (PropelException $e) {
|
|
$con->rollback();
|
|
throw $e;
|
|
}
|
|
|
|
if ($this->getDispatcher()->getListeners('NewsletterMessage.postDelete')) {
|
|
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.postDelete', array('con' => $con)));
|
|
}
|
|
|
|
if (sfMixer::hasCallables('BaseNewsletterMessage:delete:post'))
|
|
{
|
|
foreach (sfMixer::getCallables('BaseNewsletterMessage: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('NewsletterMessage.preSave')) {
|
|
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.preSave', array('con' => $con)));
|
|
}
|
|
|
|
foreach (sfMixer::getCallables('BaseNewsletterMessage:save:pre') as $callable)
|
|
{
|
|
$affectedRows = call_user_func($callable, $this, $con);
|
|
if (is_int($affectedRows))
|
|
{
|
|
return $affectedRows;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if ($this->isNew() && !$this->isColumnModified(NewsletterMessagePeer::CREATED_AT))
|
|
{
|
|
$this->setCreatedAt(time());
|
|
}
|
|
|
|
if ($this->isModified() && !$this->isColumnModified(NewsletterMessagePeer::UPDATED_AT))
|
|
{
|
|
$this->setUpdatedAt(time());
|
|
}
|
|
|
|
|
|
if ($con === null) {
|
|
$con = Propel::getConnection(NewsletterMessagePeer::DATABASE_NAME);
|
|
}
|
|
|
|
try {
|
|
$con->begin();
|
|
$affectedRows = $this->doSave($con);
|
|
$con->commit();
|
|
|
|
if (!$this->alreadyInSave) {
|
|
if ($this->getDispatcher()->getListeners('NewsletterMessage.postSave')) {
|
|
$this->getDispatcher()->notify(new sfEvent($this, 'NewsletterMessage.postSave', array('con' => $con)));
|
|
}
|
|
|
|
foreach (sfMixer::getCallables('BaseNewsletterMessage: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->aNewsletterDraftMessage !== null) {
|
|
if ($this->aNewsletterDraftMessage->isModified() || $this->aNewsletterDraftMessage->getCurrentNewsletterDraftMessageI18n()->isModified()) {
|
|
$affectedRows += $this->aNewsletterDraftMessage->save($con);
|
|
}
|
|
$this->setNewsletterDraftMessage($this->aNewsletterDraftMessage);
|
|
}
|
|
|
|
|
|
// If this object has been modified, then save it to the database.
|
|
if ($this->isModified()) {
|
|
if ($this->isNew()) {
|
|
$pk = NewsletterMessagePeer::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->setId($pk); //[IMV] update autoincrement primary key
|
|
|
|
$this->setNew(false);
|
|
} else {
|
|
$affectedRows += NewsletterMessagePeer::doUpdate($this, $con);
|
|
}
|
|
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasNewsletterGroups !== null) {
|
|
foreach($this->collNewsletterMessageHasNewsletterGroups as $referrerFK) {
|
|
if (!$referrerFK->isDeleted()) {
|
|
$affectedRows += $referrerFK->save($con);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasProducts !== null) {
|
|
foreach($this->collNewsletterMessageHasProducts as $referrerFK) {
|
|
if (!$referrerFK->isDeleted()) {
|
|
$affectedRows += $referrerFK->save($con);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasBlogs !== null) {
|
|
foreach($this->collNewsletterMessageHasBlogs as $referrerFK) {
|
|
if (!$referrerFK->isDeleted()) {
|
|
$affectedRows += $referrerFK->save($con);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageI18ns !== null) {
|
|
foreach($this->collNewsletterMessageI18ns as $referrerFK) {
|
|
if (!$referrerFK->isDeleted()) {
|
|
$affectedRows += $referrerFK->save($con);
|
|
}
|
|
}
|
|
}
|
|
|
|
$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->aNewsletterDraftMessage !== null) {
|
|
if (!$this->aNewsletterDraftMessage->validate($columns)) {
|
|
$failureMap = array_merge($failureMap, $this->aNewsletterDraftMessage->getValidationFailures());
|
|
}
|
|
}
|
|
|
|
|
|
if (($retval = NewsletterMessagePeer::doValidate($this, $columns)) !== true) {
|
|
$failureMap = array_merge($failureMap, $retval);
|
|
}
|
|
|
|
|
|
if ($this->collNewsletterMessageHasNewsletterGroups !== null) {
|
|
foreach($this->collNewsletterMessageHasNewsletterGroups as $referrerFK) {
|
|
if (!$referrerFK->validate($columns)) {
|
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasProducts !== null) {
|
|
foreach($this->collNewsletterMessageHasProducts as $referrerFK) {
|
|
if (!$referrerFK->validate($columns)) {
|
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasBlogs !== null) {
|
|
foreach($this->collNewsletterMessageHasBlogs as $referrerFK) {
|
|
if (!$referrerFK->validate($columns)) {
|
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($this->collNewsletterMessageI18ns !== null) {
|
|
foreach($this->collNewsletterMessageI18ns as $referrerFK) {
|
|
if (!$referrerFK->validate($columns)) {
|
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
$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 = NewsletterMessagePeer::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->getId();
|
|
break;
|
|
case 3:
|
|
return $this->getNewsletterDraftMessageId();
|
|
break;
|
|
case 4:
|
|
return $this->getOptSubject();
|
|
break;
|
|
case 5:
|
|
return $this->getOptContent();
|
|
break;
|
|
case 6:
|
|
return $this->getMainImage();
|
|
break;
|
|
case 7:
|
|
return $this->getMainImageUrl();
|
|
break;
|
|
case 8:
|
|
return $this->getOptCtaButtonName();
|
|
break;
|
|
case 9:
|
|
return $this->getCtaButtonUrl();
|
|
break;
|
|
case 10:
|
|
return $this->getCtaButtonPosition();
|
|
break;
|
|
case 11:
|
|
return $this->getOptCtaDescriptionHead();
|
|
break;
|
|
case 12:
|
|
return $this->getOptCtaDescriptionFoot();
|
|
break;
|
|
case 13:
|
|
return $this->getOptProductsName();
|
|
break;
|
|
case 14:
|
|
return $this->getOptRecommendsName();
|
|
break;
|
|
case 15:
|
|
return $this->getSentAt();
|
|
break;
|
|
case 16:
|
|
return $this->getNumberSent();
|
|
break;
|
|
case 17:
|
|
return $this->getNumberSentGmail();
|
|
break;
|
|
case 18:
|
|
return $this->getNumberReceived();
|
|
break;
|
|
case 19:
|
|
return $this->getNumberRead();
|
|
break;
|
|
case 20:
|
|
return $this->getTemplateVersion();
|
|
break;
|
|
case 21:
|
|
return $this->getHash();
|
|
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 = NewsletterMessagePeer::getFieldNames($keyType);
|
|
$result = array(
|
|
$keys[0] => $this->getCreatedAt(),
|
|
$keys[1] => $this->getUpdatedAt(),
|
|
$keys[2] => $this->getId(),
|
|
$keys[3] => $this->getNewsletterDraftMessageId(),
|
|
$keys[4] => $this->getOptSubject(),
|
|
$keys[5] => $this->getOptContent(),
|
|
$keys[6] => $this->getMainImage(),
|
|
$keys[7] => $this->getMainImageUrl(),
|
|
$keys[8] => $this->getOptCtaButtonName(),
|
|
$keys[9] => $this->getCtaButtonUrl(),
|
|
$keys[10] => $this->getCtaButtonPosition(),
|
|
$keys[11] => $this->getOptCtaDescriptionHead(),
|
|
$keys[12] => $this->getOptCtaDescriptionFoot(),
|
|
$keys[13] => $this->getOptProductsName(),
|
|
$keys[14] => $this->getOptRecommendsName(),
|
|
$keys[15] => $this->getSentAt(),
|
|
$keys[16] => $this->getNumberSent(),
|
|
$keys[17] => $this->getNumberSentGmail(),
|
|
$keys[18] => $this->getNumberReceived(),
|
|
$keys[19] => $this->getNumberRead(),
|
|
$keys[20] => $this->getTemplateVersion(),
|
|
$keys[21] => $this->getHash(),
|
|
);
|
|
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 = NewsletterMessagePeer::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->setId($value);
|
|
break;
|
|
case 3:
|
|
$this->setNewsletterDraftMessageId($value);
|
|
break;
|
|
case 4:
|
|
$this->setOptSubject($value);
|
|
break;
|
|
case 5:
|
|
$this->setOptContent($value);
|
|
break;
|
|
case 6:
|
|
$this->setMainImage($value);
|
|
break;
|
|
case 7:
|
|
$this->setMainImageUrl($value);
|
|
break;
|
|
case 8:
|
|
$this->setOptCtaButtonName($value);
|
|
break;
|
|
case 9:
|
|
$this->setCtaButtonUrl($value);
|
|
break;
|
|
case 10:
|
|
$this->setCtaButtonPosition($value);
|
|
break;
|
|
case 11:
|
|
$this->setOptCtaDescriptionHead($value);
|
|
break;
|
|
case 12:
|
|
$this->setOptCtaDescriptionFoot($value);
|
|
break;
|
|
case 13:
|
|
$this->setOptProductsName($value);
|
|
break;
|
|
case 14:
|
|
$this->setOptRecommendsName($value);
|
|
break;
|
|
case 15:
|
|
$this->setSentAt($value);
|
|
break;
|
|
case 16:
|
|
$this->setNumberSent($value);
|
|
break;
|
|
case 17:
|
|
$this->setNumberSentGmail($value);
|
|
break;
|
|
case 18:
|
|
$this->setNumberReceived($value);
|
|
break;
|
|
case 19:
|
|
$this->setNumberRead($value);
|
|
break;
|
|
case 20:
|
|
$this->setTemplateVersion($value);
|
|
break;
|
|
case 21:
|
|
$this->setHash($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 = NewsletterMessagePeer::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->setId($arr[$keys[2]]);
|
|
if (array_key_exists($keys[3], $arr)) $this->setNewsletterDraftMessageId($arr[$keys[3]]);
|
|
if (array_key_exists($keys[4], $arr)) $this->setOptSubject($arr[$keys[4]]);
|
|
if (array_key_exists($keys[5], $arr)) $this->setOptContent($arr[$keys[5]]);
|
|
if (array_key_exists($keys[6], $arr)) $this->setMainImage($arr[$keys[6]]);
|
|
if (array_key_exists($keys[7], $arr)) $this->setMainImageUrl($arr[$keys[7]]);
|
|
if (array_key_exists($keys[8], $arr)) $this->setOptCtaButtonName($arr[$keys[8]]);
|
|
if (array_key_exists($keys[9], $arr)) $this->setCtaButtonUrl($arr[$keys[9]]);
|
|
if (array_key_exists($keys[10], $arr)) $this->setCtaButtonPosition($arr[$keys[10]]);
|
|
if (array_key_exists($keys[11], $arr)) $this->setOptCtaDescriptionHead($arr[$keys[11]]);
|
|
if (array_key_exists($keys[12], $arr)) $this->setOptCtaDescriptionFoot($arr[$keys[12]]);
|
|
if (array_key_exists($keys[13], $arr)) $this->setOptProductsName($arr[$keys[13]]);
|
|
if (array_key_exists($keys[14], $arr)) $this->setOptRecommendsName($arr[$keys[14]]);
|
|
if (array_key_exists($keys[15], $arr)) $this->setSentAt($arr[$keys[15]]);
|
|
if (array_key_exists($keys[16], $arr)) $this->setNumberSent($arr[$keys[16]]);
|
|
if (array_key_exists($keys[17], $arr)) $this->setNumberSentGmail($arr[$keys[17]]);
|
|
if (array_key_exists($keys[18], $arr)) $this->setNumberReceived($arr[$keys[18]]);
|
|
if (array_key_exists($keys[19], $arr)) $this->setNumberRead($arr[$keys[19]]);
|
|
if (array_key_exists($keys[20], $arr)) $this->setTemplateVersion($arr[$keys[20]]);
|
|
if (array_key_exists($keys[21], $arr)) $this->setHash($arr[$keys[21]]);
|
|
}
|
|
|
|
/**
|
|
* 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(NewsletterMessagePeer::DATABASE_NAME);
|
|
|
|
if ($this->isColumnModified(NewsletterMessagePeer::CREATED_AT)) $criteria->add(NewsletterMessagePeer::CREATED_AT, $this->created_at);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::UPDATED_AT)) $criteria->add(NewsletterMessagePeer::UPDATED_AT, $this->updated_at);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::ID)) $criteria->add(NewsletterMessagePeer::ID, $this->id);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::NEWSLETTER_DRAFT_MESSAGE_ID)) $criteria->add(NewsletterMessagePeer::NEWSLETTER_DRAFT_MESSAGE_ID, $this->newsletter_draft_message_id);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_SUBJECT)) $criteria->add(NewsletterMessagePeer::OPT_SUBJECT, $this->opt_subject);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_CONTENT)) $criteria->add(NewsletterMessagePeer::OPT_CONTENT, $this->opt_content);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::MAIN_IMAGE)) $criteria->add(NewsletterMessagePeer::MAIN_IMAGE, $this->main_image);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::MAIN_IMAGE_URL)) $criteria->add(NewsletterMessagePeer::MAIN_IMAGE_URL, $this->main_image_url);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_CTA_BUTTON_NAME)) $criteria->add(NewsletterMessagePeer::OPT_CTA_BUTTON_NAME, $this->opt_cta_button_name);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::CTA_BUTTON_URL)) $criteria->add(NewsletterMessagePeer::CTA_BUTTON_URL, $this->cta_button_url);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::CTA_BUTTON_POSITION)) $criteria->add(NewsletterMessagePeer::CTA_BUTTON_POSITION, $this->cta_button_position);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_CTA_DESCRIPTION_HEAD)) $criteria->add(NewsletterMessagePeer::OPT_CTA_DESCRIPTION_HEAD, $this->opt_cta_description_head);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_CTA_DESCRIPTION_FOOT)) $criteria->add(NewsletterMessagePeer::OPT_CTA_DESCRIPTION_FOOT, $this->opt_cta_description_foot);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_PRODUCTS_NAME)) $criteria->add(NewsletterMessagePeer::OPT_PRODUCTS_NAME, $this->opt_products_name);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::OPT_RECOMMENDS_NAME)) $criteria->add(NewsletterMessagePeer::OPT_RECOMMENDS_NAME, $this->opt_recommends_name);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::SENT_AT)) $criteria->add(NewsletterMessagePeer::SENT_AT, $this->sent_at);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::NUMBER_SENT)) $criteria->add(NewsletterMessagePeer::NUMBER_SENT, $this->number_sent);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::NUMBER_SENT_GMAIL)) $criteria->add(NewsletterMessagePeer::NUMBER_SENT_GMAIL, $this->number_sent_gmail);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::NUMBER_RECEIVED)) $criteria->add(NewsletterMessagePeer::NUMBER_RECEIVED, $this->number_received);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::NUMBER_READ)) $criteria->add(NewsletterMessagePeer::NUMBER_READ, $this->number_read);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::TEMPLATE_VERSION)) $criteria->add(NewsletterMessagePeer::TEMPLATE_VERSION, $this->template_version);
|
|
if ($this->isColumnModified(NewsletterMessagePeer::HASH)) $criteria->add(NewsletterMessagePeer::HASH, $this->hash);
|
|
|
|
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(NewsletterMessagePeer::DATABASE_NAME);
|
|
|
|
$criteria->add(NewsletterMessagePeer::ID, $this->id);
|
|
|
|
return $criteria;
|
|
}
|
|
|
|
/**
|
|
* Returns the primary key for this object (row).
|
|
* @return int
|
|
*/
|
|
public function getPrimaryKey()
|
|
{
|
|
return $this->getId();
|
|
}
|
|
|
|
/**
|
|
* Returns [composite] primary key fields
|
|
*
|
|
* @param string $keyType
|
|
* @return array
|
|
*/
|
|
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
|
|
{
|
|
return array(NewsletterMessagePeer::translateFieldName('id', BasePeer::TYPE_FIELDNAME, $keyType));
|
|
}
|
|
|
|
/**
|
|
* Generic method to set the primary key (id column).
|
|
*
|
|
* @param int $key Primary key.
|
|
* @return void
|
|
*/
|
|
public function setPrimaryKey($key)
|
|
{
|
|
$this->setId($key);
|
|
}
|
|
|
|
/**
|
|
* 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 NewsletterMessage (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->setNewsletterDraftMessageId($this->newsletter_draft_message_id);
|
|
|
|
$copyObj->setOptSubject($this->opt_subject);
|
|
|
|
$copyObj->setOptContent($this->opt_content);
|
|
|
|
$copyObj->setMainImage($this->main_image);
|
|
|
|
$copyObj->setMainImageUrl($this->main_image_url);
|
|
|
|
$copyObj->setOptCtaButtonName($this->opt_cta_button_name);
|
|
|
|
$copyObj->setCtaButtonUrl($this->cta_button_url);
|
|
|
|
$copyObj->setCtaButtonPosition($this->cta_button_position);
|
|
|
|
$copyObj->setOptCtaDescriptionHead($this->opt_cta_description_head);
|
|
|
|
$copyObj->setOptCtaDescriptionFoot($this->opt_cta_description_foot);
|
|
|
|
$copyObj->setOptProductsName($this->opt_products_name);
|
|
|
|
$copyObj->setOptRecommendsName($this->opt_recommends_name);
|
|
|
|
$copyObj->setSentAt($this->sent_at);
|
|
|
|
$copyObj->setNumberSent($this->number_sent);
|
|
|
|
$copyObj->setNumberSentGmail($this->number_sent_gmail);
|
|
|
|
$copyObj->setNumberReceived($this->number_received);
|
|
|
|
$copyObj->setNumberRead($this->number_read);
|
|
|
|
$copyObj->setTemplateVersion($this->template_version);
|
|
|
|
$copyObj->setHash($this->hash);
|
|
|
|
|
|
if ($deepCopy) {
|
|
// important: temporarily setNew(false) because this affects the behavior of
|
|
// the getter/setter methods for fkey referrer objects.
|
|
$copyObj->setNew(false);
|
|
|
|
foreach($this->getNewsletterMessageHasNewsletterGroups() as $relObj) {
|
|
$copyObj->addNewsletterMessageHasNewsletterGroup($relObj->copy($deepCopy));
|
|
}
|
|
|
|
foreach($this->getNewsletterMessageHasProducts() as $relObj) {
|
|
$copyObj->addNewsletterMessageHasProduct($relObj->copy($deepCopy));
|
|
}
|
|
|
|
foreach($this->getNewsletterMessageHasBlogs() as $relObj) {
|
|
$copyObj->addNewsletterMessageHasBlog($relObj->copy($deepCopy));
|
|
}
|
|
|
|
foreach($this->getNewsletterMessageI18ns() as $relObj) {
|
|
$copyObj->addNewsletterMessageI18n($relObj->copy($deepCopy));
|
|
}
|
|
|
|
} // if ($deepCopy)
|
|
|
|
|
|
$copyObj->setNew(true);
|
|
|
|
$copyObj->setId(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 NewsletterMessage 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 'NewsletterMessagePeer';
|
|
}
|
|
|
|
/**
|
|
* Declares an association between this object and a NewsletterDraftMessage object.
|
|
*
|
|
* @param NewsletterDraftMessage $v
|
|
* @return void
|
|
* @throws PropelException
|
|
*/
|
|
public function setNewsletterDraftMessage($v)
|
|
{
|
|
|
|
|
|
if ($v === null) {
|
|
$this->setNewsletterDraftMessageId(NULL);
|
|
} else {
|
|
$this->setNewsletterDraftMessageId($v->getId());
|
|
}
|
|
|
|
|
|
$this->aNewsletterDraftMessage = $v;
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the associated NewsletterDraftMessage object
|
|
*
|
|
* @param Connection Optional Connection object.
|
|
* @return NewsletterDraftMessage The associated NewsletterDraftMessage object.
|
|
* @throws PropelException
|
|
*/
|
|
public function getNewsletterDraftMessage($con = null)
|
|
{
|
|
if ($this->aNewsletterDraftMessage === null && ($this->newsletter_draft_message_id !== null)) {
|
|
// include the related Peer class
|
|
$this->aNewsletterDraftMessage = NewsletterDraftMessagePeer::retrieveByPK($this->newsletter_draft_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 = NewsletterDraftMessagePeer::retrieveByPK($this->newsletter_draft_message_id, $con);
|
|
$obj->addNewsletterDraftMessages($this);
|
|
*/
|
|
}
|
|
return $this->aNewsletterDraftMessage;
|
|
}
|
|
|
|
/**
|
|
* Temporary storage of collNewsletterMessageHasNewsletterGroups to save a possible db hit in
|
|
* the event objects are add to the collection, but the
|
|
* complete collection is never requested.
|
|
* @return void
|
|
*/
|
|
public function initNewsletterMessageHasNewsletterGroups()
|
|
{
|
|
if ($this->collNewsletterMessageHasNewsletterGroups === null) {
|
|
$this->collNewsletterMessageHasNewsletterGroups = array();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasNewsletterGroups from storage.
|
|
* If this NewsletterMessage is new, it will return
|
|
* an empty collection or the current collection, the criteria
|
|
* is ignored on a new object.
|
|
*
|
|
* @param Connection $con
|
|
* @param Criteria $criteria
|
|
* @return NewsletterMessageHasNewsletterGroup[]
|
|
* @throws PropelException
|
|
*/
|
|
public function getNewsletterMessageHasNewsletterGroups($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasNewsletterGroups === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasNewsletterGroups = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasNewsletterGroupPeer::addSelectColumns($criteria);
|
|
$this->collNewsletterMessageHasNewsletterGroups = NewsletterMessageHasNewsletterGroupPeer::doSelect($criteria, $con);
|
|
}
|
|
} else {
|
|
// criteria has no effect for a new object
|
|
if (!$this->isNew()) {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
|
|
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasNewsletterGroupPeer::addSelectColumns($criteria);
|
|
if (!isset($this->lastNewsletterMessageHasNewsletterGroupCriteria) || !$this->lastNewsletterMessageHasNewsletterGroupCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasNewsletterGroups = NewsletterMessageHasNewsletterGroupPeer::doSelect($criteria, $con);
|
|
}
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasNewsletterGroupCriteria = $criteria;
|
|
return $this->collNewsletterMessageHasNewsletterGroups;
|
|
}
|
|
|
|
/**
|
|
* Returns the number of related NewsletterMessageHasNewsletterGroups.
|
|
*
|
|
* @param Criteria $criteria
|
|
* @param boolean $distinct
|
|
* @param Connection $con
|
|
* @throws PropelException
|
|
*/
|
|
public function countNewsletterMessageHasNewsletterGroups($criteria = null, $distinct = false, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
return NewsletterMessageHasNewsletterGroupPeer::doCount($criteria, $distinct, $con);
|
|
}
|
|
|
|
/**
|
|
* Method called to associate a NewsletterMessageHasNewsletterGroup object to this object
|
|
* through the NewsletterMessageHasNewsletterGroup foreign key attribute
|
|
*
|
|
* @param NewsletterMessageHasNewsletterGroup $l NewsletterMessageHasNewsletterGroup
|
|
* @return void
|
|
* @throws PropelException
|
|
*/
|
|
public function addNewsletterMessageHasNewsletterGroup(NewsletterMessageHasNewsletterGroup $l)
|
|
{
|
|
$this->collNewsletterMessageHasNewsletterGroups[] = $l;
|
|
$l->setNewsletterMessage($this);
|
|
}
|
|
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage is new, it will return
|
|
* an empty collection; or if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasNewsletterGroups from storage.
|
|
*
|
|
* This method is protected by default in order to keep the public
|
|
* api reasonable. You can provide public methods for those you
|
|
* actually need in NewsletterMessage.
|
|
*
|
|
* @return NewsletterMessageHasNewsletterGroup[]
|
|
*/
|
|
public function getNewsletterMessageHasNewsletterGroupsJoinNewsletterGroup($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasNewsletterGroups === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasNewsletterGroups = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
$this->collNewsletterMessageHasNewsletterGroups = NewsletterMessageHasNewsletterGroupPeer::doSelectJoinNewsletterGroup($criteria, $con);
|
|
}
|
|
} else {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
$criteria->add(NewsletterMessageHasNewsletterGroupPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
if (!isset($this->lastNewsletterMessageHasNewsletterGroupCriteria) || !$this->lastNewsletterMessageHasNewsletterGroupCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasNewsletterGroups = NewsletterMessageHasNewsletterGroupPeer::doSelectJoinNewsletterGroup($criteria, $con);
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasNewsletterGroupCriteria = $criteria;
|
|
|
|
return $this->collNewsletterMessageHasNewsletterGroups;
|
|
}
|
|
|
|
/**
|
|
* Temporary storage of collNewsletterMessageHasProducts to save a possible db hit in
|
|
* the event objects are add to the collection, but the
|
|
* complete collection is never requested.
|
|
* @return void
|
|
*/
|
|
public function initNewsletterMessageHasProducts()
|
|
{
|
|
if ($this->collNewsletterMessageHasProducts === null) {
|
|
$this->collNewsletterMessageHasProducts = array();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasProducts from storage.
|
|
* If this NewsletterMessage is new, it will return
|
|
* an empty collection or the current collection, the criteria
|
|
* is ignored on a new object.
|
|
*
|
|
* @param Connection $con
|
|
* @param Criteria $criteria
|
|
* @return NewsletterMessageHasProduct[]
|
|
* @throws PropelException
|
|
*/
|
|
public function getNewsletterMessageHasProducts($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasProducts === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasProducts = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasProductPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasProductPeer::addSelectColumns($criteria);
|
|
$this->collNewsletterMessageHasProducts = NewsletterMessageHasProductPeer::doSelect($criteria, $con);
|
|
}
|
|
} else {
|
|
// criteria has no effect for a new object
|
|
if (!$this->isNew()) {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
|
|
$criteria->add(NewsletterMessageHasProductPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasProductPeer::addSelectColumns($criteria);
|
|
if (!isset($this->lastNewsletterMessageHasProductCriteria) || !$this->lastNewsletterMessageHasProductCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasProducts = NewsletterMessageHasProductPeer::doSelect($criteria, $con);
|
|
}
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasProductCriteria = $criteria;
|
|
return $this->collNewsletterMessageHasProducts;
|
|
}
|
|
|
|
/**
|
|
* Returns the number of related NewsletterMessageHasProducts.
|
|
*
|
|
* @param Criteria $criteria
|
|
* @param boolean $distinct
|
|
* @param Connection $con
|
|
* @throws PropelException
|
|
*/
|
|
public function countNewsletterMessageHasProducts($criteria = null, $distinct = false, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
$criteria->add(NewsletterMessageHasProductPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
return NewsletterMessageHasProductPeer::doCount($criteria, $distinct, $con);
|
|
}
|
|
|
|
/**
|
|
* Method called to associate a NewsletterMessageHasProduct object to this object
|
|
* through the NewsletterMessageHasProduct foreign key attribute
|
|
*
|
|
* @param NewsletterMessageHasProduct $l NewsletterMessageHasProduct
|
|
* @return void
|
|
* @throws PropelException
|
|
*/
|
|
public function addNewsletterMessageHasProduct(NewsletterMessageHasProduct $l)
|
|
{
|
|
$this->collNewsletterMessageHasProducts[] = $l;
|
|
$l->setNewsletterMessage($this);
|
|
}
|
|
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage is new, it will return
|
|
* an empty collection; or if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasProducts from storage.
|
|
*
|
|
* This method is protected by default in order to keep the public
|
|
* api reasonable. You can provide public methods for those you
|
|
* actually need in NewsletterMessage.
|
|
*
|
|
* @return NewsletterMessageHasProduct[]
|
|
*/
|
|
public function getNewsletterMessageHasProductsJoinProduct($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasProducts === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasProducts = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasProductPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
$this->collNewsletterMessageHasProducts = NewsletterMessageHasProductPeer::doSelectJoinProduct($criteria, $con);
|
|
}
|
|
} else {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
$criteria->add(NewsletterMessageHasProductPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
if (!isset($this->lastNewsletterMessageHasProductCriteria) || !$this->lastNewsletterMessageHasProductCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasProducts = NewsletterMessageHasProductPeer::doSelectJoinProduct($criteria, $con);
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasProductCriteria = $criteria;
|
|
|
|
return $this->collNewsletterMessageHasProducts;
|
|
}
|
|
|
|
/**
|
|
* Temporary storage of collNewsletterMessageHasBlogs to save a possible db hit in
|
|
* the event objects are add to the collection, but the
|
|
* complete collection is never requested.
|
|
* @return void
|
|
*/
|
|
public function initNewsletterMessageHasBlogs()
|
|
{
|
|
if ($this->collNewsletterMessageHasBlogs === null) {
|
|
$this->collNewsletterMessageHasBlogs = array();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasBlogs from storage.
|
|
* If this NewsletterMessage is new, it will return
|
|
* an empty collection or the current collection, the criteria
|
|
* is ignored on a new object.
|
|
*
|
|
* @param Connection $con
|
|
* @param Criteria $criteria
|
|
* @return NewsletterMessageHasBlog[]
|
|
* @throws PropelException
|
|
*/
|
|
public function getNewsletterMessageHasBlogs($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasBlogs === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasBlogs = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasBlogPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasBlogPeer::addSelectColumns($criteria);
|
|
$this->collNewsletterMessageHasBlogs = NewsletterMessageHasBlogPeer::doSelect($criteria, $con);
|
|
}
|
|
} else {
|
|
// criteria has no effect for a new object
|
|
if (!$this->isNew()) {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
|
|
$criteria->add(NewsletterMessageHasBlogPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
NewsletterMessageHasBlogPeer::addSelectColumns($criteria);
|
|
if (!isset($this->lastNewsletterMessageHasBlogCriteria) || !$this->lastNewsletterMessageHasBlogCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasBlogs = NewsletterMessageHasBlogPeer::doSelect($criteria, $con);
|
|
}
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasBlogCriteria = $criteria;
|
|
return $this->collNewsletterMessageHasBlogs;
|
|
}
|
|
|
|
/**
|
|
* Returns the number of related NewsletterMessageHasBlogs.
|
|
*
|
|
* @param Criteria $criteria
|
|
* @param boolean $distinct
|
|
* @param Connection $con
|
|
* @throws PropelException
|
|
*/
|
|
public function countNewsletterMessageHasBlogs($criteria = null, $distinct = false, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
$criteria->add(NewsletterMessageHasBlogPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
return NewsletterMessageHasBlogPeer::doCount($criteria, $distinct, $con);
|
|
}
|
|
|
|
/**
|
|
* Method called to associate a NewsletterMessageHasBlog object to this object
|
|
* through the NewsletterMessageHasBlog foreign key attribute
|
|
*
|
|
* @param NewsletterMessageHasBlog $l NewsletterMessageHasBlog
|
|
* @return void
|
|
* @throws PropelException
|
|
*/
|
|
public function addNewsletterMessageHasBlog(NewsletterMessageHasBlog $l)
|
|
{
|
|
$this->collNewsletterMessageHasBlogs[] = $l;
|
|
$l->setNewsletterMessage($this);
|
|
}
|
|
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage is new, it will return
|
|
* an empty collection; or if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageHasBlogs from storage.
|
|
*
|
|
* This method is protected by default in order to keep the public
|
|
* api reasonable. You can provide public methods for those you
|
|
* actually need in NewsletterMessage.
|
|
*
|
|
* @return NewsletterMessageHasBlog[]
|
|
*/
|
|
public function getNewsletterMessageHasBlogsJoinBlog($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageHasBlogs === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageHasBlogs = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageHasBlogPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
$this->collNewsletterMessageHasBlogs = NewsletterMessageHasBlogPeer::doSelectJoinBlog($criteria, $con);
|
|
}
|
|
} else {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
$criteria->add(NewsletterMessageHasBlogPeer::NEWSLETTER_MESSAGE_ID, $this->getId());
|
|
|
|
if (!isset($this->lastNewsletterMessageHasBlogCriteria) || !$this->lastNewsletterMessageHasBlogCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageHasBlogs = NewsletterMessageHasBlogPeer::doSelectJoinBlog($criteria, $con);
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageHasBlogCriteria = $criteria;
|
|
|
|
return $this->collNewsletterMessageHasBlogs;
|
|
}
|
|
|
|
/**
|
|
* Temporary storage of collNewsletterMessageI18ns to save a possible db hit in
|
|
* the event objects are add to the collection, but the
|
|
* complete collection is never requested.
|
|
* @return void
|
|
*/
|
|
public function initNewsletterMessageI18ns()
|
|
{
|
|
if ($this->collNewsletterMessageI18ns === null) {
|
|
$this->collNewsletterMessageI18ns = array();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* If this collection has already been initialized with
|
|
* an identical criteria, it returns the collection.
|
|
* Otherwise if this NewsletterMessage has previously
|
|
* been saved, it will retrieve related NewsletterMessageI18ns from storage.
|
|
* If this NewsletterMessage is new, it will return
|
|
* an empty collection or the current collection, the criteria
|
|
* is ignored on a new object.
|
|
*
|
|
* @param Connection $con
|
|
* @param Criteria $criteria
|
|
* @return NewsletterMessageI18n[]
|
|
* @throws PropelException
|
|
*/
|
|
public function getNewsletterMessageI18ns($criteria = null, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
if ($this->collNewsletterMessageI18ns === null) {
|
|
if ($this->isNew()) {
|
|
$this->collNewsletterMessageI18ns = array();
|
|
} else {
|
|
|
|
$criteria->add(NewsletterMessageI18nPeer::ID, $this->getId());
|
|
|
|
NewsletterMessageI18nPeer::addSelectColumns($criteria);
|
|
$this->collNewsletterMessageI18ns = NewsletterMessageI18nPeer::doSelect($criteria, $con);
|
|
}
|
|
} else {
|
|
// criteria has no effect for a new object
|
|
if (!$this->isNew()) {
|
|
// the following code is to determine if a new query is
|
|
// called for. If the criteria is the same as the last
|
|
// one, just return the collection.
|
|
|
|
|
|
$criteria->add(NewsletterMessageI18nPeer::ID, $this->getId());
|
|
|
|
NewsletterMessageI18nPeer::addSelectColumns($criteria);
|
|
if (!isset($this->lastNewsletterMessageI18nCriteria) || !$this->lastNewsletterMessageI18nCriteria->equals($criteria)) {
|
|
$this->collNewsletterMessageI18ns = NewsletterMessageI18nPeer::doSelect($criteria, $con);
|
|
}
|
|
}
|
|
}
|
|
$this->lastNewsletterMessageI18nCriteria = $criteria;
|
|
return $this->collNewsletterMessageI18ns;
|
|
}
|
|
|
|
/**
|
|
* Returns the number of related NewsletterMessageI18ns.
|
|
*
|
|
* @param Criteria $criteria
|
|
* @param boolean $distinct
|
|
* @param Connection $con
|
|
* @throws PropelException
|
|
*/
|
|
public function countNewsletterMessageI18ns($criteria = null, $distinct = false, $con = null)
|
|
{
|
|
// include the Peer class
|
|
if ($criteria === null) {
|
|
$criteria = new Criteria();
|
|
}
|
|
elseif ($criteria instanceof Criteria)
|
|
{
|
|
$criteria = clone $criteria;
|
|
}
|
|
|
|
$criteria->add(NewsletterMessageI18nPeer::ID, $this->getId());
|
|
|
|
return NewsletterMessageI18nPeer::doCount($criteria, $distinct, $con);
|
|
}
|
|
|
|
/**
|
|
* Method called to associate a NewsletterMessageI18n object to this object
|
|
* through the NewsletterMessageI18n foreign key attribute
|
|
*
|
|
* @param NewsletterMessageI18n $l NewsletterMessageI18n
|
|
* @return void
|
|
* @throws PropelException
|
|
*/
|
|
public function addNewsletterMessageI18n(NewsletterMessageI18n $l)
|
|
{
|
|
$this->collNewsletterMessageI18ns[] = $l;
|
|
$l->setNewsletterMessage($this);
|
|
}
|
|
|
|
public function getCulture()
|
|
{
|
|
return $this->culture;
|
|
}
|
|
|
|
public function setCulture($culture)
|
|
{
|
|
$this->culture = $culture;
|
|
}
|
|
|
|
public function getSubject()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getSubject() : null);
|
|
}
|
|
|
|
public function setSubject($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setSubject($value);
|
|
}
|
|
|
|
public function getContent()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getContent() : null);
|
|
}
|
|
|
|
public function setContent($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setContent($value);
|
|
}
|
|
|
|
public function getCtaDescriptionHead()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getCtaDescriptionHead() : null);
|
|
}
|
|
|
|
public function setCtaDescriptionHead($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setCtaDescriptionHead($value);
|
|
}
|
|
|
|
public function getCtaDescriptionFoot()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getCtaDescriptionFoot() : null);
|
|
}
|
|
|
|
public function setCtaDescriptionFoot($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setCtaDescriptionFoot($value);
|
|
}
|
|
|
|
public function getCtaButtonName()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getCtaButtonName() : null);
|
|
}
|
|
|
|
public function setCtaButtonName($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setCtaButtonName($value);
|
|
}
|
|
|
|
public function getProductsName()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getProductsName() : null);
|
|
}
|
|
|
|
public function setProductsName($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setProductsName($value);
|
|
}
|
|
|
|
public function getRecommendsName()
|
|
{
|
|
$obj = $this->getCurrentNewsletterMessageI18n();
|
|
|
|
return ($obj ? $obj->getRecommendsName() : null);
|
|
}
|
|
|
|
public function setRecommendsName($value)
|
|
{
|
|
$this->getCurrentNewsletterMessageI18n()->setRecommendsName($value);
|
|
}
|
|
|
|
public $current_i18n = array();
|
|
|
|
public function getCurrentNewsletterMessageI18n()
|
|
{
|
|
if (!isset($this->current_i18n[$this->culture]))
|
|
{
|
|
$obj = NewsletterMessageI18nPeer::retrieveByPK($this->getId(), $this->culture);
|
|
if ($obj)
|
|
{
|
|
$this->setNewsletterMessageI18nForCulture($obj, $this->culture);
|
|
}
|
|
else
|
|
{
|
|
$this->setNewsletterMessageI18nForCulture(new NewsletterMessageI18n(), $this->culture);
|
|
$this->current_i18n[$this->culture]->setCulture($this->culture);
|
|
}
|
|
}
|
|
|
|
return $this->current_i18n[$this->culture];
|
|
}
|
|
|
|
public function setNewsletterMessageI18nForCulture($object, $culture)
|
|
{
|
|
$this->current_i18n[$culture] = $object;
|
|
$this->addNewsletterMessageI18n($object);
|
|
}
|
|
|
|
|
|
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, 'NewsletterMessage.' . $method, array('arguments' => $arguments, 'method' => $method)));
|
|
|
|
if ($event->isProcessed())
|
|
{
|
|
return $event->getReturnValue();
|
|
}
|
|
|
|
if (!$callable = sfMixer::getCallable('BaseNewsletterMessage:'.$method))
|
|
{
|
|
throw new sfException(sprintf('Call to undefined method BaseNewsletterMessage::%s', $method));
|
|
}
|
|
|
|
array_unshift($arguments, $this);
|
|
|
|
return call_user_func_array($callable, $arguments);
|
|
}
|
|
|
|
} // BaseNewsletterMessage
|