PHP code example of youmad / endurance-activity-postgresql
1. Go to this page and download the library: Download youmad/endurance-activity-postgresql library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youmad / endurance-activity-postgresql example snippets
use Youmad\Endurance\ActivityPostgresql\Activity\ActivityRowMapper;
use Youmad\Endurance\ActivityPostgresql\Activity\DoctrineDbalActivityRepository;
use Youmad\Endurance\ActivityPostgresql\Connection\DoctrineDbalActivityTransaction;
$transaction = new DoctrineDbalActivityTransaction($connection);
$activities = new DoctrineDbalActivityRepository(
transaction: $transaction,
rows: new ActivityRowMapper(),
);
$transaction->run(static function () use ($activities, $activity): void {
$activities->save($activity);
});