
Public Member Functions | |
| __construct (StorageProviderInterface $storage) | |
| persist ($object) | |
| retrieve ($key) | |
| delete ($object) | |
The MapperInterface is part of the storage provider design.
It defines methods that must be implemented by any Mapper object when developing a storage provider for Snuze.
This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun@shaunc.com https://shaunc.com/ Repository: https://github.com/snuze/snuze/ Documentation: https://snuze.shaunc.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| snuze\Persistence\Interfaces\MapperInterface::__construct | ( | StorageProviderInterface | $storage | ) |
A Mapper's constructor must accept a storage provider (for example, a MySQL or SQLite storage provider) implementing StorageProviderInterface.
| \snuze\Persistence\Provider\StorageProviderInterface | $storage |
Implemented in snuze\Persistence\MySQL\AccountMapper, snuze\Persistence\SQLite\AccessTokenMapper, snuze\Persistence\MySQL\AccessTokenMapper, snuze\Persistence\MySQL\LinkMapper, and snuze\Persistence\MySQL\SubredditMapper.
| snuze\Persistence\Interfaces\MapperInterface::delete | ( | $object | ) |
Delete an object from storage.
| object | $object | The object to delete |
Implemented in snuze\Persistence\MySQL\LinkMapper, snuze\Persistence\MySQL\SubredditMapper, snuze\Persistence\MySQL\AccountMapper, snuze\Persistence\SQLite\AccessTokenMapper, and snuze\Persistence\MySQL\AccessTokenMapper.
| snuze\Persistence\Interfaces\MapperInterface::persist | ( | $object | ) |
Persist the object to storage. This must support both the insertion of new objects and the updating of existing objects; implementers should use the equivalent of an "upsert" paradigm.
| object | $object | The object to persist |
Implemented in snuze\Persistence\MySQL\AccountMapper, snuze\Persistence\SQLite\AccessTokenMapper, snuze\Persistence\MySQL\AccessTokenMapper, snuze\Persistence\MySQL\LinkMapper, and snuze\Persistence\MySQL\SubredditMapper.
| snuze\Persistence\Interfaces\MapperInterface::retrieve | ( | $key | ) |
Retrieve an object from storage, given a unique identifier for it. The identifier used is left up to the implementer. A SubredditMapper may use the subreddit's name as the default retrieval key, whereas a LinkMapper would use the link's internal Reddit ID, etc. You can always extend the built-in mappers to add your own methods with different criteria.
| mixed | $key | A unique identifier for the object to be retrieved. |
Implemented in snuze\Persistence\MySQL\LinkMapper, snuze\Persistence\MySQL\SubredditMapper, snuze\Persistence\MySQL\AccountMapper, snuze\Persistence\SQLite\AccessTokenMapper, snuze\Persistence\MySQL\AccessTokenMapper, snuze\Persistence\Interfaces\AccountMapperInterface, and snuze\Persistence\Interfaces\SubredditMapperInterface.