Get / save fileds on intermediate table

Hello community,

I have an issue handling extra fields from the intermediate table.

Look at the diagram:

I need to get all fields from the "PerfumeCategory" table, which is just an intermediate table between Perfumes and Categories. So relationship is defined as one Perfume can have many Categories.

Is Phalcon ORM capable of doing so?

So far we defined Perfume model as:

        $this->hasManyToMany('PerfumeID', 'PerfumeCategory','PerfumeID','CategoryID','Category', 'CategoryID', array('alias' => 'PerfumeCategory'));

and Category model as:

        $this->hasManyToMany('CategoryID', 'PerfumeCategory','CategoryID','PerfumeID','Perfume', 'PerfumeID', array('alias' => 'PerfumeCategory'));


Look like my example, the table posts, tags, postsTags

            __NAMESPACE__ . '\PostsTags',
            __NAMESPACE__ . '\Tags',
            ['alias' => 'tag']

See full source at, if we defined relation as the above to get tags


You can take look code at

edited Dec '15


But that's only the primary key of intermediate table, right?

How can you fetch other fields from the intermediate table, i.e. order in my diagram?

Also, how do you save the related data within intermediate table?