You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just would like to highlight a few easy changes to improve Jelly consistency :
Some classes use methods when some others use properties for the same functionalities : Jelly_Field::$model does the same as Jelly_Meta::model()
Behaviors should behave like fields : data passed by the constructor is protected and a underscore is prepended, when all public in fields. Also Jelly_Meta has a field() method to allow setting / getting just one field, it should have a behavior() method just the same. That would allow to check easily if a model has a given behavior or not.
Writing behavior methods is a pain because of arguments order... If you were to pass an extra argument to a behavior function, it is in between the model and the event data, which makes optional arguments a pain to handle...
Ex :
public function model_call_test(model, $optional, $data = NULL)
Why not simply :
public function model_call_test($model, $data, $optional1 = NULL, $optional2 = NULL)... ??
Some protected data miss method accessers, which limits flexibility :
Jelly_Event should have a public method to check if a given event is defined, that would run an array_key_exists in the protected property _events
Jelly_Builder should have a method to check if a given field is already in the the select, where, join or others statements. This is really an issue when writing behavior, as I ran into the same issue than @ivank in Paranoid behavior and Jelly_builder #95. May I suggest a has() method in the builder :
:
public function has($property, $field)
{
// Run some formatting on $field such as if field is an instance of Jelly_Field take the column name, if it is a text we should separe model and field name, it no model default to the builder model etc etc
switch($property)
{
case 'select' :
// check $this->_select
case 'where':
// check $this->_where
etc etc
}
}
Another (dirtier) option would be to make a __get() method to access these protected data
Hi there,
Just would like to highlight a few easy changes to improve Jelly consistency :
Ex :
Why not simply :
Some protected data miss method accessers, which limits flexibility :
:
Another (dirtier) option would be to make a __get() method to access these protected data