本文整理汇总了PHP中Customer::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::setName方法的具体用法?PHP Customer::setName怎么用?PHP Customer::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMarshalling
public function testMarshalling()
{
$expectedXml = <<<XML
<?xml version="1.0"?>
<purchase-order xmlns="http://openuri.org/easypo">
<customer>
<name>Gladys Kravitz</name>
<address>Anytown, PA</address>
</customer>
<date>2003-01-07T14:16:00-05:00</date>
<line-item>
<description>Burnham's Celestial Handbook, Vol 1</description>
<per-unit-ounces>5</per-unit-ounces>
<price>21.79</price>
<quantity>2</quantity>
</line-item>
<line-item>
<description>Burnham's Celestial Handbook, Vol 2</description>
<per-unit-ounces>5</per-unit-ounces>
<price>19.89</price>
<quantity>2</quantity>
</line-item>
<shipper>
<name>ZipShip</name>
<per-ounce-rate>0.74</per-ounce-rate>
</shipper>
</purchase-order>
XML;
$filepath = dirname(__FILE__) . '/../../_files/EasyPO/';
$binding = new PiBX_Runtime_Binding($filepath . '/binding.xml');
$marshaller = new PiBX_Runtime_Marshaller($binding);
$po = new PurchaseOrder();
$po->setDate('2003-01-07T14:16:00-05:00');
$customer = new Customer();
$customer->setName('Gladys Kravitz');
$customer->setAddress('Anytown, PA');
$lineItem1 = new LineItem();
$lineItem1->setDescription('Burnham\'s Celestial Handbook, Vol 1');
$lineItem1->setPerUnitOunces('5');
$lineItem1->setPrice(21.79);
$lineItem1->setQuantity(2);
$lineItem2 = new LineItem();
$lineItem2->setDescription('Burnham\'s Celestial Handbook, Vol 2');
$lineItem2->setPerUnitOunces('5');
$lineItem2->setPrice(19.89);
$lineItem2->setQuantity(2);
$shipper = new Shipper();
$shipper->setName('ZipShip');
$shipper->setPerOunceRate(0.74);
$po->setCustomer($customer);
$po->setLineItems(array($lineItem1, $lineItem2));
$po->setShipper($shipper);
$xml = $marshaller->marshal($po);
$this->assertEquals($expectedXml, $xml);
$dom = new DOMDocument();
$dom->loadXML($xml);
$this->assertTrue($dom->schemaValidate($filepath . '/easypo.xsd'));
}
示例2: execute
/**
*
* @param <type> $request
* @return <type>
*/
public function execute($request)
{
$this->setLayout(false);
sfConfig::set('sf_web_debug', false);
sfConfig::set('sf_debug', false);
if ($this->getRequest()->isXmlHttpRequest()) {
$this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
}
$customerName = $request->getParameter('customerName');
$description = $request->getParameter('description');
$customer = new Customer();
$customer->setName($customerName);
$customer->setDescription($description);
$customer->save();
$array = array('id' => $customer->getCustomerId());
return $this->renderText(json_encode($array));
}
示例3: save
public function save()
{
$this->resultArray = array();
$customerId = $this->getValue('customerId');
if ($customerId > 0) {
$service = $this->getCustomerService();
$customer = $service->getCustomerById($customerId);
$this->resultArray['messageType'] = 'success';
$this->resultArray['message'] = __(TopLevelMessages::UPDATE_SUCCESS);
} else {
$customer = new Customer();
$this->resultArray['messageType'] = 'success';
$this->resultArray['message'] = __(TopLevelMessages::SAVE_SUCCESS);
}
$customer->setName(trim($this->getValue('customerName')));
$customer->setDescription($this->getValue('description'));
$customer->save();
return $this->resultArray;
}
示例4: createBuyer
function createBuyer()
{
$buyer = new Customer();
$buyer->setMail("comprador@comprador.com");
$buyer->setName("Comprador Teste");
$buyer->setCpf("850-822-365-04");
$buyer->setPhone("34-3311-9999");
$buyer->setCellPhone("34-9999-1111");
$buyer->setAddress(createAddress());
$buyer->setGender(GenderEnum::MALE);
$buyer->setBirthDate("01/01/1970");
$buyer->setRg("11337733");
$buyer->setIssueRgDate("01/01/1990");
$buyer->setOrganConsignorRg("SSP");
$buyer->setStateConsignorRg("MG");
$buyer->setCompanyName("Empresa de teste");
$buyer->setCnpj("72-139-715/0001-30");
$buyer->setSearchToken("");
return $buyer;
}
示例5: execute
/**
*
* @param <type> $request
* @return <type>
*/
public function execute($request)
{
$this->setLayout(false);
sfConfig::set('sf_web_debug', false);
sfConfig::set('sf_debug', false);
$csrfToken = $request->getParameter('csrfToken');
$form = new TimesheetFormToImplementCsrfTokens();
if ($form->getCSRFToken() != $csrfToken) {
return sfView::NONE;
}
if ($this->getRequest()->isXmlHttpRequest()) {
$this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
}
$customerName = $request->getParameter('customerName');
$description = $request->getParameter('description');
$customer = new Customer();
$customer->setName($customerName);
$customer->setDescription($description);
$customer->save();
$array = array('id' => $customer->getCustomerId());
return $this->renderText(json_encode($array));
}
示例6: testDefaultExpresions_ReloadOnInsert_Override
/**
* Tests the overriding reloadOnInsert at runtime.
*
* @link http://trac.propelorm.org/ticket/378
* @link http://trac.propelorm.org/ticket/555
*/
public function testDefaultExpresions_ReloadOnInsert_Override()
{
if (Propel::getDb(BookstoreEmployeePeer::DATABASE_NAME) instanceof DBSqlite) {
$this->markTestSkipped("Cannot test default date expressions with SQLite");
}
// Create a new bookstore, contest, bookstore_contest, and bookstore_contest_entry
$b = new Bookstore();
$b->setStoreName("Barnes & Noble");
$b->save();
$c = new Contest();
$c->setName("Bookathon Contest");
$c->save();
$bc = new BookstoreContest();
$bc->setBookstore($b);
$bc->setContest($c);
$bc->save();
$c = new Customer();
$c->setName("Happy Customer");
$c->save();
$bce = new BookstoreContestEntry();
$bce->setBookstore($b);
$bce->setBookstoreContest($bc);
$bce->setCustomer($c);
$bce->save(null, $skipReload = true);
$this->assertNull($bce->getEntryDate(), "Expected a NULL entry_date after save.");
}
示例7: 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());
}
}
示例8: testDoDelete_Cascade_CompositePK
/**
* Test that cascading deletes are happening correctly for composite pk.
* @link http://propel.phpdb.org/trac/ticket/544
*/
public function testDoDelete_Cascade_CompositePK()
{
$origBceCount = BookstoreContestEntryPeer::doCount(new Criteria());
$cust1 = new Customer();
$cust1->setName("Cust1");
$cust1->save();
$cust2 = new Customer();
$cust2->setName("Cust2");
$cust2->save();
$c1 = new Contest();
$c1->setName("Contest1");
$c1->save();
$c2 = new Contest();
$c2->setName("Contest2");
$c2->save();
$store1 = new Bookstore();
$store1->setStoreName("Store1");
$store1->save();
$bc1 = new BookstoreContest();
$bc1->setBookstore($store1);
$bc1->setContest($c1);
$bc1->save();
$bc2 = new BookstoreContest();
$bc2->setBookstore($store1);
$bc2->setContest($c2);
$bc2->save();
$bce1 = new BookstoreContestEntry();
$bce1->setEntryDate("now");
$bce1->setCustomer($cust1);
$bce1->setBookstoreContest($bc1);
$bce1->save();
$bce2 = new BookstoreContestEntry();
$bce2->setEntryDate("now");
$bce2->setCustomer($cust1);
$bce2->setBookstoreContest($bc2);
$bce2->save();
// Now, if we remove $bc1, we expect *only* bce1 to be no longer valid.
BookstoreContestPeer::doDelete($bc1);
$newCount = BookstoreContestEntryPeer::doCount(new Criteria());
$this->assertEquals($origBceCount + 1, $newCount, "Expected new number of rows in BCE to be orig + 1");
$bcetest = BookstoreContestEntryPeer::retrieveByPK($store1->getId(), $c1->getId(), $cust1->getId());
$this->assertNull($bcetest, "Expected BCE for store1 to be cascade deleted.");
$bcetest2 = BookstoreContestEntryPeer::retrieveByPK($store1->getId(), $c2->getId(), $cust1->getId());
$this->assertNotNull($bcetest2, "Expected BCE for store2 to NOT be cascade deleted.");
}
示例9: testMultiFkImplication
/**
* Test behavior of columns that are implicated in multiple foreign keys.
* @link http://propel.phpdb.org/trac/ticket/228
*/
public function testMultiFkImplication()
{
BookstoreDataPopulator::populate();
// Create a new bookstore, contest, bookstore_contest, and bookstore_contest_entry
$b = new Bookstore();
$b->setStoreName("Foo!");
$b->save();
$c = new Contest();
$c->setName("Bookathon Contest");
$c->save();
$bc = new BookstoreContest();
$bc->setBookstore($b);
$bc->setContest($c);
$bc->save();
$c = new Customer();
$c->setName("Happy Customer");
$c->save();
$bce = new BookstoreContestEntry();
$bce->setBookstore($b);
$bce->setBookstoreContest($bc);
$bce->setCustomer($c);
$bce->save();
$bce->setBookstoreId(null);
$this->assertNull($bce->getBookstoreContest());
$this->assertNull($bce->getBookstore());
}
示例10: testSetNameWorks
public function testSetNameWorks()
{
$customer = new Customer();
$customer->setName('Luís Dalmolin');
$this->assertEquals('Luís Dalmolin', $customer->getName());
}
示例11: executeSaveCustomer
/**
* Save Customer
* @param sfWebRequest $request
* @return unknown_type
*/
public function executeSaveCustomer(sfWebRequest $request)
{
$customerService = new CustomerService();
if ($request->isMethod('post')) {
$customer = new Customer();
$customer->setName($request->getParameter('txtName'));
$customer->setDescription($request->getParameter('txtDescription'));
$customerService->saveCustomer($customer);
$this->setMessage('SUCCESS', array(TopLevelMessages::SAVE_SUCCESS));
$this->redirect('admin/listCustomer');
}
}
示例12: castToCustomer
public function castToCustomer($obj)
{
$c = new Customer();
if (isset($obj->customerID)) {
$c->setCustomerID($obj->customerID);
}
if (isset($obj->email)) {
$c->setEmail($obj->email);
}
if (isset($obj->name)) {
$c->setName($obj->name);
}
if (isset($obj->key)) {
$c->setKey($obj->key);
}
if (isset($obj->website)) {
$c->setWebsite($obj->website);
}
return $c;
}
示例13: __construct
<?php
class ENullArgumentException extends Exception
{
public function __construct($paramName)
{
parent::__construct("Argument cannot be null: {$paramName}", 101);
}
}
class Customer
{
private $name;
function getName()
{
return $this->name;
}
function setName($name)
{
if ($name == null) {
throw new ENullArgumentException('$name');
} else {
$this->name = $name;
}
}
}
try {
$customer = new Customer();
$customer->setName(null);
} catch (ENullArgumentException $e) {
echo $e->getMessage() . " (code: " . $e->getCode() . ")";
}
示例14: 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();
}
}
示例15: Customer
<?php
require_once 'autoload.php';
if (isset($_POST['name'])) {
//print_r($_POST);
if (isset($_POST['cid'])) {
$cid = $_POST['cid'];
} else {
$cid = '';
}
$custs = new Customer();
$custs->setCID($cid);
$custs->setName($_POST['name']);
$custs->setShortName($_POST['sname']);
$custs->setAddressl1($_POST['addl1']);
$custs->setAddressl2($_POST['addl2']);
$custs->setContactPerson($_POST['cper']);
$custs->setPhoneNo($_POST['phone']);
$custs->setTINNo($_POST['tinno']);
$custs->setPANNo($_POST['panno']);
$custs->setExciseNo($_POST['excise']);
$custs->setMiscData($_POST['miscdata']);
$custs->saveCustomer($cid);
} else {
$cust = new Customer();
if (isset($_GET['cid'])) {
$cid = $_GET['cid'];
$cust->setCID($cid);
}
$cust->showCustomerUI();
}