frictionlessdata / datapackage-php

A php library for working with Data Package.
MIT License
10 stars 10 forks source link

should provide interfaces for working with resources within a datapackage #9

Closed OriHoch closed 7 years ago

OriHoch commented 7 years ago
// get all resource objects
$resources = $datapackage->resources();
is_a($resources[0], "frictionlessdata\\datapackage\\Resources\\DefaultResource");
is_a($resources[1], "frictionlessdata\\datapackage\\Resources\\TabularResource");

// delete a resource by position in the resources array
$datapackage->deleteResource(0);

// get the new resource objects
$resources = $datapackage->resources();
is_a($resources[0], "frictionlessdata\\datapackage\\Resources\\TabularResource");

// add a resource
$datapackage->addResource(DefaultResource::create("my-new-resource"));
$resources = $datapackage->resources();
is_a($resources[0], "frictionlessdata\\datapackage\\Resources\\TabularResource");
is_a($resources[1], "frictionlessdata\\datapackage\\Resources\\DefaultResource");

// get a resource by name
$resource = $datapackage->getResourceByName("my-resource");
OriHoch commented 7 years ago

done in #12