本文整理汇总了PHP中Customer::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getId方法的具体用法?PHP Customer::getId怎么用?PHP Customer::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::getId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) {
$this->aCustomer = null;
}
if ($this->aCustomerFamily !== null && $this->customer_family_id !== $this->aCustomerFamily->getId()) {
$this->aCustomerFamily = null;
}
}
示例2: getOrCreateUserAttribute
/**
* get or create attribute data for given object
*
* @param Customer $object
* @return \Shopware\Models\Attribute\Customer
* @throws Exception
*/
public function getOrCreateUserAttribute($object)
{
if ($attribute = $object->getAttribute()) {
return $attribute;
}
if ($object instanceof Shopware\Models\Customer\Customer) {
if (!($attribute = Shopware()->Models()->getRepository('Shopware\\Models\\Attribute\\Customer')->findOneBy(array('customerId' => $object->getId())))) {
$attribute = new Shopware\Models\Attribute\Customer();
}
} else {
throw new Exception('Unknown attribute base class');
}
$object->setAttribute($attribute);
return $attribute;
}
示例3: runPage
protected function runPage()
{
if (WebRequest::wasPosted()) {
if (!WebRequest::postInt("calroom")) {
$this->showCal();
return;
}
$startdate = new DateTime(WebRequest::post("qbCheckin"));
$enddate = new DateTime(WebRequest::post("qbCheckout"));
$room = Room::getById(WebRequest::postInt("calroom"));
for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) {
if (!$room->isAvailable($date)) {
$this->error("room-not-available");
$this->showCal();
return;
}
}
// search for customer
if (!($customer = Customer::getByEmail(WebRequest::post("qbEmail")))) {
$customer = new Customer();
$suTitle = WebRequest::post("qbTitle");
$suFirstname = WebRequest::post("qbFirstname");
$suLastname = WebRequest::post("qbLastname");
$suAddress = WebRequest::post("qbAddress");
$suCity = WebRequest::post("qbCity");
$suPostcode = WebRequest::post("qbPostcode");
$suCountry = WebRequest::post("qbCountry");
$suEmail = WebRequest::post("qbEmail");
$customer->setPassword($suEmail);
// set values
$customer->setTitle($suTitle);
$customer->setFirstname($suFirstname);
$customer->setSurname($suLastname);
$address = new Address();
$address->setLine1($suAddress);
$address->setCity($suCity);
$address->setPostCode($suPostcode);
$address->setCountry($suCountry);
$address->save();
$customer->setAddress($address);
$customer->setEmail($suEmail);
// save it
$customer->save();
$customer->sendMailConfirm();
// save it again
$customer->save();
}
$booking = new Booking();
$booking->setStartDate(WebRequest::post("qbCheckin"));
$booking->setEndDate(WebRequest::post("qbCheckout"));
$booking->setAdults(WebRequest::post("qbAdults"));
$booking->setChildren(WebRequest::post("qbChildren"));
$booking->setPromocode(WebRequest::post("qbPromoCode"));
$booking->setRoom($room->getId());
$booking->setCustomer($customer->getId());
$booking->save();
$msg = Message::getMessage("booking-confirmation");
$msg = str_replace("\$1", $booking->getStartDate(), $msg);
$msg = str_replace("\$2", $booking->getEndDate(), $msg);
$msg = str_replace("\$3", $booking->getAdults(), $msg);
$msg = str_replace("\$4", $booking->getChildren(), $msg);
$msg = str_replace("\$5", $booking->getRoom()->getName(), $msg);
Mail::send($customer->getEmail(), Message::getMessage("booking-confimation-subject"), $msg);
$this->mSmarty->assign("content", $msg);
return;
}
throw new YouShouldntBeDoingThatException();
}
示例4: testMultiColJoin
/**
* Testing foreign keys with multiple referrer columns.
* @link http://propel.phpdb.org/trac/ticket/606
*/
public function testMultiColJoin()
{
BookstoreContestPeer::doDeleteAll();
BookstoreContestEntryPeer::doDeleteAll();
$bs = new Bookstore();
$bs->setStoreName("Test1");
$bs->setPopulationServed(5);
$bs->save();
$bs1Id = $bs->getId();
$bs2 = new Bookstore();
$bs2->setStoreName("Test2");
$bs2->setPopulationServed(5);
$bs2->save();
$bs2Id = $bs2->getId();
$ct1 = new Contest();
$ct1->setName("Contest1!");
$ct1->save();
$ct1Id = $ct1->getId();
$ct2 = new Contest();
$ct2->setName("Contest2!");
$ct2->save();
$ct2Id = $ct2->getId();
$cmr = new Customer();
$cmr->setName("Customer1");
$cmr->save();
$cmr1Id = $cmr->getId();
$cmr2 = new Customer();
$cmr2->setName("Customer2");
$cmr2->save();
$cmr2Id = $cmr2->getId();
$contest = new BookstoreContest();
$contest->setBookstoreId($bs1Id);
$contest->setContestId($ct1Id);
$contest->save();
$contest = new BookstoreContest();
$contest->setBookstoreId($bs2Id);
$contest->setContestId($ct1Id);
$contest->save();
$entry = new BookstoreContestEntry();
$entry->setBookstoreId($bs1Id);
$entry->setContestId($ct1Id);
$entry->setCustomerId($cmr1Id);
$entry->save();
$entry = new BookstoreContestEntry();
$entry->setBookstoreId($bs1Id);
$entry->setContestId($ct1Id);
$entry->setCustomerId($cmr2Id);
$entry->save();
// Note: this test isn't really working very well. We setup fkeys that
// require that the BookstoreContest rows exist and then try to violate
// the rules ... :-/ This may work in some lenient databases, but an error
// is expected here.
/*
* Commented out for now ... though without it, this test may not really be testing anything
$entry = new BookstoreContestEntry();
$entry->setBookstoreId($bs1Id);
$entry->setContestId($ct2Id);
$entry->setCustomerId($cmr2Id);
$entry->save();
*/
$c = new Criteria();
$c->addJoin(array(BookstoreContestEntryPeer::BOOKSTORE_ID, BookstoreContestEntryPeer::CONTEST_ID), array(BookstoreContestPeer::BOOKSTORE_ID, BookstoreContestPeer::CONTEST_ID));
$results = BookstoreContestEntryPeer::doSelect($c);
$this->assertEquals(2, count($results));
foreach ($results as $result) {
$this->assertEquals($bs1Id, $result->getBookstoreId());
$this->assertEquals($ct1Id, $result->getContestId());
}
}
示例5: register
public function register($domain, $tld, Customer $customer, array $nameservers = null, $invoiceOption = 'KeepInvoice')
{
$arrayNs = is_null($nameservers) ? $this->defaultNameservers : $nameservers;
$bodyResponce = $this->client->post('/domains/register.json', ['domain-name' => $domain . '.' . $tld, 'years' => 1, 'ns' => $arrayNs, 'customer-id' => $customer->getId(), 'reg-contact-id' => $customer->getContactRegistrant(), 'admin-contact-id' => $customer->getContactAdmin(), 'tech-contact-id' => $customer->getContactTech(), 'billing-contact-id' => $customer->getContactBilling(), 'invoice-option' => $invoiceOption]);
return $bodyResponce['status'] === 'Success';
}
示例6: deleteCustomerFromDatabase
private function deleteCustomerFromDatabase(Customer $customerToDelete)
{
$stmt = $this->db->db->prepare("DELETE FROM " . self::$dbTable . " WHERE `id`=:id");
$id = $customerToDelete->getId();
$stmt->bindParam(':id', $id);
try {
$stmt->execute();
} catch (\PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die;
//Remove or change message in production code
}
}
示例7: getAllCustomers
public function getAllCustomers()
{
$customerList = array();
$result = $this->db->query('SELECT * FROM Customer');
foreach ($result as $row) {
$custDetails = new Customer();
$custDetails->setId($row['id']);
$custDetails->setCustomerName($row['customerName']);
$custDetails->setEmail($row['email']);
$custDetails->setPhoneNumber($row['phoneNumber']);
$custDetails->setAddress($row['address']);
$custDetails->setPassword($row['password']);
$custDetails->setLastUpdate($row['lastUpdate']);
$customerList[$custDetails->getId()] = $custDetails;
}
return $customerList;
}
示例8: findByCustomer
/**
* Find all Subscriptions for a Customer.
*
* @param \Litwicki\Bundle\ChargifyBundle\Handler\Customer $entity
* @param array $query
*
* @throws \Exception
*/
public function findByCustomer(Customer $entity, $query = array())
{
try {
$uri = sprintf('/customers/%s/subscriptions', $entity->getId());
return $this->fetchMultiple($uri, '\\Litwicki\\Bundle\\ChargifyBundle\\Model\\Subscription', $query);
} catch (\Exception $e) {
throw $e;
}
}
示例9: getDefaultContacts
public function getDefaultContacts(Customer $customer)
{
$bodyResponce = $this->client->get('/contacts/default.json', ['customer-id' => $customer->getId(), 'type' => 'Contact']);
$obj = $bodyResponce;
return ['registrant_id' => (int) $obj['Contact']['registrant'], 'tech_id' => (int) $obj['Contact']['tech'], 'billing_id' => (int) $obj['Contact']['billing'], 'admin_id' => (int) $obj['Contact']['admin']];
}
示例10: setCustomer
/**
* Specify address customer
*
* @param Customer $customer
* @return $this
*/
public function setCustomer(Customer $customer)
{
$this->_customer = $customer;
$this->setCustomerId($customer->getId());
return $this;
}
示例11: addInstanceToPool
/**
* 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 Customer $value A Customer object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Customer $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例12: genCustomer
function genCustomer()
{
if ($this->getCustomerName() and $this->getCustomer()->getName() == "-") {
//see if customer exists
$customer = Doctrine_Query::create()->from('Customer c')->where('c.name = "' . $this->getCustomerName() . '"')->fetchOne();
//if not, create
if (!$customer) {
$customer = new Customer();
$customer->setName($this->getCustomerName());
$customer->setPhone1($this->getCustomerPhone());
$customer->save();
} else {
if ($customer->getPhone1() == null or $customer->getPhone1() == "") {
$customer->setPhone1($this->getCustomerPhone());
$customer->save();
}
}
//set as customer, empty customername
$this->setCustomerId($customer->getId());
$this->setCustomerName("");
$this->setCustomerPhone("");
$this->save();
}
}
示例13: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCustomer !== null && $this->id !== $this->aCustomer->getId()) {
$this->aCustomer = null;
}
}