You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,8 +89,17 @@ Porter's API
89
89
90
90
`Porter` provides the following methods.
91
91
92
+
### Importing data
93
+
94
+
These are the methods to be most familiar with, where the life of a data import operation begins.
95
+
92
96
*`import(ImportSpecification)`– Imports data according to the design of the specified import specification.
93
-
*`importOne(ImportSpecification)`– Imports one record according to the design of the specified import specification. If more than one record is imported, `ImportException` will be thrown.
97
+
*`importOne(ImportSpecification)`– Imports one record according to the design of the specified import specification. If more than one record is imported, `ImportException` is thrown.
98
+
99
+
### Provider registry
100
+
101
+
Porter acts as a provider registry; before data can be imported from a provider it must be registered with Porter. The tagging system is provided to distinguishing between provider instances of the same type, for scenarios where more than one instance of a specific provider is needed.
102
+
94
103
*`registerProvider(Provider, string|null $tag)`– Registers the specified provider optionally identified by the specified tag. A tag is any user-defined identifier used to distinguish between different instances of the same provider type.
95
104
*`getProvider(string $name, string|null $tag)`– Gets the provider matching the specified class name and optionally a tag.
96
105
*`hasProvider(string $name, string|null $tag)`– Gets a value indicating whether the specified provider is registered.
@@ -112,7 +121,9 @@ Options may be configured by some of the methods listed below.
112
121
Record collections
113
122
------------------
114
123
115
-
Record collections are a type of `Iterator` whose values are arrays. The result of a successful `Porter::import` call is an instance of `PorterRecords` or one of its specialisations, which implement `Iterator`, guaranteeing the collection is enumerable using `foreach`.
124
+
Record collections are a type of `Iterator`, whose values are arrays of imported data, and are sometimes `Countable`. The result of a successful `Porter::import` call is an instance of `PorterRecords` or one of its specialisations, guaranteeing the collection is enumerable using `foreach`. That's all you need to know! The following details are just for nerds.
125
+
126
+
### Details
116
127
117
128
Record collections are composed by Porter using the decorator pattern. If provider data is not modified, `PorterRecords` will decorate the `ProviderRecords` returned from a `ProviderResource`. That is, `PorterRecords` has a pointer back to the previous collection, which could be written as: `PorterRecords` → `ProviderRecords`. If a [filter](#filtering) was applied, the collection stack would be `PorterRecords` → `FilteredRecords` → `ProviderRecords`. In general this is an unimportant detail for most users but it can be useful for debugging. The stack of record collection types informs us of the transformations a collection has undergone and each type holds a pointer to relevant objects that participated in the transformation, for example, `PorterRecords` holds a reference to the `ImportSpecification` that was used to create it and can be accessed using `PorterRecords::getSpecification`.
0 commit comments