/** * @todo Implement testDelete(). */ public function testDelete() { $this->testSave(); $id = $this->object->getId(); $this->object->delete(); $obj = new Address($id); $this->assertEquals($obj, new Address()); }
private function getParams(Address $address) { $params = array(':id' => $address->getId(), ':street_no' => $address->getStreetNo(), ':street' => $address->getStreet(), ':suburb' => $address->getSuburb(), ':city' => $address->getCity(), ':post_code' => $address->getPostCode()); return $params; }
/** * Declares an association between this object and a Address object. * * @param Address $v * @return Account The current object (for fluent API support) * @throws PropelException */ public function setAddress(Address $v = null) { if ($v === null) { $this->setAddressId(NULL); } else { $this->setAddressId($v->getId()); } $this->aAddress = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Address object, it will not be re-added. if ($v !== null) { $v->addAccount($this); } return $this; }
/** * Filter the query by a related Address object * * @param Address|PropelObjectCollection $address The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return DomainQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByAddress($address, $comparison = null) { if ($address instanceof Address) { return $this->addUsingAlias(DomainPeer::ADDRESS_ID, $address->getId(), $comparison); } elseif ($address instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(DomainPeer::ADDRESS_ID, $address->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByAddress() only accepts arguments of type Address or PropelCollection'); } }
public function setAddressBilling(Address $address) { $this->id_billing = $address->getId(); return true; }
public function update(Address $address) { $id = $address->getId(); $ship_address = $this->db->quote($address->getShipaddress()); $ship_city = $this->db->quote($address->getShipCity()); $ship_postal_code = $this->db->quote($address->getShipPostalCode()); $ship_region = $this->db->quote($address->getShipRegion()); $ship_country = $this->db->quote($address->getShipCountry()); $bill_address = $this->db->quote($address->getBilladdress()); $bill_city = $this->db->quote($address->getBillCity()); $bill_postal_code = $this->db->quote($address->getBillPostalCode()); $bill_region = $this->db->quote($address->getBillRegion()); $bill_country = $this->db->quote($address->getBillCountry()); $query = "UPDATE address SET ship_address=" . $ship_address . ", ship_city=" . $ship_city . ", ship_postal_code=" . $ship_postal_code . ", ship_region=" . $ship_region . ", ship_country=" . $ship_country . ", bill_address=" . $bill_address . ", bill_city=" . $bill_city . ", bill_postal_code=" . $bill_postal_code . ", bill_region=" . $bill_region . ", bill_country=" . $bill_country . ",WHERE id='" . $id . "'"; $res = $this->db->exec($query); if ($res) { return $this->findById($id); } else { return "Internal Server Error"; } }
/** * Check whether specified address should be processed in after_save event handler * * @param Address $address * @return bool */ protected function _canProcessAddress($address) { if ($address->getForceProcess()) { return true; } if ($this->_coreRegistry->registry(self::VIV_CURRENTLY_SAVED_ADDRESS) != $address->getId()) { return false; } $configAddressType = $this->_customerAddress->getTaxCalculationAddressType(); if ($configAddressType == \Magento\Customer\Model\Address\AbstractAddress::TYPE_SHIPPING) { return $this->_isDefaultShipping($address); } return $this->_isDefaultBilling($address); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Address $obj A Address object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null AddressPeer::$instances[$key] = $obj; } }
/** * Exclude object from result * * @param Address $address Object to remove from the list of results * * @return AddressQuery The current query, for fluid interface */ public function prune($address = null) { if ($address) { $this->addUsingAlias(AddressPeer::ID, $address->getId(), Criteria::NOT_EQUAL); } return $this; }
public function updateAddress(Address $address) { try { if ($address != null && ($address->getId() == null || $address->getId() == -1)) { return false; } if (!parent::getBdd()->inTransaction()) { parent::getBdd()->beginTransaction(); } $query = "UPDATE ADDRESS SET line1 = :line1, line2 = :line2\n , zipcode = :zip, city = :city, latitude = :lat, longitude = :long\n WHERE id = :id"; $request = parent::getBdd()->prepare($query); $request->bindParam(':id', $address->getId()); if ($address->getLine1() != null) { $request->bindParam(':line1', $address->getLine1()); } else { $request->bindValue(':line1', null); } if ($address->getLine2() != null) { $request->bindParam(':line2', $address->getLine2()); } else { $request->bindValue(':line2', null); } if ($address->getZipCode() != null) { $request->bindParam(':zip', $address->getZipCode()); } else { $request->bindValue(':zip', null); } if ($address->getCity() != null) { $request->bindParam(':city', $address->getCity()); } else { $request->bindValue(':city', null); } $latLong = $this->googleMapService->getLatLong($address); if (sizeof($latLong) == 2) { $request->bindParam(':lat', $latLong[0]); $request->bindParam(':long', $latLong[1]); } else { $request->bindValue(':lat', null); $request->bindValue(':long', null); } $request->execute(); parent::getBdd()->commit(); $request->closeCursor(); return true; } catch (Exception $e) { error_log($e->getMessage()); } return false; }