Attach connections and actions to models #28
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Resolves #4
Tasks
BaseTable
supports anattachConnection
function for accessing query builderWHERE
clauses in a query chain builder, support arraysdata
object in each model for referencing the primary key values to base changes ongetPrimaryKey(...)
->getPrimaryKeys(...)
mapToClass
function should automaticallyattachConnection
to all modelspull()
function in models for getting latest database values and updating modelupdate()
function in models to automatically update their values in the databasedelete()
function in models to automatically delete the row entry from the databaseinsert()
function in models to automatically create a new row entry with that classes valuesPending Questions:
sync()
on a model where the model pulls latest values from database and sets its properties to it, or something more explicit to the directionality of the action such as.pull()
Verify
WHERE
clause still operates as intendedWHERE
clauses still operate as intended (pass in multiple.where({})
WHERE
clauses still operate as intended (pass in array)sync
and self-update values to database valuesupdate
its values to the databasedelete
its row from the databaseinsert
a new row into the databaseBefore
After