You could use loadInfo() to fetch your model fields and implode the array.

Assuming your model is Application, and the field you want to omit is
'contents', do (look to see that the only difference between 1.1 and 1.2
version is the call to extract()):

CakePHP 1.1:

$info = $this->Application->loadInfo();
$fields = $info->extract('name');
                
$index = array_search('contents', $fields);
                
if ($index !== false)
{
        unset($fields[$index]);
}
                
$fields = 'Application.' . implode(', Application.', $fields);
                
$records = $this->Application->findAll(null, $fields);

CakePHP 1.2:

$info = $this->Application->loadInfo();
$fields = $info->extract('{n}.name');
                
$index = array_search('contents', $fields);
                
if ($index !== false)
{
        unset($fields[$index]);
}
                
$fields = 'Application.' . implode(', Application.', $fields);
                
$records = $this->Application->findAll(null, $fields);

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de wralph
Enviado el: Martes, 13 de Marzo de 2007 11:56 p.m.
Para: Cake PHP
Asunto: Block field using find()

I've got a large table (large in regards the number of columns)
'applications' with 40 columns. One of those columns is a BLOB, which
holds the contents of a file (held in the database as there are two
sides to the application, an internal and external - both of which use
the same DB, but not on the same server).

Anyway, I want to grab all the application data, minus the BLOB field,
but don't wat to have to list every column name in my query. Is there
anyway I can do this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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