Angejia\Pea\Model::primaryKey PHP Method

primaryKey() public method

public primaryKey ( )
    public function primaryKey()
    {
        return $this->primaryKey;
    }

Usage Example

Ejemplo n.º 1
-1
 public function insert(array $values)
 {
     if ($this->needFlushCache()) {
         // 清空表级缓存
         $meta = $this->getMeta();
         $meta->flush($this->db(), $this->model->table());
         if (!is_array(reset($values))) {
             $values = [$values];
         }
         $toClearIds = [];
         foreach ($values as $value) {
             $toClearIds[] = $value[$this->model->primaryKey()];
         }
         $toClearKeys = $this->buildRowCacheKey($toClearIds);
         $this->getCache()->del(array_values($toClearKeys));
     }
     return parent::insert($values);
 }