public function add() { // Sets encrypted password $this->salt = rand(10000, 99999); $this->password = $this->encryptPassword($this->password); parent::add(); // Sets first game $playerStructure = new PlayerHasStructure(); $playerStructure->player_id = $this->id; $playerStructure->structure_id = OsteoFactory::getElement('Structure', null, 'structure_category_id=7')->id; $playerStructure->add(); }