kamilrafik
(Subscriptions)
81
to mdomba:
I talked only about behaviors() method
helper method which is
all this is very wrong from my point of view
mdomba
(Maurizio Domba Cerin)
82
Read again my post and the documentation… check the source code and try to understand why and how this works…
By default it returns empty array as no behaviors are assigned to the controller or model… but that is not always!..
You can assign any behavior to your model or controller by using that method in your class…
That method cannot be in the CController as there are many child classes that do not need that functionality (at least in this version of Yii)
kamilrafik
(Subscriptions)
83
to mdomba:
in such case can you clarify how can I determine whether model has any attached behavior and receive the list of all attached behaviors?
earlier I assumed that it should be done by behaviors() method but it was empty
so for now I don’t see any way to see what I want
mdomba
(Maurizio Domba Cerin)
84
This method is not for getting the list of behaviors… it’s for setting behaviors… like I wrote in my first post about this… I wrote:
Even the documentation for this method say:
It’s not "returns a list of behaviors that this controller IS behaving as…
mdomba
(Maurizio Domba Cerin)
85
Forgot to add… you cannot get the list of behaviors() that are attached… can you explain a use case for this?
But you can check if a specified behavior is attached to the controller/model with asa() - http://www.yiiframew…nent#asa-detail
kamilrafik
(Subscriptions)
86
thanks
I understand now
a use case is the following
I autogenerate model classes on the fly in according with definitions in db
but some of them may require hardcoded extensions and customizations for specific clients
these extensions and customizations are done by behaviors
so before calling predefined in docs behavior’s method, I check whether any behavior is attached to the autogenerated mofdel class
kamilrafik
(Subscriptions)
87
- you have this identical method in several files in the code
public string pluralize(string $name)
and I still have not found a reverse method that makes a singular form of the word
kamilrafik
(Subscriptions)
88
- CDataColumn should allow create some sorting rules by specifying several attributes with asc/desc
is it possible?
if not, it would be very useful
kamilrafik
(Subscriptions)
89
- Do I understand correctly that CActiveDataProvider cannot show and cannot sort by displayed attributes of related records?
if yes, it would be a useful new feature
kamilrafik
(Subscriptions)
91
- There is a BUG or a very strange behavior of one method.
CActiveRecord::saveAttributes()
sequences of actions inside transaction
-
save()
-
do a lot of other works
-
findByPk() the model saved in 1
-
saveAttributes() for it
result = NOTHING happens
I meet this behavior from the version that existed already a year ago
I did not clear testing
I have no time for this
but please check
I meet it the second time - 1 year ago and now
kamilrafik
(Subscriptions)
93
- also write in docs that saveAttributes does NOT set internal errors property for a model
so there is NO way to find a reason of an error if it happens
kamilrafik
(Subscriptions)
94
- It would be useful to add into CModel method
getAttributeRules($attributeName) to list all rules for a specific attribute in array