Yii Framework Forum: [Extension] Yii-Language-Behavior - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] Yii-Language-Behavior Behavior for multiple languages Rate Topic: -----

#1 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 363
  • Joined: 23-July 09

Posted 27 December 2012 - 02:31 AM

I have just uploaded the initial release of a new multi language behavior: http://www.yiiframew...guage-behavior/

The initial release covers just the basics. Please post any questions/suggestions to this thread.

Backslider
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

#2 User is offline   punjung 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-September 13

Posted 08 October 2013 - 02:37 AM

Hello,

I'm Newbie in Yii Thank you for great ekstention.

I Have problem "Undefined variable: data " ==> Create.

What happen?
0

#3 User is offline   C.S.Putera 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 18-May 11

Posted 14 June 2014 - 01:34 AM

Hello, thank you for the extension. But I'm having some difficulties. Could you please help me ?

1. I'm having difficultites in setting the model rules. When I submit the form, it display error :

mb_strlen() expects parameter 1 to be string, array given

77  protected function validateAttribute($object,$attribute)
78     {
79         $value=$object->$attribute;
80         if($this->allowEmpty && $this->isEmpty($value))
81             return;
82 
83         if(function_exists('mb_strlen') && $this->encoding!==false)
84             $length=mb_strlen($value, $this->encoding ? $this->encoding : Yii::app()->charset);
85         else
86             $length=strlen($value);


I think it is due to the attribute type, which is array and being validated in the model which only accept string. Can I still use the validation rules with this extension ? Please help, thank you

2. Even if I pass on the validation, it display error :

Invalid argument supplied for foreach()

392 public function addErrors($errors)
393     {
394         foreach($errors as $attribute=>$error)
395         {
396             if(is_array($error))
397             {
398                 foreach($error as $e)
399                     $this->addError($attribute, $e);
400             }
401             else
402                 $this->addError($attribute, $error);
403         }
404     }


Please help thank you.
0

#4 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 363
  • Joined: 23-July 09

Posted 14 June 2014 - 01:46 AM

View PostC.S.Putera, on 14 June 2014 - 01:34 AM, said:

Hello, thank you for the extension. But I'm having some difficulties. Could you please help me ?

1. I'm having difficultites in setting the model rules. When I submit the form, it display error :

mb_strlen() expects parameter 1 to be string, array given




Are you trying to validate language attributes within the parent model?

If you follow my blog post carefully, you will see that they are validated within their own model. This part is a bit of a hack because Yii does not have the facility to do it really nicely. I believe I may have run into exactly the same issue you are having when I tried to validate within the parent module.

Please follow my blog post very carefully.
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

#5 User is offline   C.S.Putera 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 18-May 11

Posted 17 June 2014 - 01:13 PM

Hello. I am sorry for the late reply. Thank you for your fast reply. I have managed to validate the attributes and have my application running smoothly using your extension. Thank you for your help :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users