Several features which are critical for practical work

to mdomba:

I talked only about behaviors() method

helper method which is

  • public

  • always returns empty array

  • located duplicated in child classes of CComponent (CModel and CController) although all work with behaviors is done in CComponent

all this is very wrong from my point of view

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)

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

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…

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

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

  1. 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

  1. CDataColumn should allow create some sorting rules by specifying several attributes with asc/desc

is it possible?

if not, it would be very useful

  1. 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

  1. I mean - if I’ll specify “with” for criteria for CActiveProvider it should process attrs of related records as normal attrs
  1. There is a BUG or a very strange behavior of one method.

CActiveRecord::saveAttributes()

sequences of actions inside transaction

  1. save()

  2. do a lot of other works

  3. findByPk() the model saved in 1

  4. 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

  1. When I pass a date/datetime to formatter it should accept them in ANY format - timestamp, string, etc - and do conversion automatically
  1. 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

  1. It would be useful to add into CModel method

getAttributeRules($attributeName) to list all rules for a specific attribute in array

  1. CDataColumn needs filterHtmlOptions property for filter cell