Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

passing lang by params but how to change object?

ok so: this.$route.params.lang could equal EN, ES, FR, DE I am trying to change my courseResponse.data to include the language

my console logs are showing: courselang: [object Object]en HERE I AM: Proxy {0: {…}, 1: {…}}

let courselang = courseResponse.data;
      courselang = courselang + this.$route.params.lang;
      console.log("courselang: " + courselang);
      this.coursesuite = courselang.config.coursesuite;
      this.coursename = courselang.config.coursename;
      this.courseid = courselang.config.courseid;
      this.lms = courselang.config.lms;
      this.defaultlang = courselang.config.defaultlang;

      console.log("HERE I AM: ", courseResponse.data.en.config.coursesuite);
0 likes
9 replies
boyjarv's avatar

Can anyone help me here please?

so at the moment, this works:

      this.coursesuite = courseResponse.data.en.config.coursesuite;
      this.coursename = courseResponse.data.en.config.coursename;
      this.courseid = courseResponse.data.en.config.courseid;
      this.lms = courseResponse.data.en.config.lms;
      this.defaultlang = courseResponse.data.en.config.defaultlang;

I want to replace 'en' with: this.$route.params.lang;

Redbull's avatar

The object IS passed by reference, that is, a pointer to the object is passed to the method. That pointer cannot be changed by the method. But the method can use the pointer to change things within the object, and those changes are visible to the caller, and to anyone that has that reference.

[url]https://anonigstalk.com/[/url] [url]https://bingenerator.one/[/url]

martinbean's avatar

@boyjarv Well I’ve suggested twice now to nest available languages for a course in an array, instead of this weird smashing all the properties at the top level of the object.

Why are you trying to use a noSQL database when it’s clear a relational database would be far better?

boyjarv's avatar

@martinbean "Why are you trying to use a noSQL database when it’s clear a relational database would be far better?" really?

a lot more work though... I'd have to go through and create lots of tables and relationships

martinbean's avatar

@boyjarv And how is noSQL working out for you so far? Bearing in mind the amount of questions you’ve asked already because of the difficulties in retrieving and working with data 😉

boyjarv's avatar

great for what I need it to do..I usually would always go down the relational database route but for the particular project that is just using and reusing a large JSON object the no-relational db seems to be better suited

Please or to participate in this conversation.