Created
August 20, 2015 16:59
-
-
Save jwoodcock/75f7e73cd416f058f732 to your computer and use it in GitHub Desktop.
Map Class
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
class MyMap | |
{ | |
public $user_id; | |
public $first_name; | |
public $last_name; | |
public $email; | |
public function __set($key, $val) | |
{ | |
// can't set the user_id, that's a db item | |
if ($key != $user_id) { | |
$this[$key] = $val; | |
} | |
} | |
public function save() | |
{ | |
if (!empty($this->user_id) { | |
// save call | |
// sql code goes here | |
} else { | |
// update call | |
// sql code goes here | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment