title and to create thumbs before inserting them in the database or
everything is inside the model?
I have tested to set a new 'title' field in me form and this title got
inside the i18n table.
On Nov 23, 5:43 pm, Constantin FF <constantin...@gmail.com> wrote:
> I created new Debugtranslate Behavior just to find the reason of not
> saving the attachment title and body in the i18n table
> Here is the behavior
>
> <?php
> App::import('Behavior', 'Translate');
> class DebugtranslateBehavior extends TranslateBehavior {
>
> function setup(&$Model, $settings) {
> if (!isset($this->__settings[$Model->alias])) {
> $this->__settings[$Model->alias] = array(
> 'fields' => array(),
> );
> }
> if (!is_array($settings)) {
> $settings = array();
> }
> $this->__settings[$Model->alias] =
> array_merge($this->__settings[$Model->alias], $settings);
> //setup Translate behavior with translatable fields
> return parent::setup($Model,
> $this->__settings[$Model->alias]['fields']);
> }
> function beforeSave(&$Model) {
> parent::beforeSave($Model, $created);
> pr($Model);die;
> return true;
> }}
>
> ?>
>
> If the Debugtranslate behavior is attached to some ordinari model
> saving a post I get this inside the $Model array:
>
> Node Object
> (
> [Behaviors] => BehaviorCollection Object
> (
> [Debugtranslate] => DebugtranslateBehavior Object
> (
> [runtime] => Array
> (
> [Node] => Array
> (
> [beforeSave] => Array
> (
> [title] => test
> [body] => test-node
>
> )
> )
>
> )
>
> )
>
> )
> )
>
> BUT when saving attachment those fields does not exists.
> What more can I look for?
> On Wed, Nov 23, 2011 at 2:15 PM, DigitalDude
>
>
>
>
>
>
>
> <e.blumsten...@googlemail.com> wrote:
> > Hey,
>
> > @msujlt: you should always 'name' your tanslated fields, but I think
> > cake does not force this.
> > You then should remove the old field from the table (e.g. table
> > attachments, field title).
>
> > When you SAVE your racords (add/edit), you have to set the locale for
> > your model:
> > $this->Attachment->locale = 'eng';
>
> > Note: I don't know what locales are defined in your app. Also, there
> > can be differences when your locales are build like "en-gb", the
> > locale will be "eg_gb".
> > Try doing that, it will work but I guess you'll have to test it out
> > with the locales of your app...
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment