Sunday, 11 August 2013

How can i get cakephp current model's foreign key column name?

How can i get cakephp current model's foreign key column name?

Is there way to get current model's foreign key name in other model
something like this
echo $this->Category->whatIsMyForeignKeyName();
// expected output 'category_id'
Edit: Version
strtolower($this->Category->alias).'_id'
somehow seems not in spirit of cake.

No comments:

Post a Comment