Elgg\Database\EntityTable::updateRow PHP Method

updateRow() public method

Update entity table row
public updateRow ( integer $guid, stdClas\stdClass $row ) : integer | false
$guid integer Entity guid
$row stdClas\stdClass Updated data
return integer | false
    public function updateRow($guid, stdClass $row)
    {
        $sql = "\n\t\t\tUPDATE {$this->db->prefix}entities\n\t\t\tSET owner_guid = :owner_guid,\n\t\t\t    access_id = :access_id,\n\t\t\t\tcontainer_guid = :container_guid,\n\t\t\t\ttime_created = :time_created,\n\t\t\t\ttime_updated = :time_updated\n\t\t\tWHERE guid = :guid\n\t\t";
        $params = [':owner_guid' => $row->owner_guid, ':access_id' => $row->access_id, ':container_guid' => $row->container_guid, ':time_created' => $row->time_created, ':time_updated' => $row->time_updated, ':guid' => $guid];
        return $this->db->updateData($sql, false, $params);
    }

Usage Example

コード例 #1
0
ファイル: EntityTable.php プロジェクト: elgg/elgg
 /**
  * {@inheritdoc}
  */
 public function updateRow($guid, stdClass $row)
 {
     $attributes = array_merge((array) $this->rows[$guid], (array) $row);
     // Rebuild query specs for the udpated row
     $this->addQuerySpecs((object) $attributes);
     return parent::updateRow($guid, $row);
 }