/** * @return Bronto_Api_Segment_Row */ public function read() { if ($this->id) { $params = array('id' => $this->id); } elseif ($this->name) { $params = array('name' => array('value' => $this->name, 'operator' => 'EqualTo')); } parent::_read($params); return $this; }
/** * @param bool $upsert * @param bool $refresh * @return Bronto_Api_DeliveryGroup_Row */ public function save($upsert = true, $refresh = false) { if (!$upsert) { parent::_save(false, $refresh); } try { parent::_save(true, $refresh); } catch (Bronto_Api_DeliveryGroup_Exception $e) { $this->getApi()->throwException($e); } return $this; }
/** * Set row field value * * @param string $columnName The column key. * @param mixed $value The value for the property. */ public function __set($columnName, $value) { switch (strtolower($columnName)) { case 'email': // Trim whitespace $value = preg_replace('/\\s+/', '', $value); // Check if email got truncated if (substr($value, -1) === '.') { $value .= 'com'; } break; } return parent::__set($columnName, $value); }
/** * @return Bronto_Api_ApiToken_Row */ public function read() { if ($this->id) { $params = array('id' => $this->id); } elseif ($this->accountId) { $params = array('accountId' => $this->accountId); } elseif ($this->name) { $params = array('name' => array('value' => $this->name, 'operator' => 'EqualTo')); } else { throw new Bronto_Api_ApiToken_Exception('Trying to read ApiToken without Id or Name for lookup'); } parent::_read($params); return $this; }
/** * @param bool $upsert * @param bool $refresh * @return Bronto_Api_ContentTag_Row */ public function save($upsert = true, $refresh = false) { if (!$upsert) { parent::_save(false, $refresh); } try { parent::_save(true, $refresh); } catch (Bronto_Api_ContentTag_Exception $e) { if ($e->getCode() === Bronto_Api_ContentTag_Exception::MESSAGE_EXISTS) { $this->_refresh(); } else { $this->getApi()->throwException($e); } } return $this; }
/** * @param bool $upsert * @param bool $refresh * @return Bronto_Api_Field_Row */ public function save($upsert = true, $refresh = false) { if (!$upsert) { parent::_save(false, $refresh); } try { parent::_save(true, $refresh); } catch (Bronto_Api_Field_Exception $e) { if ($e->getCode() === Bronto_Api_Field_Exception::ALREADY_EXISTS) { $this->_refresh(); } else { $e->appendToMessage("(Name: {$this->name})"); $this->getApi()->throwException($e); } } return $this; }
/** * @param bool $upsert Ignored * @param bool $refresh * @return Bronto_Api_Delivery_Row */ public function save($upsert = null, $refresh = false) { parent::_save(false, $refresh); return $this; }