public function add() { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $entity = new AddressEntity(); $entity->setName($_POST['name'])->setAddress($_POST['address'])->saveImage($_FILES['image'])->setDateAdded(date('Y-m-d H:i:s')); $addressCollection = new AddressCollection(); $addressCollection->save($entity); header('Location: index.php?c=address'); exit; } $this->loadView('address/add'); }
public function getAddress() { $address = new AddressEntity(); $address->load($this->fields['address_id']); return $address->getFields(); }
/** * @param AddressEntity $address * * @return bool */ public static function validateEntityPhone(AddressEntity $address) { // any logic to validate person phone return preg_match('/^[\\d]+$/', $address->getEntityPhone()); }