Support for private columns and filtered objects#124
Support for private columns and filtered objects#124svenbw wants to merge 3 commits intokohana:3.3/developfrom
Conversation
|
@svenbw thank you for your pull request, it's very comprehensive. Unfortunately, most of the active maintainers are probably not using this module. That's why PRs are sitting around here for a while until someone merges them. Sorry :( |
|
Added behaviors for ORM. With behaviors one can add a slug, guid, creation timestamp, ... by defining the |
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
$_privatevariable 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,intorfloat).If the functions are called with the TRUE argument (
as_array(TRUE)oras_object(TRUE)) all column values will be returned.Also leaving
$_privateempty will return all column values which assures backwards compatibility.