What you want is Virtual Fields!

Virtual fields is one of the new features in CakePHP 1.3 and is there
to solve your EXACT problem.

http://cakephp.lighthouseapp.com/projects/42648/13-new-features-virtual-fields

On Jan 14, 3:04 pm, John Andersen <[email protected]> wrote:
> As far as I know, there is no solution!
> But my suggestion was that formatting for presentation is not a good
> thing to do at the database level, but in CakePHP is performed in the
> view.
> That way you have all the possibilities to use the date not only for
> presentation but also for processing (comparision, different
> presentations, etc.)
> Anyway, as soon as you use a function in the database query, the alias
> you assign it goes outside the model array and you can only get it
> back in by using afterFind callback method.
> Somebody please correct me if I am wrong on this :)
> Enjoy,
>    John
>
> On Jan 14, 2:48 pm, codef0rmer <[email protected]> wrote:
>
> > @John Andersen: thx but there has to be a solution instead of
> > formatting in view file
>
> > @Azril Nazli: :-( no luck... it says, sql query error. here is the
> > below query:
> > SELECT `GenderSalutation`.`name`, `User`.`first_name`,
> > `User`.`middle_name`, `User`.`last_name`, `User`.`address`, DATE_FORMAT
> > (User.created, '%d') AS User.created, `User`.`mobile`, `User`.`dob`,
> > `User`.`experience` FROM `users` AS `User` LEFT JOIN
> > `gender_salutations` AS `GenderSalutation` ON
> > (`User`.`gender_salutation_id` = `GenderSalutation`.`id`)  WHERE
> > `User`.`email` = '[email protected]'    LIMIT 1
>
> > SQL Error: 1064: You have an error in your SQL syntax; check the
> > manual that corresponds to your MySQL server version for the right
> > syntax to use near '.created
>
> > Any other solution... please help
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to