Created
March 10, 2016 21:02
-
-
Save juanwilde/f24bc86e7c67163b64b8 to your computer and use it in GitHub Desktop.
Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function save($data) | |
{ | |
$customer = new Customer(); | |
$customer->setName($data['name']); | |
if (isset($data['lastname'])) $customer->setLastname($data['lastname']); | |
$customer->setPhone($data['phone']); | |
if (isset($data['address'])) $customer->setAddress($data['address']); | |
if (isset($data['email'])) $customer->setEmail($data['email']); | |
$customer->setEquipment($data['equipment']); | |
$customer->setPass($data['pass']); | |
$customer->setTasks($data['tasks']); | |
$customer->setStatus($data['status']); | |
$customer->setLocation($data['location']); | |
if (isset($data['notes'])) $customer->setNotes($data['notes']); | |
if (isset($data['price'])) $customer->setPrice($data['price']); | |
$customer->setInformed($data['informed']); | |
$this->em->persist($customer); | |
$this->em->flush(); | |
// Get the last ID inserted and create controls | |
// for all admins | |
$lastInsertId = $customer->getId(); | |
if ($lastInsertId) { | |
return $lastInsertId; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍