1. Go to this page and download the library: Download qeti/yii2-podata-adapter 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/ */
namespace app\models\OData\Entities;
use yii\db\ActiveRecord;
use qeti\SimplePOData\EntityTrait;
class Request extends ActiveRecord {
use EntityTrait;
public $id;
public $type_code;
public $status_code;
}
namespace qeti\Yii2PODataAdapter\implementation;
use POData\Providers\Metadata\Type\EdmPrimitiveType;
use POData\Providers\Metadata\SimpleMetadataProvider;
class MetadataProvider
{
const MetaNamespace = "Data";
/**
* @return IMetadataProvider
*/
public static function create()
{
$metadata = new SimpleMetadataProvider('Data', self::MetaNamespace);
$requestEntityType = self::createRequestEntityType($metadata);
$requestResourceSet = $metadata->addResourceSet('Requests', $requestEntityType);
return $metadata;
}
private static function createRequestEntityType(SimpleMetadataProvider $metadata)
{
$et = $metadata->addEntityType(new \ReflectionClass('app\models\OData\Entities\Request'), 'Requests', self::MetaNamespace);
$metadata->addKeyProperty($et, 'id', EdmPrimitiveType::INT64);
$metadata->addPrimitiveProperty($et, 'type_code', EdmPrimitiveType::STRING);
$metadata->addPrimitiveProperty($et, 'status_code', EdmPrimitiveType::STRING);
return $et;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.