How can we know the relationships on any table?


#1

How can we know the relationships on any table in controller.

I have made a common controller where I have created common list, view, add, delete methods.
I just want to add the Contains dynamically in above methods.

So, how is it possible?

Any suggestions.

Thanks

Regards
Anuj


#2

Do you mean you want to get the names of the relationships or just get values from the relationships?


#3

@FinlayDaG33k : want to create dynamic relationships to fetch the values.


#4

creating relationships on the fly can’t be done afaik.
What you could do it create a relationship in the model, then access it in your controller like:

$table = 'news';
$this->Users->{$table};

#5

ok. I will try this. Thanks!