Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function __set($name, $value) {
- if(in_array($name, self::$attributes[$this->className])) {
- $fieldMeta = self::$meta[$this->className][$name];
- $dbtype = $fieldMeta['dbtype'];
- if($dbtype != 'varchar') {
- switch($dbtype) {
- case 'int':
- if(empty($value)) {
- $value = null;
- }
- else {
- $value = (int)$value;
- }
- break;
- case 'tinyint':
- $value = (bool)$value;
- break;
- }
- }
- }
- else if(!$this->isNewRecord() && isset($this->associations->{$name})) {
- $this->associations->save($name, $this, $value);
- }
- $this->data[$name] = $value;
- }
Add Comment
Please, Sign In to add comment