I have a table named SYSTEM_PARAMS
like below
+------------+------------------+------+-----+---------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------------------+-----------------------------+
| name | varchar(50) | NO | | NULL | |
| value | varchar(100) | YES | | NULL | |
| updated_at | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| created_at | timestamp | NO | | 0000-00-00 00:00:00 | |
| created_by | int(11) | NO | | NULL | |
| updated_by | int(11) unsigned | YES | | 0 | |
+------------+------------------+------+-----+---------------------+-----------------------------+
where i have all names of the cron jobs i have to run and update the value against the specific job name with the current running JobId
, the table does not have the primaryKey
defined as you can see the schema above, so i defined the method primaryKey()
inside the model like below
public function primaryKey($asArray=FALSE) {
return 'name';
}
but this gives me error saying that i can define a static method as non-static , what am i doing wrong here.
PHP Fatal error: Cannot make static method yii\db\ActiveRecord::primaryKey() non static in class common\models\SystemParams