PHP code example of jield-webdev / jield-export
1. Go to this page and download the library: Download jield-webdev/jield-export 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/ */
jield-webdev / jield-export example snippets
return [
'Jield\\Export',
];
declare(strict_types=1);
namespace General;
use General\Export\Country\CountryColumns;
return [
'jield_export' => [
'entities' => [
'country' => CountryColumns::class
],
]
];
declare(strict_types=1);
namespace General\Export\Country;
use General\Entity\Country;use Jield\Export\Columns\AbstractEntityColumns;use Jield\Export\ValueObject\Column;
final class CountryColumns extends AbstractEntityColumns
{
protected string $name = 'dimcountry';
/**
* @return array<Column>
*/
public function getColumns(): array
{
$qb = $this->entityManager->createQueryBuilder();
$countries = $qb->select('general_entity_country')
->from(from: Country::class, alias: 'general_entity_country')
->getQuery()
->getResult();
$idColumn = new Column(columnName: 'Id', type: Column::TYPE_INTEGER, isNullable: false);
$cdColumn = new Column(columnName: 'Cd');
$countryColumn = new Column(columnName: 'Country');
$iso3Column = new Column(columnName: 'Iso3');
/** @var Country $country */
foreach ($countries as $country) {
$idColumn->addRow($country->getId());
$cdColumn->addRow($country->getCd());
$countryColumn->addRow($country->getCountry());
}
return [
$idColumn,
$cdColumn,
$countryColumn,
];
}
public function getDependencies(): array
{
return [
'organisationtype' => TypeColumns::class,
];
}
}
public function getBlobService(): \AzureOSS\Storage\Blob\BlobRestProxy
{
if (null !== $this->blobClient) {
return $this->blobClient;
}
$storageLocation = $this->getDefaultStorageLocation();
if ($storageLocation->hasOAuth2Service()) {
$accessToken = $this->oAuth2Service->fetchAccessTokenFromService($storageLocation->getOAuth2Service());
$this->blobClient = BlobRestProxy::createBlobServiceWithTokenCredential(
token: $accessToken,
connectionString: $storageLocation->getConnectionString()
);
} else {
$this->blobClient = BlobRestProxy::createBlobService(
connectionString: $storageLocation->getConnectionString()
);
}
return $this->blobClient;
}