Model navigation properties


I have three entities in my DB:

robot <<------->> charateristic_value <<------->> charateristic

<<-------->> means many-to-many.

The DB schema for this is:

  • Table: robot
  • Table: robotcharateristicvalue (many-to-many between robot and charateristic_value)
  • Table: charateristic_value
  • Table: charateristiccharateristicvalue (many-to-many between charateristic and charateristic_value)
  • Table: charateristic

The Models, with all hasManyToMany and belgonsTo configurated in their initialize methods, are:

  • Robot
  • RobotCharateristicValue
  • CharateristicValue
  • CharateristicCharateristicValue
  • Charateristic

I am inside Robot model. I'm implementing a Method that returns all Charateristic of this Robot with charateristic_name = "COLOR". I'd like to do something like that:

         'CharateristicName = "EYE"',

Is there any way to do something like that? Or is it necessary to use the ::query() method?

Thank you.



Unfortunately, this nice feature (called "named scope" by yii framework: is not available in phalcon, you will have to do it by hand in your own function.