Questions tagged with condition

1 answer

0 votes

Asked by kewuin, on 11/6/10 in

Peut-on donner une condition par défaut sur un modèle ?

salut,

Je n'ai pas trouvé comment faire pour ajouter une conditions par défaut sur un modèle (plus exactement pour les tous find() qu'on fera par la suite dessus ), un peu comme l'attribut $order = "nom_du_champ ASC".

Sinon je sais qu'on peut déjà...

0 answers

0 votes

Asked by saeed, 4 days, 11 hours ago in

Pagination.

Hi all,

I am stuck on pagination. I am trying to paginate feePayment records based on certain criteria.

feePayments belongs to Students which in turn belongs YearGroups.

I want to paginate 'unpaid' feePayments for each year group. The problem I am...

1 answer

0 votes

Asked by revohshalf, 3 weeks, 2 days ago in

View content depending on a variable set in Controller

Hi there,

I don't know how to this in a cakish and clean way :)

I do some processing in foo() action in a controller Bar.

I set some variables to echo them in the foo.ctp view.


function foo() {
  ...
  some processing
  ...
 ...

3 answers

0 votes

Asked by jamesl, on 11/3/10 in

conditional add

Is it possible to add a condition to the add and update methods?

for example could you add a condition to check that a field value that is about to be added doesnt already exist in the table?

thanks.

1 answer

0 votes

Asked by fly2279, on 10/5/10 in

model conditions

I am trying to set conditions on relationships in a model to better filter records returned in finds. If I specify conditions on which users are returned in a $this-Post-find('list) call I'm still getting all the records returned instead of the...

2 answers

0 votes

Asked by wesert, on 2/3/10 in

multiple LIKE conditions

Hello!

Could you, please, tell me if it is possible to query model table with multiple LIKEs?

I need something like that:

select FirstName, LastName from users

where (FirstName LIKE '%a' OR FirstName LIKE '%b' OR FirstName LIKE '%c')

AND (LastName...

0 answers

0 votes

Asked by agphoto, on 24/4/10 in

OR conditions array in find cakephp sql query

Hello,

Cake Version using: 1.2.5 stable

about: OR and multiple and conditions in find query

Query:

$conditions = array("Event.status" = 1 ,

"OR" = array('Event.eventstartdate <=' = $startDate1,

'Event.eventstartdate <=' = $startDate2 ) ,

"OR" =...

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

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 Calimer0, on 17/2/10 in

CakePHP paginate conditions in derived fields how?

Hello, i would like to paginate a list of games, where the sport is a chosen sport.

the relatition is as followed:

Game BelongsTo Competition BelongsTo Team BelongsTo sport

What i would like to do is show all games where the teams sport_id = 1.

The...

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...

<< previous next >>