Welcome, Guest
Username: Password: Remember me

TOPIC: Multiple JOOMLA USER types and GRID

Multiple JOOMLA USER types and GRID 19 Dec 2016 16:31 #14857

  • jamaza
  • jamaza's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Karma: 0
I have a table called JOBS, and a XRef table called xExpertstoJobs, this XRef has two Joomla User type fields

On a JOBS collection view, I want to pull in the names from BOTH of these fields, however they are not rendering with the correct name and I can only pull in one

In the table view the fields are called expert_id and referrer_id

In the FIELD view at the side to drag them in they are called

user
user
The administrator has disabled public write access.

Multiple JOOMLA USER types and GRID 20 Dec 2016 14:48 #14858

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
  • Karma: 22
Hi Jamaza,

I am not sur your Table design is correct in order to use Xref but if i anderstand what you want to do, you should have 3 Tables involved.
- JOBS: (id, title, ...)
- EXPERTS: (id, title, FK [ JUser, ... ]
- xExpertstoJobs (job_id, expert_id, ...)

So with this N:m Pivot Table :
- A Job can needs One or Many Experts Features,
- An Expert can cover One or Many Jobs.

Then, in the Jobs View Layout, you could drag :
- job_title
- - Xref [ExpertstoJobs (on Job)]
- - - Expert_title
- - - FK [Juser]
- - - - Name
- - - - UserName
- - - - etc, etc,

And, in the Experts View Layout, you could drag :
- expert_title,
- FK [Juser]
- - Name
- - UserName
- Xref [ExpertstoJobs (on expert)]
- - FK [job]
- - - job_title

Hoping that can help you ...
Last Edit: 20 Dec 2016 16:17 by liubov.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Multiple JOOMLA USER types and GRID 16 Jan 2017 23:02 #14948

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I had a look on your database design

Context I understood :
The 2 FK references to users are located in the EXPERTSTOJOBS table. N:1 relation
You want to list the users from the Jobs table.

Since ORM, this is incredibely simple to achieve.
This should work to grab the datas.
$this->orm(array(
	'relation' => array(

		'xexpertstojobs' => array(
			'select' => array(

				'expert_id.username',
				'expert_id.name',
				
				'referrer_id.username',
				'referrer_id.name',
			)
		)
	)
));
Then dump the loaded datas, and you will see the list of users behind the N:1 relation.

Need more explanation ?

EDIT : You need to download again because I fixed something on the ORM engine that was required for this operation.
Coding is now a piece of cake
Last Edit: 16 Jan 2017 23:04 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL
Time to create page: 0.061 seconds

Get Started