I am currently reading this Salesforce doc: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_returning_data.htm
This is the code provided on the page teaching us that we need to annotate fields we want serialized to the client-side:
public class SimpleAccount {
@AuraEnabled public String Id { get; set; }
@AuraEnabled public String Name { get; set; }
public String Phone { get; set; }
// Trivial constructor, for server-side Apex -> client-side JavaScript
public SimpleAccount(String id, String name, String phone) {
this.Id = id;
this.Name = name;
this.Phone = phone;
}
// Default, no-arg constructor, for client-side -> server-side
public SimpleAccount() {}
I am confused with the last comment near the no-arg constructor. What does it mean client-side to server-side? Why do we need this constructor?