Skip to content
Advertisement

Why my relation ship return always null with PHP Phalcon?

I try to use relationShip ManyToMany with PHP Pahlcon 3.4

My models :

JavaScript

and Banque :

JavaScript

and relation :

JavaScript

I can save in table societes_banques, but not get data

In my controller, I get my Societe object :

JavaScript

After, I try to get SocietesBanques data with :

JavaScript

This line return me NULL

If I try :

JavaScript

I have the error :

JavaScript

I do same thing as Phalcon documentation

Can you help me? what is my fault?

Advertisement

Answer

Because you didn’t specified an alias during relation declaration.

JavaScript

And after that, you can call magic method getSocietesBanques().

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement