Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Syntax error: 7 ERROR: syntax error at or near "."
- LINE 1: ... ON ("t"."unit_id"="unit"."id") WHERE (LOWER(user.first_nam...
- ^. 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)
- private $_fullName = null;
- private $_unitName = null;
- public function getFullName()
- {
- if ($this->_fullName === null && $this->user !== null) {
- $this->_fullName = $this->user->last_name;
- }
- return $this->_fullName;
- }
- public function setFullName($value)
- {
- $this->_fullName = $value;
- }
- public function rules()
- {
- // NOTE: you should only define rules for those attributes that
- // will receive user inputs.
- return array(
- array('user_id, unit_id', 'numerical', 'integerOnly'=>true),
- array('year', 'required'),
- // The following rule is used by search().
- // Please remove those attributes that should not be searched.
- array('ppmp_id, user_id, unit_id, year, fullName, unitName', 'safe', 'on'=>'search'),
- );
- }
- public function relations()
- {
- // NOTE: you may need to adjust the relation name and the related
- // class name for the relations automatically generated below.
- return array(
- 'user' => array(self::BELONGS_TO, 'User', 'user_id'),
- 'unit' => array(self::BELONGS_TO, 'Unit', 'unit_id'),
- );
- }
- public function search()
- {
- // Warning: Please modify the following code to remove attributes that
- // should not be searched.
- $criteria=new CDbCriteria;
- $criteria->with =array('user','unit');
- $criteria->compare('t.ppmp_id::VARCHAR',$this->ppmp_id);
- $criteria->compare("LOWER(user.first_name)",strtolower($this->fullName), true);
- $criteria->compare('LOWER(unit.description)',strtolower($this->unitName),true);
- $criteria->compare('year',$this->year);
- $sort = new CSort();
- $sort->attributes = array(
- 'name'=>array(
- 'asc'=>'user.last_name',
- 'desc'=>'user.last_name desc',
- ),
- );
- return new CActiveDataProvider($this, array(
- 'criteria'=>$criteria,
- 'sort'=>$sort,
- ));
- }
- $this->widget('zii.widgets.grid.CGridView', array(
- 'id'=>'ppmp-grid',
- 'dataProvider'=>$model->search(),
- 'filter'=>$model,
- 'columns'=>array(
- 'ppmp_id',
- 'fullName',
- 'unitName',
- 'year',
- array(
- 'class'=>'CButtonColumn',
- ),
- ),
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement