Support for private columns and filtered objects #124
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.
When one wants to send an ORM object trough an API some columns should be remain private or hidden. This can be done using the
$_private
variable in the model.Calls like
as_array()
will return only the non private column values.An extra function
as_object()
is also added this will return a new object instance with the column values, it differs with the casted array ((object)$some_model->as_array()
) that each value will be returned as it's native type (string
,int
orfloat
).If the functions are called with the TRUE argument (
as_array(TRUE)
oras_object(TRUE)
) all column values will be returned.Also leaving
$_private
empty will return all column values which assures backwards compatibility.