Re: Newbie - multiple model instances in one form and validation

2008-12-24 Thread Nature Lover

Hi!

Thanks for the help!

Got it resolved.

Actually the fault was mine. I was validating the foreign key user_id
in both child models UserProfile and UserContact.
Thats why the
saveAll($this->data, array('validate' => 'only'))
or
saveAll($this->data, array('validate' => 'first'))

was failing.

Now removed the validation for user_id in both models and got it work.
Currently first validating using

saveAll($this->data, array('validate' => 'only'))

And then saving as

saveAll($this->data, array('validate' => false))

Thanks and regards!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Updating multiple models

2008-12-24 Thread Steven Wright

Ahh I figured out thanks to teknoid. I had forgotten to put the ID of the
recipe in a hidden field in the edit form. Check out this excellent post
from teknoid.

http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-work
ing-with-multiple-models/#comment-909

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of rhythmicde...@gmail.com
Sent: Wednesday, December 24, 2008 1:20 PM
To: CakePHP
Subject: Updating multiple models


This post should be called so close yet so far.

I am having an issue with saveAll() in my edit method which I am hoping you
can help me with. For some reason that I cant determine it's creating new
records in both tables instead up updating them. I am sure it's something
goofy that I have missed. I would expect from what I have read http://teknoid.wordpress.com/2008/08/01/
practical-use-of-saveall-part-1-working-with-multiple-models/
#comment-907">here that saveAll would update not insert the records.

class Recipe extends AppModel
{
var $hasMany= array('IngredientList');
}

class IngredientList extends AppModel
{
var $belongsTo = array('Recipe');
}

function edit($id = null)
{
$this->Recipe->id = $id;
$this->set_recipe_types();
$this->set_ingredients();
$this->set_measurement_types();

$this->set('ingredient_list',
$this->IngredientList->find('all',
array ('recipe_id' => $id)));

if (empty($this->data))
{
$this->data = $this->Recipe->read();
}
else
{
if ($this->Recipe->saveAll($this->data))
{
$this->flash('Your recipe has been
updated.','/recipes');
}
}
}

Thanks for any advice you can give.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: paginate using named parameters

2008-12-24 Thread Jay Reeder
You can also include this in the view before using the paginator helper
functions:

$paginator->options(array('url' => $this->passedArgs));

The above line will tell paginator to create URL's that have the same named
parameters as the page you're currently on.

On Tue, Dec 23, 2008 at 8:59 PM, kai  wrote:

>
> Here is some code: http://bin.cakephp.org/view/1242618351
> Also, i'm trying my best to learn so if anyone has any tips to make
> the code better it would help me a lot.
>
> On Dec 23, 5:49 pm, kai  wrote:
> > i have a habtm pagination query which constructs the correct sql but
> > when i change pages or sort then $this->data and its conditions are
> > lost.
> >
> > i've found that the two options i have for pagination to work
> > completely is to use sessions or named parameters. i'm hoping to use
> > named parameters but i'm not sure how in this case. i do something
> > like $this->passedArgs['parameters'][$value] = $value; where $value is
> > drawn from $this->data and when i use pr($this->passedArgs);
> > everything seems to be in place but how does this become part of the
> > URL? How does the URL consisting of named parameters remain intact
> > going from page to page?
> >
> > i've been at this all day and need a break, hoping someone can send
> > some wisdom. really, i just want this to work so i'm open to any
> > information regarding the use of sessions too. ideally i'd like to
> > learn how to do it both ways :)
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Updating multiple models

2008-12-24 Thread rhythmicde...@gmail.com

This post should be called so close yet so far.

I am having an issue with saveAll() in my edit method which I am
hoping you can help me with. For some reason that I cant determine
it's creating new records in both tables instead up updating them. I
am sure it's something goofy that I have missed. I would expect from
what I have read http://teknoid.wordpress.com/2008/08/01/
practical-use-of-saveall-part-1-working-with-multiple-models/
#comment-907">here that saveAll would update not insert the
records.

class Recipe extends AppModel
{
var $hasMany= array('IngredientList');
}

class IngredientList extends AppModel
{
var $belongsTo = array('Recipe');
}

function edit($id = null)
{
$this->Recipe->id = $id;
$this->set_recipe_types();
$this->set_ingredients();
$this->set_measurement_types();

$this->set('ingredient_list', $this->IngredientList->find('all',
array ('recipe_id' => $id)));

if (empty($this->data))
{
$this->data = $this->Recipe->read();
}
else
{
if ($this->Recipe->saveAll($this->data))
{
$this->flash('Your recipe has been 
updated.','/recipes');
}
}
}

Thanks for any advice you can give.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



[RC4] parseExtension and 404 throwing

2008-12-24 Thread Jne

Hi,

on my website I have a 'movie_comments' controller and a feed($id)
action.

With RC3 :
http://sph3re.tv/movie_comments/feed/151.rss is outputting the proper
RSS feed
http://sph3re.tv/movies/mainfeed.rss also

With RC4 (caching disabled)
http://sph3re.tv/movie_comments/feed/151.rss is throwing a 404 error
but http://sph3re.tv/movies/mainfeed.rss still works

On my routes.php I have the following line :Router::parseExtensions
('rss', 'xml');


Any idea why this has changed between the two releases ?

Thanks !

Jérôme
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



installation of cakephp

2008-12-24 Thread mona

when we install cakephp then in httpd.conf of apache where we find
Addmodule mod_rewrite.c. this is for unix os because i m using windows
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Saving Multiple Models in one save

2008-12-24 Thread Steven Wright

Thank you thank you. That was exactly what I was looking for.


 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Adriano Varoli Piazza
Sent: Wednesday, December 24, 2008 8:05 AM
To: CakePHP
Subject: Re: Saving Multiple Models in one save


On 24 dic, 10:32, Steven Wright  wrote:
> What does the 0 do?

Make it work :)
Seriously, you can add multiple items in this fashion, such as
Patrimonio.1.tipo, Patrimonio.2.tipo, etc., and they'll be saved in sequence
from a single form.

However, I doubt that this is the problem, I suspect more of an error in the
definition of relationships between the models involved.

For more meat, try this:
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-work
ing-with-multiple-models/
--
Saludos,
Adriano


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cms in cake php

2008-12-24 Thread mona

I have to make cms using cakephp and in that cms i have to increment a
count every time when new content add in cms for that first i have to
make login script can anybody tell me how to make login script in php
and i want that when i type address it should open my login page not
index page and also i want to remove cakephp framework tag from my
pages everytime i create new pages i will display a logo of cakephp
can anybody tell me how to remove this logo and do all that things
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Saving Multiple Models in one save

2008-12-24 Thread Steven Wright

Thank you very much.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Adriano Varoli Piazza
Sent: Wednesday, December 24, 2008 8:05 AM
To: CakePHP
Subject: Re: Saving Multiple Models in one save


On 24 dic, 10:32, Steven Wright  wrote:
> What does the 0 do?

Make it work :)
Seriously, you can add multiple items in this fashion, such as
Patrimonio.1.tipo, Patrimonio.2.tipo, etc., and they'll be saved in sequence
from a single form.

However, I doubt that this is the problem, I suspect more of an error in the
definition of relationships between the models involved.

For more meat, try this:
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-work
ing-with-multiple-models/
--
Saludos,
Adriano


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Find Topic with highest number of Comments

2008-12-24 Thread dr. Hannibal Lecter

I have used this bit of code in my model..It's probably not the best
way, but it works for me:

function getMostCommented($limit)
{
$commentsCount = $this->Comment->find
(
'all',
array
(
'fields' => array('article_id', 
'count(*) as count'),
'conditions' => '1 = 1 GROUP BY 
article_id',
'order' => 'count DESC',
'recursive' => -1,
'limit' => $limit
)
);

$articles = array();

foreach ($commentsCount as $comment)
{
$articles = array_merge
(
$articles,
$this->find
(
'all',
array
(
'conditions' => 
array('id' => $comment['Comment']
['article_id']),
'fields' => array
(
'id',
'title',
'slug'
),
'recursive' => -1
)
)
);
}

return $articles;
}

This would return the top $limit article with most comments.

On Dec 24, 2:14 pm, Fahad  wrote:
> hi,
>
> i am developing a forum application in cakephp. and need to find a
> list of 5 popular topics (threads). popularity is based on the number
> of Comment each Topic has.
>
> is it possible to find popular Topics using cake models only? or do I
> have to use custom SQL query for this?
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Weird Error With ACL

2008-12-24 Thread Christian

Hi,

I'm trying to use ACL in my application, I have pretty much followed
this tutorial http://book.cakephp.org/view/641/Simple-Acl-controlled-Application
to get my application up and running, however, when I visit any of the
pages that are supposed to be protected, I get this error:

Warning (512): AclNode::node() - Couldn't find Aro node identified by
"Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 1
)
" [CORE/cake/libs/model/db_acl.php, line 191]

Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in
permissions check.  Node references:
Aro: Array
(
[User] => Array
(
[id] => 1
[group_id] => 1
[username] => csueiras
[email] => csuei...@gmail.com
[fullname] => Christian A. Sueiras Figueroa
[contact_phone] => 787-348-8032
[created] => 2008-12-18 16:34:07
)

)

Any help will be greatly appreciated. Thanks and happy holidays!

Christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Thoughts on this blog post?

2008-12-24 Thread villas

Looks like he's changing his mind...
http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Find Topic with highest number of Comments

2008-12-24 Thread Fahad

hi,

i am developing a forum application in cakephp. and need to find a
list of 5 popular topics (threads). popularity is based on the number
of Comment each Topic has.

is it possible to find popular Topics using cake models only? or do I
have to use custom SQL query for this?

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting related data

2008-12-24 Thread dr. Hannibal Lecter

You should probably change this:

$this->set('ingredient_list', $this->IngredientList->find('WHERE
recipe_id = ' . $id));

to something like this:

$this->set('ingredient_list', $this->IngredientList->find('all', array
('recipe_id' => $id));

And then see what happens. Also, I don't see where are you using
$ingredient_list in your view?

On Dec 24, 1:31 pm, "rhythmicde...@gmail.com"
 wrote:
> I have recipes and I have ingredient_lists. A single recipe has many
> entries in the ingredient_lists table. When I pull back the recipe I
> want to get it's ingredient_list but I cant see quite how to do it.
>
> This is the 'edit' action of the RecipesController:
>
>         function edit($id = null)
>         {
>                 $this->Recipe->id = $id;
>                 $this->set_recipe_types();
>                 $this->set_ingredients();
>                 $this->set_measurement_types();
>
>                 $this->set('ingredient_list', 
> $this->IngredientList->find('WHERE
> recipe_id = ' . $id));
>
>                 if (empty($this->data))
>                 {
>                         $this->data = $this->Recipe->read();
>                 }
>                 else
>                 {
>                         if ($this->Recipe->save($this->data))
>                         {
>                                 $this->flash('Your recipe has been 
> updated.','/recipes');
>                         }
>                 }
>         }
>
> The line that sets the 'ingredient_list' var only pulls back a single
> record because of the limit clause. How do I pull back all the
> records? Here is the query for ingredient_list
>
> SELECT `IngredientList`.`recipe_id`, `IngredientList`.`ingredient_id`,
> `IngredientList`.`amount`, `IngredientList`.`measurement_type_id`,
> `IngredientList`.`description`, `IngredientList`.`created`,
> `IngredientList`.`modified` FROM `ingredient_lists` AS
> `IngredientList` WHERE recipe_id = 17 LIMIT 1
>
> Here are all the queries run for the edit page:'
>
> DESCRIBE `recipes`
> DESCRIBE `recipe_types`
> DESCRIBE `ingredients`
> DESCRIBE `measurement_types`
> DESCRIBE `ingredient_lists`
>
> SELECT `RecipeType`.`id`, `RecipeType`.`recipe_type` FROM
> `recipe_types` AS `RecipeType` WHERE 1 = 1 ORDER BY
> `RecipeType`.`recipe_type` ASC
>
> SELECT `Ingredient`.`id`, `Ingredient`.`ingredient` FROM `ingredients`
> AS `Ingredient` WHERE 1 = 1 ORDER BY `ingredient` ASC
>
> SELECT `MeasurementType`.`id`, `MeasurementType`.`measurement_type`
> FROM `measurement_types` AS `MeasurementType` WHERE 1 = 1 ORDER BY
> `measurement_type` ASC
>
> SELECT `IngredientList`.`recipe_id`, `IngredientList`.`ingredient_id`,
> `IngredientList`.`amount`, `IngredientList`.`measurement_type_id`,
> `IngredientList`.`description`, `IngredientList`.`created`,
> `IngredientList`.`modified` FROM `ingredient_lists` AS
> `IngredientList` WHERE recipe_id = 17 LIMIT 1
>
> SELECT `Recipe`.`id`, `Recipe`.`recipe`, `Recipe`.`description`,
> `Recipe`.`instructions`, `Recipe`.`servings`,
> `Recipe`.`recipe_type_id`, `Recipe`.`created`, `Recipe`.`modified`
> FROM `recipes` AS `Recipe` WHERE `Recipe`.`id` = '17' LIMIT 1
>
> Here is the edit view
>
> Edit Recipe
>  echo $form->create('Recipe', array('action' => 'edit'));
> echo $form->input('Recipe.recipe');
> echo $form->input('Recipe.servings', array('maxlength' => 5, 'size' =>
> 5));
> echo $form->label('Recipe.servings', 'Recipe Type');
> echo $form->select('Recipe.recipe_type_id', $recipe_types);
> ?>
> 
> Ingredient List
>
> 
>         
>                 input('IngredientList.amount'); ?>
>                                          echo 
> $form->label('IngredientList.measurement_type_id',
> 'Measurement Type');
>                         echo 
> $form->select('IngredientList.measurement_type_id',
> $measurement_types);
>                         ?>
>                 input('IngredientList.description'); 
> ?>
>                                          echo $form->label('IngredientList.ingredient_id', 
> 'Ingredient');
>                         echo $form->select('IngredientList.ingredient_id', 
> $ingredients);
>
>                         ?>
>         
> 
>
> Instructions and Description
>  echo $form->input('Recipe.description', array('rows' => '3'));
> echo $form->input('Recipe.instructions', array('rows' => '3'));
> echo $form->end('Save Recipe');
> ?>
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving Multiple Models in one save

2008-12-24 Thread Adriano Varoli Piazza

On 24 dic, 10:32, Steven Wright  wrote:
> What does the 0 do?

Make it work :)
Seriously, you can add multiple items in this fashion, such as
Patrimonio.1.tipo, Patrimonio.2.tipo, etc., and they'll be saved in
sequence from a single form.

However, I doubt that this is the problem, I suspect more of an error
in the definition of relationships between the models involved.

For more meat, try this:
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/
--
Saludos,
Adriano
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Thoughts on this blog post?

2008-12-24 Thread keymaster

http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Saving Multiple Models in one save

2008-12-24 Thread Steven Wright

What does the 0 do?


 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Adriano Varoli Piazza
Sent: Wednesday, December 24, 2008 7:26 AM
To: CakePHP
Subject: Re: Saving Multiple Models in one save


In a similar situation, my add view looks like this:

echo $form->label('Patrimonio.0.tipo', 'Label text:'); echo
$form->text('Patrimonio.0.tipo');

Notice the 0.

--
Saludos,
Adriano



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Getting related data

2008-12-24 Thread rhythmicde...@gmail.com

I have recipes and I have ingredient_lists. A single recipe has many
entries in the ingredient_lists table. When I pull back the recipe I
want to get it's ingredient_list but I cant see quite how to do it.

This is the 'edit' action of the RecipesController:

function edit($id = null)
{
$this->Recipe->id = $id;
$this->set_recipe_types();
$this->set_ingredients();
$this->set_measurement_types();

$this->set('ingredient_list', $this->IngredientList->find('WHERE
recipe_id = ' . $id));

if (empty($this->data))
{
$this->data = $this->Recipe->read();
}
else
{
if ($this->Recipe->save($this->data))
{
$this->flash('Your recipe has been 
updated.','/recipes');
}
}
}

The line that sets the 'ingredient_list' var only pulls back a single
record because of the limit clause. How do I pull back all the
records? Here is the query for ingredient_list

SELECT `IngredientList`.`recipe_id`, `IngredientList`.`ingredient_id`,
`IngredientList`.`amount`, `IngredientList`.`measurement_type_id`,
`IngredientList`.`description`, `IngredientList`.`created`,
`IngredientList`.`modified` FROM `ingredient_lists` AS
`IngredientList` WHERE recipe_id = 17 LIMIT 1



Here are all the queries run for the edit page:'

DESCRIBE `recipes`
DESCRIBE `recipe_types`
DESCRIBE `ingredients`
DESCRIBE `measurement_types`
DESCRIBE `ingredient_lists`

SELECT `RecipeType`.`id`, `RecipeType`.`recipe_type` FROM
`recipe_types` AS `RecipeType` WHERE 1 = 1 ORDER BY
`RecipeType`.`recipe_type` ASC

SELECT `Ingredient`.`id`, `Ingredient`.`ingredient` FROM `ingredients`
AS `Ingredient` WHERE 1 = 1 ORDER BY `ingredient` ASC

SELECT `MeasurementType`.`id`, `MeasurementType`.`measurement_type`
FROM `measurement_types` AS `MeasurementType` WHERE 1 = 1 ORDER BY
`measurement_type` ASC

SELECT `IngredientList`.`recipe_id`, `IngredientList`.`ingredient_id`,
`IngredientList`.`amount`, `IngredientList`.`measurement_type_id`,
`IngredientList`.`description`, `IngredientList`.`created`,
`IngredientList`.`modified` FROM `ingredient_lists` AS
`IngredientList` WHERE recipe_id = 17 LIMIT 1

SELECT `Recipe`.`id`, `Recipe`.`recipe`, `Recipe`.`description`,
`Recipe`.`instructions`, `Recipe`.`servings`,
`Recipe`.`recipe_type_id`, `Recipe`.`created`, `Recipe`.`modified`
FROM `recipes` AS `Recipe` WHERE `Recipe`.`id` = '17' LIMIT 1


Here is the edit view


Edit Recipe
create('Recipe', array('action' => 'edit'));
echo $form->input('Recipe.recipe');
echo $form->input('Recipe.servings', array('maxlength' => 5, 'size' =>
5));
echo $form->label('Recipe.servings', 'Recipe Type');
echo $form->select('Recipe.recipe_type_id', $recipe_types);
?>

Ingredient List



input('IngredientList.amount'); ?>
label('IngredientList.measurement_type_id',
'Measurement Type');
echo $form->select('IngredientList.measurement_type_id',
$measurement_types);
?>
input('IngredientList.description'); 
?>
label('IngredientList.ingredient_id', 
'Ingredient');
echo $form->select('IngredientList.ingredient_id', 
$ingredients);

?>



Instructions and Description
input('Recipe.description', array('rows' => '3'));
echo $form->input('Recipe.instructions', array('rows' => '3'));
echo $form->end('Save Recipe');
?>


Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving Multiple Models in one save

2008-12-24 Thread Adriano Varoli Piazza

In a similar situation, my add view looks like this:

echo $form->label('Patrimonio.0.tipo', 'Label text:');
echo $form->text('Patrimonio.0.tipo');

Notice the 0.

--
Saludos,
Adriano

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: custom SQL query - all values IN() bust be AND

2008-12-24 Thread Smelly_Eddie

dev if thats the case than my last post should asswer your questions.

On Dec 24, 3:35 am, dev  wrote:
> I will give an example:
>
> Advert hasMany Option
> I need to find Adverts, where its Options are 3 and 4 values. When
> using IN, it will return results with 3, or, 4, or both 3 and 4. But i
> want only with both values.
>
> Like:
> [0] => Array
>         (
>             [Advert] => Array
>                 (
>                     [id] => 2
>                     [code] => 54
>                     [created] => 2008-12-19 11:17:30
>                 )
>
>             [Option] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 1
>                             [advert_id] => 2
>                             [option] => 3
>                         )
>                     [1] => Array
>                         (
>                             [id] => 2
>                             [advert_id] => 2
>                             [option] => 4
>                         )
>
>                 )
>
>         )
>
> On Dec 24, 12:35 am, Smelly_Eddie  wrote:
>
> > How can the same field have multiple values?
> > -it can be = '3'
> > -it can be= '4''
>
> > Otherwise maybe your are just concatenating multiple variables into
> > one, e.g.;
> > -it can be='3,4'
> > which probably should be evaluated for best practices..
>
> > You would not use IN in such a case.
>
> > If the are always ordered numerically you might use;
> > AND options.option like '%3,4%'
> > (assuming there are higher or lower values (2,..,5))
>
> > If they are not always order and could be 4,3 or 4,5,3 then you might
> > try;
> > AND options.option like '%3%' AND options.option like '%4%
>
> > On Dec 22, 11:21 am, dev  wrote:
>
> > > i'm building custom SQl query and need a little help.
>
> > > query:
> > > select distinct adverts.id, adverts.code from adverts left join images
> > > on (images.advert_id = adverts.id) left join options on
> > > (options.advert_id = adverts.id) where (SELECT count(1) FROM images
> > > WHERE adverts.id = images.advert_id) > 0 AND options.option IN (3, 4);
>
> > > but i want to get all Advert records, where options.option has all
> > > these values (3,4). When i'm using IN(), these values are with OR
> > > operator, how to set AND?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Finding content from multiple tables being referred

2008-12-24 Thread Nature Lover

Hi!

Thanks for the help!

I got it resolved using If in MySQL query as condition

$condition = 'IF(((select count(*) from '.$Table.' where
language_code="'.$this->Session->read('Site.Language').'" and '.
$ReferKey.'='.$Model.'.'.$ReferKey.')>0), language_code="'.$this-
>Session->read('Site.Language').'", language_code=(select code from
languages where base=1))';

in

$countrytranslations=$this->User->UserAddress->Country-
>CountryTranslation->find('list',array('conditions'=>array
($condition),'fields'=>array
('CountryTranslation.country_iso2','CountryTranslation.name'),'group'=>array
('CountryTranslation.country_iso2'),'order'=>array
('CountryTranslation.name')));

Regards!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie - multiple model instances in one form and validation

2008-12-24 Thread Nature Lover

Hi!

I haven't used the form helper instead created form using bare html to
decrease the server load.

The form used can be referred over here

http://prowebdesignsolutions.com/refer/

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie - multiple model instances in one form and validation

2008-12-24 Thread sijo jose
Hi ,

If the model associations are correct and the for is created using User
just user

$this->User->saveAll($this->data,array('validation'=>'first'))

will validate all the Models, well as I said the model associations must be
perfect.

Regards
Sijo Jose C

On Wed, Dec 24, 2008 at 4:25 PM, Nature Lover
wrote:

>
> Hi!
>
> I am new to CakePHP and currently working on an e-commerce site having
> three models:
>
> User( id, name, joined)
> UserProfile( id, user_id, title, age, email )
> UserContacts( id, user_id, name, address)
>
> Currently receiving data from a form as below:
>
> $this->data['User']['name']
> $this->data['UserProfile']['title']
> $this->data['UserProfile']['age']
> $this->data['UserProfile']['email']
> $this->data['UserContact']['0']['name']
> $this->data['UserContact']['0']['address']
> $this->data['UserContact']['1']['name']
> $this->data['UserContact']['1']['address']
>
> tried to validate data in User controller as:
>
> $this->User->set($this->data);
> $this->User->UserProfile->set($this->data);
> $this->User->UserContact->set($this->data);
>
> if($this->User->validates())
> {
>if($this->User->UserProfile->validates())
>{
>if($this->User->UserContact->validates())
>{
>$this->set('status','valid');
>}
>}
> }
> else
> {$this->set('status','invalid');}
>
> Here proper validation fails for UserContacts although showing errors
> as
> $this->validationErrors['UserContact']['fieldname']
> instead of
> $this->validationErrors['UserContact']['0']['fieldname'] and
> $this->validationErrors['UserContact']['1']['fieldname']
>
> Also tried to use saveAll with validate=only, but failed due to
> foreign key constrains as getting error:
>
> 'This field cannot be left blank'
> for
> $this->validationErrors['UserProfile']['user_id'] and
> $this->validationErrors['UserContact']['0']['user_id']
> $this->validationErrors['UserContact']['1']['user_id']
>
> Please help me to get out of this hurdle.
>
> Thanks!
> >
>


-- 
Sijo Jose Chakramakkil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Newbie - multiple model instances in one form and validation

2008-12-24 Thread Nature Lover

Hi!

I am new to CakePHP and currently working on an e-commerce site having
three models:

User( id, name, joined)
UserProfile( id, user_id, title, age, email )
UserContacts( id, user_id, name, address)

Currently receiving data from a form as below:

$this->data['User']['name']
$this->data['UserProfile']['title']
$this->data['UserProfile']['age']
$this->data['UserProfile']['email']
$this->data['UserContact']['0']['name']
$this->data['UserContact']['0']['address']
$this->data['UserContact']['1']['name']
$this->data['UserContact']['1']['address']

tried to validate data in User controller as:

$this->User->set($this->data);
$this->User->UserProfile->set($this->data);
$this->User->UserContact->set($this->data);

if($this->User->validates())
{
if($this->User->UserProfile->validates())
{
if($this->User->UserContact->validates())
{
$this->set('status','valid');
}
}
}
else
{$this->set('status','invalid');}

Here proper validation fails for UserContacts although showing errors
as
$this->validationErrors['UserContact']['fieldname']
instead of
$this->validationErrors['UserContact']['0']['fieldname'] and
$this->validationErrors['UserContact']['1']['fieldname']

Also tried to use saveAll with validate=only, but failed due to
foreign key constrains as getting error:

'This field cannot be left blank'
for
$this->validationErrors['UserProfile']['user_id'] and
$this->validationErrors['UserContact']['0']['user_id']
$this->validationErrors['UserContact']['1']['user_id']

Please help me to get out of this hurdle.

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving Multiple Models in one save

2008-12-24 Thread sijo jose
Well sorry for not being prompt,

Presently cakePHP supports saving models upto level one only.
So I have changed my code accordingly.
Thanks for your reply which was helpfull.

Regards
Sijo

On Wed, Dec 10, 2008 at 2:52 PM, WebbedIT  wrote:

>
> I haven't gotten around to using saveAll() as yet, but I did spot that
> you haven't created a belongsTo relation from SamplingDetail to
> Intimation to close the hasOne/belongsTo relationship between the two
> models.
>
> Similarly best practice dictates you should create hasOne
> relationships for
>
> Processor->SamplingDetail
> Contact->Processor
>
> Not that I think this will necessarily solve your saleAll issue but it
> is good practice to do so.
>
> Without using the saveAll function myserlf I can only hazard guesses
> at what you can look at.  I tried looking for a recursive property to
> try and tell the function to go more than 1 level deep, but that
> doesn't exist.  What happens if you change the fields from
>
> input('SamplingDetail.package_description'); ?>
> input('SamplingDetail.lot_number'); ?>
> input('SamplingDetail.invoice_number'); ?>
> input
> ('SamplingDetail.Processor.Contact.firstName'); ?>
> input
> ('SamplingDetail.Processor.Contact.address'); ?>
>
> to
>
>  input('SamplingDetail.package_description'); ?>
>  input('SamplingDetail.lot_number'); ?>
>  input('SamplingDetail.invoice_number'); ?>
>  input
> ('Contact.firstName'); ?>
>  input
> ('Contact.address'); ?>
>
> The fact that Intimation model fields will save from
>
>  input('Intimiation.field1'); ?>
>
> And SamplingDetail fields will save from
>
>  input('SamplingDetail.field2'); ?>
>
> Means other related fields should save from
>
>  input('Processor.field3'); ?>
>  input('Contact.field4'); ?>
>
> Hopefully someone else can join in and clear this up ;)
> >
>


-- 
Sijo Jose Chakramakkil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: A table with average & total row

2008-12-24 Thread Dr. Tarique Sani

On Tue, Dec 23, 2008 at 11:01 PM, mathie  wrote:
>
> Hello,
>
> This is a design question on MVC separation. Say I need to display a
> table with many rows, then a total and an average row. Should the
> calculation of this total/average be done in the view (in the loop) or
> in the controller (after getting the rows from DB)?
>
> A related question. For an invoice: $amount = $price * $quantity;
> Could that be in the view or not?
>

Ask yourself the question - are you just going to display it OR you
will be doing something more (eg: save for a report) with it?


Display only == View

HTH

Tarique


-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Developers in Chennai, TamilNadu, India?

2008-12-24 Thread sijo jose
Yah i have been working for past 4 months.

Regards
Sijo

On Thu, Dec 11, 2008 at 11:15 PM, ravindranathbe
wrote:

>
> Hi
> I am Ravindranath. Experienced in CakePHP for the past 10 months.
> Able to create highly professional, high quality website on Cakephp.
> You can contact me thro,
> 1. email - ravindranat...@gmail.com
> 2. mobile - 9380567762
>
> Regards,
>
> Ravindranath.
>
> On Nov 5, 11:04 am, Selva  wrote:
> > Hello Guys,
> >
> > I apologize in advance if this is not the appropriate forum to ask
> > this question, but I am interested in finding a Cake Developer to work
> > on a new project.
> >
> > Thanks,
> > Selva
>
> >
>


-- 
Sijo Jose Chakramakkil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: form helper -> inputs -> textarea -> cols?

2008-12-24 Thread sijo jose
Hey why cant u try the $form->input option.

Its quiet easy.

input('SamplingDetail.sampling_address',
array('error'=>'Sampling Address cannot be left empty','div' =>
'mandatory','type'=>'textarea','label' => 'Sampling Address', 'rows' => 3,
'cols' => 35)); ?>

Regards
Sijo

On Fri, Dec 12, 2008 at 7:31 PM, leberle  wrote:

>
> hi all :) one simple (i guess) question: i'm using the inputs method
> for creating several input-elements in my view. i want one field to be
> a textarea, i used
>
> $html->inputs(
>[...bunchofotherinputs],
>'mytextfield' => array('type' => 'textarea', 'cols' => 2),
>[...]);
>
> The generated input gets the textarea-option but fails to get the
> number of cols i definied...so i got a textarea thats way to largs.
> Someone can help me with that?
> >
>


-- 
Sijo Jose Chakramakkil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Error Messages Not Displaying in View or in Validations Array

2008-12-24 Thread sijo jose
hi,

As earlier said u are sending the form data to a
different page...

function thank_you()
  {

> if( !empty($this->data) )
>   {
>  $this->User->create();
>  if( $this->User->save($this->data) )
>  {
>  }
> else
> {
>  $this->redirect(array('action' => 'index'),null,true);
> }
>   }
>   else
>   {
>  // we're at this place because a form was not filled in
>  $this->redirect(array('action' => 'index'),null,true);
>   }
>  }


Now in cakePHP the validation works when u call save.
so if  if( $this->User->save($this->data) ) is false it means that ur form
has errors

So what u r doing is that u are redirecting the page when there are form
erros.
So give any redirect page in the else condition it will automatically come
to ur form page.

Also there is no need for $this->User->create();

Think u got the point.

Regards
Sijo Jose C







On Fri, Dec 19, 2008 at 7:24 PM, Smelly_Eddie  wrote:

> Just a guess but it looks like your sending the form data to a
> different page...
>
> Validation was intended to display on the same model in a circular
> manner. i.e. empty user/add form is shown -> data submitted to user/
> add action -> user/add validates data -> form is repeated if invalid
> OR redirect user to secondary page.
>
>
>
>
> On Dec 18, 3:51 pm, Tony  wrote:
> > For some reason I can't get my error messages for validations to work.
> > I tried outputting the validations by doing:
> > pr($this->validationErrors);
> >
> > But all I get is an empty array. What do you guys see that I'm doing
> > wrong?
> >
> > Thanks,
> > Tony
> >
> > Here's my model:
> > 
> > class User extends AppModel {
> >
> > var $name = 'User';
> >
> > // This model is a self-join
> > var $belongsTo  =   array(
> >
> 'ParentMember' => array(
> >
>   'className' => 'User',
> >
>   'foreignKey' => 'parent_id'),
> > );
> >
> > var $hasMany=   array(
> >
> 'ChildMember' => array(
> >
>   'className' => 'User',
> >
>   'foreignKey' => 'parent_id'),
> > );
> >
> >// Place the validation rules here:
> >
> >var  $validate = array(
> > 'first_name' => array(
> > 'rule' => 'alphaNumeric',
> > 'required' => true,
> > 'message' => 'Name is required. Please
> enter your first name.',
> > 'last' => true
> > ),
> > 'email' => array(
> > 'rule' => array('email', true),
> > 'required' => true,
> > 'message' => 'Email is required. Please
> enter your email
> > address.',
> > 'last' => true
> > ),
> > 'phone' => array(
> > 'rule' => array('phone', null, 'us'),
> > 'message' => 'Phone number is not valid.
> Please enter valid phone
> > number.',
> > 'last' => true
> > )
> >);
> >
> > }
> >
> > 
> >
> > Here's my controller with the method action it's being submitted to:
> > 
> > function thank_you()
> > {
> > $member = $this->Session->read('teamMember');
> > $this->set('pageTitle', 'Before you leave TriVita
> Cooperative
> > Marketing\'s website');
> > $this->set('bigTitle', 'BEFORE YOU LEAVEA SPECIAL THANK
> > YOU FROM ME...');
> > $this->set('member', $member);
> >
> > if( !empty($this->data) )
> > {
> >
> > $this->User->create();
> >
> > if( $this->User->save($this->data) )
> > {
> >
> > $tony = $this->User->findByAffiliateNumber
> > ('11167706');
> >
> > $prospect =
> $this->User->findById($this->User->id);
> >
> > $this->set('prospectName', $prospect['User']
> > ['first_name']);
> > $this->set('tonyEmail', $tony);
> >
> > if( $prospect['User']['email'] != '' ||
> $prospect['User']
> > ['email'] != null )
> > {
> >
> $this->_sendThankYouEmail($prospect, $member);
> > }
> > /*
> > if( $member['User']['affiliate_number']
> != '11167706')
> > {
> >
> $this->_sendMemberNotificationEmail($prospect, $member, $tony);
> > }
> > */
> >
> $this->_sendMemberNotificationEmail($prospect, $mem

Bulk or Mass Email in CakePHP

2008-12-24 Thread Ammad

I want to send out 1000's of emails in CakePHP and I am using PHP
Mailer with it. I would like you people to share you thoughts on is:

What I should do?
Whats the best solution in your view?
What to do in case of script time out errors?

Thanks and regards,
Muhammad Ammad Saleem
BS (Computer Science)
University of Karachi
Pakistan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to validate 2 linked models created from one form?

2008-12-24 Thread sijo jose
Hi,

Since u have created the form for the model Order,

The field title should be referred like

$form->input("Customer.title"); directly.

Now when u r saving use saveAll

$this->Order->saveAll($this->data,array('validate' => 'first'));

All the validation rules can be in ur model itself.

The array('validate' => 'first') specifies that all the models must be
validated first before saving recursively.

Also u have to take into consideration that at present cakePHP supports
recursive saving  for first level only.

Think I was helpful.
Regards
Sijo

On Mon, Dec 22, 2008 at 2:42 PM, Hipnotik  wrote:

>
> Hello again ;)
> I have 2 models:
>
> Order:
> hasOne = "Customer"
>
> Customer:
> belongsTo = "Order"
> var $validate = array(lot of rules)
>
> I would like to create a form to provide data for Customer object then
> send form to OrdersController and validate.
>
> How to create proper form?
>
> I have this:
> $form->create("Order", array("action" => "send"));
> $form->input("Order.Customer.title");
> // more fileds
> $form->end("Send")
>
> It sends data to "send" action of OrdersController, but how to create
> Customer object, validate and display errors on the form if occur?
>
> Thanks for help
> >
>


-- 
Sijo Jose Chakramakkil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: A table with average & total row

2008-12-24 Thread dr. Hannibal Lecter

Depends. If you can do it in DB without performance loss, that's the
best way. If not, view is good enough. I tend to do as much as
possible in the database, because the damn thing is optimized to work
with (large) sets of data. But in the end, if that's not an option for
you, whatever gets the job done... :-)

On Dec 23, 6:31 pm, mathie  wrote:
> Hello,
>
> This is a design question on MVC separation. Say I need to display a
> table with many rows, then a total and an average row. Should the
> calculation of this total/average be done in the view (in the loop) or
> in the controller (after getting the rows from DB)?
>
> A related question. For an invoice: $amount = $price * $quantity;
> Could that be in the view or not?
>
> Basically I guess my question: what is considered view logic?
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth.php redirect - Undefined variable redir

2008-12-24 Thread codershop

This issue was fixed by nate in revision 7954.

On Dec 23, 4:11 pm, codershop  wrote:
> This has been submitted as bug #5921
>
> https://trac.cakephp.org/ticket/5921
>
> On Dec 22, 10:44 am,codershop wrote:
>
> > I am using revision 7949, on the 
> > branchhttps://svn.cakephp.org/repo/branches/1.2.x.x
>
> > In revision 7930 the return command was removed from line 676.  This
> > causes the code to continue executing to line 687 where the final
> > return statement is issued for the redirect method.  The return at
> > line 687 uses the redir variable.  Since I was setting the redirect
> > value, and the redir variable was never set I get the following error:
>
> > Undefined variable: redir [CORE/cake/libs/controller/components/
> > auth.php, line 687]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $html->url returns unexpected result when using named parameters.

2008-12-24 Thread Farhadi

I found this bug (https://trac.cakephp.org/ticket/4522) that is
exactly what I mentioned.
Currently, there is no plan to fix this problem, for now you can use
this workaround:
Place this line at your routes.php :
Router::connectNamed(array('namedparam'));

Notice that you must specify all of your project's named parameters in
the above array.


On Dec 24, 9:59 am, Farhadi  wrote:
> Hi,
> I have defined a route:
> Router::connect('/:lang/:controller/:action/*', null, array
> ('lang'=>'[a-z]{2}'));
>
> when I want to create a link using $html->link if there was a named
> parameter in the url, the result is wrong.
> for example when I am in /en/groups/index,
> $html->url(array('lang'=>'en', 'var'=>10)); returns "/groups/index/
> lang:en/var:10" instead of "/en/groups/index/var:10"
>
> Is there anything wrong with the route that I defined or its a bug in
> Router.
>
> by the way there is no other routes defined.
>
> Thank in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: custom SQL query - all values IN() bust be AND

2008-12-24 Thread dev

I will give an example:

Advert hasMany Option
I need to find Adverts, where its Options are 3 and 4 values. When
using IN, it will return results with 3, or, 4, or both 3 and 4. But i
want only with both values.

Like:
[0] => Array
(
[Advert] => Array
(
[id] => 2
[code] => 54
[created] => 2008-12-19 11:17:30
)

[Option] => Array
(
[0] => Array
(
[id] => 1
[advert_id] => 2
[option] => 3
)
[1] => Array
(
[id] => 2
[advert_id] => 2
[option] => 4
)

)

)




On Dec 24, 12:35 am, Smelly_Eddie  wrote:
> How can the same field have multiple values?
> -it can be = '3'
> -it can be= '4''
>
> Otherwise maybe your are just concatenating multiple variables into
> one, e.g.;
> -it can be='3,4'
> which probably should be evaluated for best practices..
>
> You would not use IN in such a case.
>
> If the are always ordered numerically you might use;
> AND options.option like '%3,4%'
> (assuming there are higher or lower values (2,..,5))
>
> If they are not always order and could be 4,3 or 4,5,3 then you might
> try;
> AND options.option like '%3%' AND options.option like '%4%
>
> On Dec 22, 11:21 am, dev  wrote:
>
> > i'm building custom SQl query and need a little help.
>
> > query:
> > select distinct adverts.id, adverts.code from adverts left join images
> > on (images.advert_id = adverts.id) left join options on
> > (options.advert_id = adverts.id) where (SELECT count(1) FROM images
> > WHERE adverts.id = images.advert_id) > 0 AND options.option IN (3, 4);
>
> > but i want to get all Advert records, where options.option has all
> > these values (3,4). When i'm using IN(), these values are with OR
> > operator, how to set AND?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$html->url returns unexpected result when using named parameters.

2008-12-24 Thread Farhadi

Hi,
I have defined a route:
Router::connect('/:lang/:controller/:action/*', null, array
('lang'=>'[a-z]{2}'));

when I want to create a link using $html->link if there was a named
parameter in the url, the result is wrong.
for example when I am in /en/groups/index,
$html->url(array('lang'=>'en', 'var'=>10)); returns "/groups/index/
lang:en/var:10" instead of "/en/groups/index/var:10"

Is there anything wrong with the route that I defined or its a bug in
Router.

by the way there is no other routes defined.

Thank in advance

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: generatetreelist error in rc4

2008-12-24 Thread AD7six

"Undefined property:  AppModel::$TicketCategory"

means your TicketCategory model doesn't exist or isn't being found -
and so an instance of AppModel is used instead (since the db table
does exist).

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---