Is this expected for all table-less models? If so implementing loadInfo()
would fix the related issue I sent on this thread.

And if that's the case, and before I submit an enhancement ticket, do you
think something like the following may be useful:

1. For table-less models, define a $fields on your model like so:

class Model extends AppModel
{
        var $fields = array(
                'email' => 'string',
                'name' => 'string',
                'message' => 'string'
        );
}

2. Then on AppModel:

class AppModel
{
        function loadInfo()
        {
                if ($this->useTable === false)
                {
                        $defaults = array(
                                'null' => false,
                                'default' => null,
                                'length' => null
                        );
                
                        $fields = array();
                
                        foreach($this->fields as $field => $type)
                        {
                                $fields[] = am(array('name'=>$field,
'type'=>$type), $defaults);
                        }
                
                        return new Set($fields);
                }

                return parent::loadInfo();
        }
}

This could be on CakePHP's built in AppModel, so developer has still the
choice to override loadInfo(), but if he/she doesn't, and they are dealing
with table-less models, then setting the $fields array is all they have to
do to get it right. If it is built in on cakephp, then it should go on
Model::loadInfo(), and instead of return parent::loadInfo() that would be
where normal code would be.

Then again, this is only useful if table-less models *need* to implement
loadInfo()

-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: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de nate
Enviado el: Viernes, 09 de Marzo de 2007 01:55 p.m.
Para: Cake PHP
Asunto: Re: Problem using $form->create() with a model having var $useTable
= false (cake 1.2)

You either implement the loadInfo() method in your model so it returns
descriptions consistent with the fields you are using in your form.
Do pr($this->Model->loadInfo()); to get an idea of the format.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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