I've never tried, but it sounds like it shouldn't possible, as you should only be manipulating the fields of the actual model, and not other ones that are related.
Maybe something in an afterFind function could be used to do this? You could check to see if the EsateAgency.name is in the data, and then add a new variable to the data at this stage with a standard PHP concatanation? On Jul 31, 2:19 am, ludde <[email protected]> wrote: > Hi, > > I have one Agent model and one EstateAgency model like this... > (cakePHP 1.3.11) > > class Agent extends AppModel { > var $belongsTo = 'EstateAgency'; > > } > > class EstateAgency extends AppModel { > var $hasMany = 'Agent'; > > } > > Now I'm trying to create a virtual field, that combines the name of > the agent and the agency, in the Agent class. > > Here is my attempt that I can't get to work: > class Agent extends AppModel { > var $belongsTo = 'EstateAgency'; > var $virtualFields = array( > 'virtualTest' => "CONCAT(Agent.name, ' - ', > EstateAgency.name)" > ); > > } > > What am I doing wrong? Or is this even possible to do this way? > > thanks > /Ludde -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
