[TYPO3-mvc] extbase how to do query for result

Siddhesh siddesh.savant at lelesys.com
Thu Jul 7 20:14:49 CEST 2011


hello list,
I am very new to extbase.let me put the problem from the scratch.
I have a database design with following fields.
I have a form to to submit these values.

typeoftour(boolean) lastname(string)  firstname(string)  email
	0              gemy               remy            gemy at xyz.com
	0	       gemy               remy            gemy at xyz.com
	1              gemy               remy            gemy at xyz.com
	1	       gemy		  remy		  gemy at xyz.com
	



0-Mountain Entry
1-Trecking entry

Let this be some instance of database at some point.now  in front i must 
get the following View.If i consider the baove database i must get the 
following output


Nameofmountainer          mountain(COUNT)	trek(COUNT)	
gemy remy			2			2


How to do this.Let me post what all i have did till now.I DONT KNOW WHAT 
I DID IS CORRECT.I am able to get nameofmountainer.But not able to get 
fields 'mountain(COUNT)' and 'trek(COUNT)'.As this field are not in by 
model.

Let me post my controller here
	$climbers = $this->climberRepository->recentPost($char);
	$this->view->assign('climbers', $climbers);

Let me post my repository here
$query = $this->createQuery();
$query->statement('SELECT *,(select count(type_of_tour) from 
tx_topsummits_domain_model_climber where email=a.email and 
type_of_tour=0) as num_trek,  (select count(type_of_tour) from 
tx_topsummits_domain_model_climber where email=a.email and 
type_of_tour=1) as num_mountain FROM tx_topsummits_domain_model_climber 
as a group by a.email');
$posts = $query->execute();
return $posts;

I have only one controller.Can anyone please help this newbie.Please can 
anyone suggest any other technic.

Thanks in Advance





More information about the TYPO3-project-typo3v4mvc mailing list