コード例 #1
0
 /**
  * Delete existing customer
  *
  * @param CustomerEntity $customerEntity
  * @return integer
  */
 public function deleteCustomer(CustomerEntity $customerEntity)
 {
     return $this->delete(array('id' => $customerEntity->getId()));
 }
コード例 #2
0
 public function testInsertNewCustomer()
 {
     $customerEntity = new CustomerEntity();
     $customerEntity->setId(99);
     $customerEntity->setFirstname('Horst');
     $customerEntity->setLastname('Hrubesch');
     $customerEntity->setStreet('Am Köpfen 124');
     $customerEntity->setPostcode('21451');
     $customerEntity->setCity('Hamburg');
     $customerEntity->setCountry('de');
     $customerTable = new CustomerTable($this->adapter);
     $customerTable->insertCustomer($customerEntity);
     $queryTable = $this->getConnection()->createQueryTable('loadCustomersOrderedByLastname', 'SELECT * FROM customers WHERE id = "99";');
     $expectedRow = $queryTable->getRow(0);
     $hydrator = new CustomerHydrator();
     $customerRow = $hydrator->extract($customerEntity);
     $this->assertEquals($expectedRow, $customerRow);
 }