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
@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(
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
@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
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!
>
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
@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
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
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
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
10 matches
Mail list logo