Questions tagged with find

2 answers

0 votes

Asked by fly2279, on 11/11/09 in

How to find which combination Clubs is being used by Children?

Child hasMany Membership

Membership belongTo Child, Club

Club hasMany Membership

Basically Child HABTM Club with the Membership being the join table,

like at the bottom of this section:...

3 answers

1 vote

Asked by powtac, on 18/11/09 in

Selecting just some fields in a HABTM findAll() query

How can I select a defined list of fields in a findAll() query which runs on a HABTM model. I have the model diagram with HABTM tags. In the tag model I use:


$this->Tag->findAll();

This returns a correct result but the query selects all(!)...

1 answer

0 votes

Asked by Smashy, on 20/12/09 in

find - conditions - uppercase in LIKE

Hi,

I'm having data with upper and lowercase, ex. Company, COMPANY etc. As I tested LIKE is case sensitive.


<?php $partners = $this->Partner->find('all', array(
	   'conditions'=>array('Partner.name...

1 answer

0 votes

Asked by agranstrom, on 29/12/09 in

findAll and hasMany

Hi,

I have four models, Company, Employee, BusinessUnit and BusinessUnitMember

Company belongsTo Employee

Employee hasMany BusinessUnitMember

BusinessUnitMember belongsTo BusinessUnit

BusinessUnit hasMany ...

1 answer

0 votes

Asked by iwanwan, on 2/1/10 in

find conditions

hi all,

Ho do I create this sql with cakephp


SELECT `item`.`id`, `item`.`name_1`, `item`.`name_2` 
FROM `item`
WHERE `item`.`name_1` != `item`.`name_2`

Thanks

1 answer

0 votes

Asked by yesk13, on 7/1/10 in

possible to use find('list') across models?

are there any cakephp way of using find('list', array('fields' = array('User.id', 'Profile.nickname')))); ?

if i do that it'll throw an error.

for the time being i am using a function i wrote to get the list, not flexible function at that.

Your...

1 answer

0 votes

Asked by hey33, on 13/1/10 in

Subquery in Select From, how di I do this?

Hi, how do I convert this query (with subquery):

SELECT * FROM (SELECT * FROM Logs ORDER BY Logs.created DESC) AS a GROUP BY Logs.id ORDER BY Logs.created DESC

to a CakePHP find condition?

2 answers

0 votes

Asked by aiyer, on 13/1/10 in

Can i work directly on the results of a find?

This is *probably* more a basic php question, but i'm new to php, and i don't really know where to go, so...

I have here a find operation:


$this->User->find('first',array('fields'=>'password'))

is it possible to, well, just plain ol' extract data...

3 answers

0 votes

Asked by sebb86, on 26/1/10 in

find('list'...) DropDown-list with key-values + description for more information?

Solution

:

http://bakery.cakephp.org/articles/view/multiple-display-field-3#comment-0

Question

Hello,

i created a dropdown-field with key-values. So when i click on the drop-down field, it looks like:

(1)

(4)

(8)

...

Well, that's not much. To show the...

1 answer

0 votes

Asked by twistedpear, on 19/1/10 in

Counts for Associated Tables (hasMany)

I'd like some advice on the CAKE way of getting a count of an associated (recursion 1) table, and paginating that. e.g.

Recipe belongsTo Author
Recipe hasMany Comments

in my recipes_controller I have a function recentRecipes()` that will perform a...

0 answers

0 votes

Asked by ramam, on 29/1/10 in

HABTM depth find

Hi!

I have:

Fi HABTM Group, User

Group HABTM Fi, User

User HABTM Fi, Group

In my Fi Controller I want to find if a given Fi is associated with a particular user either directly (in fis_users) or indirectly (fis_groups - group - groups_users).

Is there...

3 answers

0 votes

Asked by CrazyGolem, on 29/1/10 in

Set find() conditions in the model

Hi everybody, I'm brand new to CakePHP and I'm discovering with pleasure its features :)

Is there a "Model property"-like manner (or a property; I couldn't find one in the API doc) to set the find 'fields' and 'conditions' conditions ?

Instead of...

2 answers

0 votes

Asked by JacopKane.myopenid.com, on 8/2/10 in

I can't get a user data condition requested with a null and spesific id


<?php
function someController()
{
	$user_id = $this->Session->read('Auth.User.id');
	
	$this->Announcement->recursive = 1;
	$this->paginate = array
	(
		'conditions' => array
		(
			'Announcement.user_id' => array($user_id,null)
		),
		'limit'...

1 answer

1 vote

Asked by mee, on 15/2/10 in

Condition dans HABTM

Bonjour,

J'ai des vidéos qui HABTM tags.

J'aimerai récupérer la liste de toutes les vidéos qui ont au moins un tag, comment faire ?

Merci.

1 answer

0 votes

Asked by jamesl, on 15/2/10 in

query

Hi, what would this query look like as per cake?

'SELECT COUNT( * )FROM orders`LEFT JOIN `product_details` AS `ProductDetail` ON ( `orders`.`product_detail_id` = `ProductDetail`.`id` )WHERE `ProductDetail`.`new_or_used` = "New" GROUP BY...

3 answers

0 votes

Asked by dimis283, on 19/2/10 in

model->find()

I want to ask soemthing simple that I did not find at manual.

I want at model->find('list',array()) to write which exactly field will return of the table.

How can I do that?

1 answer

0 votes

Asked by ssalvatori, on 22/2/10 in

find deep relationship using cakephp's way

Hi i looking for the correct cakephp's way to this

This are my models

Area hasMany Poll

Poll hasMany Answer

Institution hasMany Answer

Now i need show the Answer group by Poll and Area by a year and and

for institutions

the output is some like...

1 answer

0 votes

Asked by bottomless, on 6/3/10 in

Complex find condition query encapsulating values in single quotes

Hi,

I'm moving a mysql query from 1.1 to 1.3-RC1


 $conditions = array("OR" => array(
      'Item.expiration'       => 0,
      'Item.expiration >'     => "NOW()"
    )
 );
 $params = array(
   'conditions'    => $conditions
);
 $items =...

1 answer

0 votes

Asked by Lobosque, on 14/3/10 in

HABTM association and find

In my application, Blogs HABTM Tags. I want to select items that has blog.name LIKE = "one" OR blog.owner LIKE = "two" OR tag.name LIKE = "three".

For some reason it is selecting wrongly, it is not selecting when the blog.name or blog.owner...

1 answer

0 votes

Asked by ion, on 20/3/10 in

Cakephp, Retreive Data for HABTM Models using find

I am new to cakephp and I'm trying to accomplish something that should be relatively easy. I have 2 models projects & categories bind by HABTM relationship.

I am trying to perform the following query - find all projects that belong to a...

<< previous 1   2   3