Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. Syntax error: 7 ERROR: syntax error at or near "."
  2. LINE 1: ... ON ("t"."unit_id"="unit"."id") WHERE (LOWER(user.first_nam...
  3. ^. The SQL statement executed was: SELECT COUNT(DISTINCT "t"."ppmp_id") FROM "ppmp" "t" LEFT OUTER JOIN "user" "user" ON ("t"."user_id"="user"."id") LEFT OUTER JOIN "unit" "unit" ON ("t"."unit_id"="unit"."id") WHERE (LOWER(user.first_name) LIKE :ycp0)
  4.  
  5. private $_fullName = null;
  6. private $_unitName = null;
  7.  
  8. public function getFullName()
  9. {
  10. if ($this->_fullName === null && $this->user !== null) {
  11. $this->_fullName = $this->user->last_name;
  12. }
  13. return $this->_fullName;
  14. }
  15. public function setFullName($value)
  16. {
  17. $this->_fullName = $value;
  18. }
  19.  
  20. public function rules()
  21. {
  22. // NOTE: you should only define rules for those attributes that
  23. // will receive user inputs.
  24. return array(
  25. array('user_id, unit_id', 'numerical', 'integerOnly'=>true),
  26. array('year', 'required'),
  27. // The following rule is used by search().
  28. // Please remove those attributes that should not be searched.
  29. array('ppmp_id, user_id, unit_id, year, fullName, unitName', 'safe', 'on'=>'search'),
  30. );
  31. }
  32.  
  33. public function relations()
  34. {
  35. // NOTE: you may need to adjust the relation name and the related
  36. // class name for the relations automatically generated below.
  37. return array(
  38. 'user' => array(self::BELONGS_TO, 'User', 'user_id'),
  39. 'unit' => array(self::BELONGS_TO, 'Unit', 'unit_id'),
  40. );
  41. }
  42.  
  43. public function search()
  44. {
  45. // Warning: Please modify the following code to remove attributes that
  46. // should not be searched.
  47.  
  48. $criteria=new CDbCriteria;
  49. $criteria->with =array('user','unit');
  50. $criteria->compare('t.ppmp_id::VARCHAR',$this->ppmp_id);
  51. $criteria->compare("LOWER(user.first_name)",strtolower($this->fullName), true);
  52. $criteria->compare('LOWER(unit.description)',strtolower($this->unitName),true);
  53. $criteria->compare('year',$this->year);
  54.  
  55. $sort = new CSort();
  56. $sort->attributes = array(
  57. 'name'=>array(
  58. 'asc'=>'user.last_name',
  59. 'desc'=>'user.last_name desc',
  60. ),
  61. );
  62.  
  63. return new CActiveDataProvider($this, array(
  64. 'criteria'=>$criteria,
  65. 'sort'=>$sort,
  66. ));
  67. }
  68.  
  69. $this->widget('zii.widgets.grid.CGridView', array(
  70. 'id'=>'ppmp-grid',
  71. 'dataProvider'=>$model->search(),
  72. 'filter'=>$model,
  73. 'columns'=>array(
  74. 'ppmp_id',
  75. 'fullName',
  76. 'unitName',
  77. 'year',
  78. array(
  79. 'class'=>'CButtonColumn',
  80. ),
  81. ),
  82. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement