Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread John Andersen
Remove the fields statement and see what you get! Enjoy, John On Jan 15, 5:00 pm, codef0rmer wrote: > @Amit Rawat: oh, silly mistake. I really need to keen my > observation ;) > > var $virtualFields = array( >        'full_name' => 'CONCAT(User.first_name, "", User.last_name)' > ); > > but the

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread codef0rmer
@Amit Rawat: oh, silly mistake. I really need to keen my observation ;) var $virtualFields = array( 'full_name' => 'CONCAT(User.first_name, "", User.last_name)' ); but the full_name key is not coming in $arrUser = $this->User->find("first", array( "fields" => array(

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread Amit Rawat
try this var $virtualFields = array( 'name' => 'CONCAT(User.first_name, "", User.last_name)' ); regards, amit 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 Googl

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-15 Thread codef0rmer
@Walther: thx i knew, i would get a valid solution. i tried upgrading my cakephp 1.2.5 to 1.3 alpha, but when i use below code in User Model, error comes... var $virtualFields = array( 'name' => 'CONCAT(User.first_name, ' ', User.last_name)' ); syntax error, unexpected T_CONSTANT_ENCAPSED

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-14 Thread Walther
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 wrote: > As far as I know, there is no solution! >

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-14 Thread John Andersen
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 (compari

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-14 Thread codef0rmer
@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

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread Azril Nazli
try "fields" => array( "GenderSalutation.name", "User.first_name", "User.middle_name", "User.last_name", "DATE_FORMAT(User.created, '%d') AS User.created", "User.dob", ), Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePH

Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread John Andersen
Do not format the date when you are retrieving it from the database. Format the date when you are presenting it to the user in a view. Use the Time helper for this! Enjoy, John On Jan 13, 4:27 pm, codef0rmer wrote: > It already ate my 1+ hour to figure out the problem. I hope, i'll get > a hel

DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread codef0rmer
It already ate my 1+ hour to figure out the problem. I hope, i'll get a help here... User Table Structure: id gender_salutation_id first_name middle_name last_name dob email GenderSalutation table Structure: id name I used below code to fetch the full name and formatted dob: $arrUser = $this->Us