Se você define no MySql um campo como decimal (9,7) o gii do yii gera a seguinte regra
array('latitude, longitude', 'length', 'max'=>9).
Quando você executa o método save do model você receberá este erro
2012/06/03 01:59:58 [error] [php] Trying to get property of non-object (C:\xampp\htdocs\indcep\protected\models\TargetVote.php:182)
Stack trace:
#0 C:\xampp\htdocs\indcep\protected\controllers\TargetVoteController.php(163): TargetVote->save()
#1 C:\xampp\htdocs\yii\framework\web\actions\CInlineAction.php(50): TargetVoteController->actionCreate()
#2 C:\xampp\htdocs\yii\framework\web\CController.php(309): CInlineAction->runWithParams()
#3 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(134): TargetVoteController->runAction()
#4 C:\xampp\htdocs\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()
#5 C:\xampp\htdocs\yii\framework\web\CController.php(1146): CAccessControlFilter->filter()
#6 C:\xampp\htdocs\yii\framework\web\filters\CInlineFilter.php(59): TargetVoteController->filterAccessControl()
#7 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter()
#8 C:\xampp\htdocs\yii\framework\web\CController.php(292): CFilterChain->run()
#9 C:\xampp\htdocs\yii\framework\web\CController.php(266): TargetVoteController->runActionWithFilters()
#10 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(276): TargetVoteController->run()
#11 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(135): CWebApplication->runController()
#12 C:\xampp\htdocs\yii\framework\base\CApplication.php(162): CWebApplication->processRequest()
#13 C:\xampp\htdocs\indcep\index.php(15): CWebApplication->run()
REQUEST_URI=/indcep/index.php?r=targetVote/create
in C:\xampp\htdocs\indcep\protected\models\TargetVote.php (182)
in C:\xampp\htdocs\indcep\protected\controllers\TargetVoteController.php (163)
in C:\xampp\htdocs\indcep\index.php (15)
decimal (9,7) significa 9 casas decimais no total com 7 casas decimais possíveis a direita.
Ou seja
'max'=>9 faz sentido.
Porém o yii não leva em conta o ponto decimal e o sinal para dizer se é positivo ou negativo.
Ou seja, o correto é
'max'=>11
Ain't that a bitch?
Nenhum comentário:
Postar um comentário