How can i get assocation table colums name? cakephp 3.x -


i reach this:

$this->users->schema()->columns();//return users table colums name array $this->users->associations()->keys()//return users assocation table key 

but want reach associations columns name.

users table: id, user_name, user_password, user_group_id

user_groups: id,group_name

$this->users->schema()->columns() => return id, user_name, user_password, user_group_id

$this->users->associations()->keys() => return user_group

i need user_groups table columns name list or array.

to access information of association can either use association() function:

$usergourps = $this->users->association('usergroups'); 

or can use magic property name:

$usergroups = $this->users->usergroups; 

after getting property can access schema of table:

$columns = $usergroups->schema()->columns(); 

you can, of course, in 1 chain:

$columns = $this->users->usergroups->schema()->columns(); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -