Skip to content

[GitBook] Create() Method Documentation Improvement #245

@homestar9

Description

@homestar9

@elpete, I no longer have access to the Quick documentation on Gitbook for some reason, so I'm posting my suggestion here:

On the page: https://quick.ortusbooks.com/guide/getting-started/creating-new-entities#create
It is critically important to let users know the create() method returns a brand new entity, and does not persist the current entity which may have called it.

Example:

prc.user = getInstance( "User" ).newEntity();

// danger Will Robinson! This will not update prc.user.
prc.user.create( {
 "firstName": "Dave"
} );

writeDump( prc.user.isLoaded() ); // <--- WILL BE FALSE!

If you want to use create, you must do this instead:

prc.user = getInstance( "User" ).newEntity();

// in order for this to work, you must replace the original variable.
prc.user = prc.user.create( {
 "firstName": "Dave"
} );

writeDump( prc.user.isLoaded() ); // <--- WILL BE TRUE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions