The variable $code does not exist, should be $this->code I guess...
The variable $location does not exist, should be $this->location I guess...