Johnny | 1 Oct 2009 01:30
Favicon

Re: 1.3 problem with baking from custom view template


Thanks, i missed those notes in the wiki about the template location
when i read through it.
I put the template files where they belong and now it works fine.

On Sep 30, 12:56 am, mark_story <mark.st...@...> wrote:
> fired that last email off too quickly, also check thehttp://code.cakephp.org/wiki/1.3/migration-guide/bake-updatesnotes
> about bake as bake had a fairly significant set of changes done to it
> for 1.3 and the location of the templates has changed a bit.
>
> -Mark
>
> On Sep 29, 11:48 am, Johnny <joh...@...> wrote:
>
> > I recently started playin around with the 1.3 dev version of cake and
> > i'm having problems with using custom view templates for bake. I place
> > them in the app/vendors/shells/templates/views folder but bake ignores
> > them and still uses the default templates that come with cake.
> > In cake 1.2.5 everything works fine. I've read everything i could find
> > about bake in 1.3 but can't seem to figure out what is wrong.
brian | 1 Oct 2009 02:34
Picon

Re: SQL SUM function


But read this post:

http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/

Cake will not put the data for the calculated field under the model
name in the data array. Put Teknoid's code in your AppModel and you'll
be good to go.

On Wed, Sep 30, 2009 at 3:20 PM, Edinei L. Cipriani
<phpedinei@...> wrote:
> Hi,
>
> $this->Model->find('all', array('fields' =>
> array('Model.id'.'SUM(Model.price) AS price' ));
>
> Regards
>
>
> 2009/9/30 DAM <damithme@...>
>>
>> I'm developing web based application.
>> example table
>> create table item{
>> ....
>> price decimal(12,2) notnull,
>> ....
>> }
>>
>> I want to show sum of price.How I can do it?
(Continue reading)

Sort returns 1?


Anyone know why a sort returns 1?

Model function:

$merged = array_merge ($new_skills, $selected);
    //debug($merged);
    $sorted = sort($merged);
    //debug($sorted);

$merged produces

Array
(
    [0] => Cohghol
    [1] => Shit
    [2] => Thfghfdgh
    [3] => Zoo
    [4] => Alfred
    [5] => Michelle
)

$sorted produces 
1

???

Ideas
Thanks,

(Continue reading)

Miles J | 1 Oct 2009 04:17
Picon
Gravatar

Re: Sort returns 1?


Because sort() doesn't return a new array, it sorts the current array.

$merged = array_merge ($new_skills, $selected);
sort($merged);

Thats how it works.

RE: Sort returns 1?


My bad....

The array is more complex than I originally posted.

So I need Program and Skill sorted alphabetically

Array
(

    [Program] => Array
        (
            [0] => After School Studies
            [1] => Gym
            [2] => Creative Writing
        )

    [Skill] => Array
        (
    		[0] => Cohghol
    		[1] => Shit
    		[2] => Thfghfdgh
    		[3] => Zoo
    		[4] => Alfred
    		[5] => Michelle
        )

) 

How can I do this? 
(Continue reading)

Mukhamad Ikhsan | 1 Oct 2009 07:56
Picon

Password field is automatically hashed, how to change this?

I have a password field that when submiting, the value is already hashed. before, I'm not really concider with this problem, but now i realize because of that, the validation for 'notEmpty' is break. Even i enter the empty, Cake automated hashed the empty value so i never get validation error for notEmpty in password field. There is some configuration for this?

--
Mukhamad Ikhsan
http://www.diodachi.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 <at> googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Bert Van den Brande | 1 Oct 2009 08:01
Picon

Re: habtm limit

The query actually looks ok to me ... in what way are the results incorrect ?

On Tue, Sep 29, 2009 at 8:55 PM, bram <brammeleman <at> gmail.com> wrote:

These are the resulting queries:

SELECT `User`.`id`, `User`.`username`, `User`.`name` FROM `users` AS
`User` ORDER BY `name` ASC

SELECT `Event`.`id`, `Event`.`date`, `EventsUser`.`id`,
`EventsUser`.`event_id`, `EventsUser`.`user_id` FROM `events` AS
`Event` JOIN `events_users` AS `EventsUser` ON (`EventsUser`.`user_id`
IN (3, 1, 2) AND `EventsUser`.`event_id` = `Event`.`id`) WHERE 1 = 1
ORDER BY `Event`.`date` DESC LIMIT 1

I actually don't know how to rewrite this query to get the latest
associated event (one) for each user...


On Sep 29, 3:30 pm, Bert Van den Brande <cyr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Have a look at the query it generates (set debug to 2) , I'm sure this will
> shine a bright light on the problem ...
>
> On Mon, Sep 28, 2009 at 9:48 PM, bram <brammele...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > In my app, I have a User model that has a habtm association with
> > 'Event'. In one of the views, I want to show a list of Users and their
> > most recent event.
>
> > I ended up with this definition in the User model:
>
> >        var $hasAndBelongsToMany = array(
> >                'Event' => array(
> >                        'className' => 'Event',
> >                        'joinTable' => 'events_users',
> >                        'foreignKey' => 'user_id',
> >                        'associationForeignKey' => 'event_id',
> >                        'unique' => true,
> >                        'limit' => 1,
> >                        'order' => 'Event.date DESC'
> >                )
> >        );
>
> > find('all') returns the list of all users and only one of them has an
> > associated event.
>
> > When increasing the limit, it does show associated events, but when
> > some user don't have events associated, some other users will have
> > multiple events returned.
>
> > Is this a cake bug or do I have the wrong impression of the limit in a
> > habtm association?
>
> > Cheers,
>
> > Bram



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

Miles J | 1 Oct 2009 08:08
Picon
Gravatar

Re: Password field is automatically hashed, how to change this?


Just rename the field to something else, like password1. Once it
passes validations just set password to equal password1. Thats what
most people do, and yes its quite annoying in the way Auth is handled.

On Sep 30, 10:56 pm, Mukhamad Ikhsan <ikhsan.o...@...> wrote:
> I have a password field that when submiting, the value is already hashed.
> before, I'm not really concider with this problem, but now i realize because
> of that, the validation for 'notEmpty' is break. Even i enter the empty,
> Cake automated hashed the empty value so i never get validation error for
> notEmpty in password field. There is some configuration for this?
>
> --
> Mukhamad Ikhsanhttp://www.diodachi.com
Bert Van den Brande | 1 Oct 2009 08:15
Picon

Re: Password field is automatically hashed, how to change this?

As far is I know there is no configuration for this, a workaround is to name your password form fields not 'password'. Keep in mind that you have to manually hash the passwords then using $this->Auth->password($your_password)

On Thu, Oct 1, 2009 at 7:56 AM, Mukhamad Ikhsan <ikhsan.only-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I have a password field that when submiting, the value is already hashed. before, I'm not really concider with this problem, but now i realize because of that, the validation for 'notEmpty' is break. Even i enter the empty, Cake automated hashed the empty value so i never get validation error for notEmpty in password field. There is some configuration for this?

--
Mukhamad Ikhsan
http://www.diodachi.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 <at> googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Alexandru Ciobanu | 1 Oct 2009 10:05
Picon

Re: Sort returns 1?


On 10/1/2009 5:28 AM, Dave Maharaj :: WidePixels.com wrote:
> My bad....
>
> The array is more complex than I originally posted.
>
> So I need Program and Skill sorted alphabetically
>
> Array
> (
>
>      [Program] =>  Array
>          (
>              [0] =>  After School Studies
>              [1] =>  Gym
>              [2] =>  Creative Writing
>          )
>
>      [Skill] =>  Array
>          (
>      		[0] =>  Cohghol
>      		[1] =>  Shit
>      		[2] =>  Thfghfdgh
>      		[3] =>  Zoo
>      		[4] =>  Alfred
>      		[5] =>  Michelle
>          )
>
>
>
> )
>
> How can I do this?
>
> Program and Skill are merged arrays. I tried sorting them after the merge
> but same thing... Still produced 1
>
> $sorted = array_merge ($new_data, $selected);
> //$area is the array value Program or Skill in this case so it inserts the
> data into Program or Skill
> $new_selections = Set::insert($all_selections, $area, $sorted);
>
>
>    
$program = array('After School Studies', 'Gym', 'Creative Writing');
$skill = array('Cohghol', 'Shit', 'Thfghfdgh', 'Zoo', 'Alfred', 'Michelle');

$merged = array_merge($program, $skill);

natsort($merged);

var_dump($merged);

Sort functions return boolean. In your case:
$sorted = sort($merged);

After this line $sorted will be boolean and $merged will be sorted.

php.net/sort
php.net/natsort

HTH


Gmane