Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
chore: Migrate all over to new OllieCodes namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ollieread committed Nov 18, 2021
1 parent 5766bdd commit 081cb6a
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 7.3
- 7.4
- 8.0

matrix:
fast_finish: true
Expand Down
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.0.0] - 2020-07-07
- Initial release

[Unreleased]: https://github.com/sprocketbox/eloquent-identity/compare/v1.2.0...master
[1.2.0]: https://github.com/sprocketbox/eloquent-identity/releases/tag/v1.2.0
[1.1.0]: https://github.com/sprocketbox/eloquent-identity/releases/tag/v1.1.0
[1.0.0]: https://github.com/sprocketbox/eloquent-identity/releases/tag/v1.0.0
[Unreleased]: https://github.com/olliecodes/eloquent-identity/compare/v1.2.0...master
[1.2.0]: https://github.com/olliecodes/eloquent-identity/releases/tag/v1.2.0
[1.1.0]: https://github.com/olliecodes/eloquent-identity/releases/tag/v1.1.0
[1.0.0]: https://github.com/olliecodes/eloquent-identity/releases/tag/v1.0.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Sprocketbox
Copyright (c) 2021 Ollie Codes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Eloquent Identity
[![Latest Stable Version](https://poser.pugx.org/sprocketbox/eloquent-identity/v/stable.png)](https://packagist.org/packages/sprocketbox/eloquent-identity)
[![Latest Unstable Version](https://poser.pugx.org/sprocketbox/eloquent-identity/v/unstable.png)](https://packagist.org/packages/sprocketbox/eloquent-identity)
[![License](https://poser.pugx.org/sprocketbox/eloquent-identity/license.png)](https://packagist.org/packages/sprocketbox/eloquent-identity)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sprocketbox/eloquent-identity/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sprocketbox/eloquent-identity/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/olliecodes/eloquent-identity/v/stable.png)](https://packagist.org/packages/olliecodes/eloquent-identity)
[![Latest Unstable Version](https://poser.pugx.org/olliecodes/eloquent-identity/v/unstable.png)](https://packagist.org/packages/olliecodes/eloquent-identity)
[![License](https://poser.pugx.org/olliecodes/eloquent-identity/license.png)](https://packagist.org/packages/olliecodes/eloquent-identity)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/olliecodes/eloquent-identity/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/olliecodes/eloquent-identity/?branch=master)

- **Laravel**: 7+
- **PHP**: 7.4+
- **Laravel**: 7.* || 8.*
- **PHP**: 7.* || 8.*
- **License**: MIT
- **Author**: Ollie Read
- **Author Homepage**: https://sprocketbox.io
- **Author Homepage**: https://ollie.codes

Eloquent identity provides a cache on top of Eloquent preventing multiple models being created for a single database row
using the Identity Map design pattern ([P of EAA](https://martinfowler.com/eaaCatalog/identityMap.html) & [Wikipedia](https://en.wikipedia.org/wiki/Identity_map_pattern)).
Expand All @@ -28,14 +28,14 @@ using the Identity Map design pattern ([P of EAA](https://martinfowler.com/eaaCa
To install this package simply run the following command.

```
composer require sprocketbox/eloquent-identity
composer require olliecodes/eloquent-identity
```

This package uses auto-discovery to register the service provider but if you'd rather do it manually,
the service provider is:

```
Sprocketbox\Eloquent\Identity\ServiceProvider
OllieCodes\Eloquent\Identity\ServiceProvider
```

There is no configuration required.
Expand All @@ -44,7 +44,7 @@ There is no configuration required.
To make use of the Eloquent identity map on your models, add the following trait.

```
Sprocketbox\Eloquent\Identity\Concerns\MapsIdentity
OllieCodes\Eloquent\Identity\Concerns\MapsIdentity
```

### Finding
Expand Down Expand Up @@ -79,7 +79,7 @@ The `IdentityManager` stores an array containing all existing model instances an
The identities for models are stored as string, created using the following class.

```
Sprocketbox\Eloquent\Identity\ModelIdentity
OllieCodes\Eloquent\Identity\ModelIdentity
```

This contains a key, the model class name, and the connection name. The string version of these looks like so:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sprocketbox/eloquent-identity",
"name": "olliecodes/eloquent-identity",
"description": "An identity map implementation for Eloquent",
"keywords": [
"laravel",
Expand All @@ -12,12 +12,12 @@
"authors": [
{
"name": "Ollie Read",
"email": "[email protected]"
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Sprocketbox\\Eloquent\\Identity\\": "src/"
"OllieCodes\\Eloquent\\Identity\\": "src/"
}
},
"require": {
Expand All @@ -27,7 +27,7 @@
"extra": {
"laravel": {
"providers": [
"Sprocketbox\\Eloquent\\Identity\\ServiceProvider"
"OllieCodes\\Eloquent\\Identity\\ServiceProvider"
],
"facades": [
"Identity"
Expand Down
35 changes: 0 additions & 35 deletions phpunit.xml.dist

This file was deleted.

14 changes: 7 additions & 7 deletions src/Concerns/MapsIdentity.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php /** @noinspection PhpUndefinedMethodInspection */

namespace Sprocketbox\Eloquent\Identity\Concerns;
namespace OllieCodes\Eloquent\Identity\Concerns;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Facades\Date;
use Laravel\Nova\Fields\BelongsToMany;
use LogicException;
use Sprocketbox\Eloquent\Identity\Facades\Identity;
use Sprocketbox\Eloquent\Identity\ModelIdentity;
use Sprocketbox\Eloquent\Identity\Query\Builder;
use OllieCodes\Eloquent\Identity\Facades\Identity;
use OllieCodes\Eloquent\Identity\ModelIdentity;
use OllieCodes\Eloquent\Identity\Query\Builder;

/**
* MapsIdentity
*
* This trait provides identity map functionality for Eloquent models.
*
* @package Sprocketbox\Eloquent\Identity\Concerns
* @package OllieCodes\Eloquent\Identity\Concerns
*/
trait MapsIdentity
{
Expand Down Expand Up @@ -76,7 +76,7 @@ public function newFromBuilder($attributes = [], $connection = null): Model
* @param null $id
* @param string|null $connection
*
* @return \Sprocketbox\Eloquent\Identity\ModelIdentity
* @return \OllieCodes\Eloquent\Identity\ModelIdentity
*/
public function getModelIdentity($id = null, ?string $connection = null): ModelIdentity
{
Expand All @@ -90,7 +90,7 @@ public function getModelIdentity($id = null, ?string $connection = null): ModelI
*
* @param \Illuminate\Database\Query\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder|\Sprocketbox\Eloquent\Identity\Query\Builder|static
* @return \Illuminate\Database\Eloquent\Builder|\OllieCodes\Eloquent\Identity\Query\Builder|static
*/
public function newEloquentBuilder($query)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Facades/Identity.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Sprocketbox\Eloquent\Identity\Facades;
namespace OllieCodes\Eloquent\Identity\Facades;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Facade;
use Sprocketbox\Eloquent\Identity\IdentityManager;
use Sprocketbox\Eloquent\Identity\ModelIdentity;
use OllieCodes\Eloquent\Identity\IdentityManager;
use OllieCodes\Eloquent\Identity\ModelIdentity;

/**
* Identity Facade
Expand All @@ -17,7 +17,7 @@
* @method static IdentityManager removeIdentity(ModelIdentity $identity)
* @method static array allIdentities()
*
* @package Sprocketbox\Eloquent\Identity\Facades
* @package OllieCodes\Eloquent\Identity\Facades
*/
class Identity extends Facade
{
Expand Down
20 changes: 10 additions & 10 deletions src/IdentityManager.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?php

namespace Sprocketbox\Eloquent\Identity;
namespace OllieCodes\Eloquent\Identity;

use Illuminate\Database\Eloquent\Model;

/**
* Eloquence
*
* @package Sprocketbox\Eloquent\Identity
* @package OllieCodes\Eloquent\Identity
*/
class IdentityManager
{
/**
* The current instance.
*
* @var \Sprocketbox\Eloquent\Identity\IdentityManager
* @var \OllieCodes\Eloquent\Identity\IdentityManager
*/
protected static IdentityManager $instance;

/**
* Get the current Eloquence instance.
*
* @return \Sprocketbox\Eloquent\Identity\IdentityManager
* @return \OllieCodes\Eloquent\Identity\IdentityManager
*/
public static function getInstance(): IdentityManager
{
Expand All @@ -42,7 +42,7 @@ public static function getInstance(): IdentityManager
/**
* Check if the identity is already stored.
*
* @param \Sprocketbox\Eloquent\Identity\ModelIdentity $identity
* @param \OllieCodes\Eloquent\Identity\ModelIdentity $identity
*
* @return bool
*/
Expand All @@ -54,7 +54,7 @@ public function hasIdentity(ModelIdentity $identity): bool
/**
* Get the stored model for the given identity.
*
* @param \Sprocketbox\Eloquent\Identity\ModelIdentity $identity
* @param \OllieCodes\Eloquent\Identity\ModelIdentity $identity
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
Expand All @@ -66,8 +66,8 @@ public function getIdentity(ModelIdentity $identity): ?Model
/**
* Set the model for the current identity.
*
* @param \Sprocketbox\Eloquent\Identity\ModelIdentity $identity
* @param \Illuminate\Database\Eloquent\Model $model
* @param \OllieCodes\Eloquent\Identity\ModelIdentity $identity
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return $this
*/
Expand All @@ -81,7 +81,7 @@ public function storeIdentity(ModelIdentity $identity, Model $model): IdentityMa
/**
* Remove a model from the identity map.
*
* @param \Sprocketbox\Eloquent\Identity\ModelIdentity $identity
* @param \OllieCodes\Eloquent\Identity\ModelIdentity $identity
*
* @return $this
*/
Expand Down Expand Up @@ -119,7 +119,7 @@ public function allIdentities(): array
/**
* Turn the model identity into a string.
*
* @param \Sprocketbox\Eloquent\Identity\ModelIdentity $identity
* @param \OllieCodes\Eloquent\Identity\ModelIdentity $identity
*
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/ModelIdentity.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\Eloquent\Identity;
namespace OllieCodes\Eloquent\Identity;

class ModelIdentity
{
Expand Down
8 changes: 4 additions & 4 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\Eloquent\Identity\Query;
namespace OllieCodes\Eloquent\Identity\Query;

use Closure;
use Illuminate\Contracts\Support\Arrayable;
Expand All @@ -10,9 +10,9 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Str;
use Sprocketbox\Eloquent\Identity\Concerns\MapsIdentity;
use Sprocketbox\Eloquent\Identity\Facades\Identity;
use Sprocketbox\Eloquent\Identity\ModelIdentity;
use OllieCodes\Eloquent\Identity\Concerns\MapsIdentity;
use OllieCodes\Eloquent\Identity\Facades\Identity;
use OllieCodes\Eloquent\Identity\ModelIdentity;

class Builder extends EloquentBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\Eloquent\Identity;
namespace OllieCodes\Eloquent\Identity;

use Illuminate\Support\ServiceProvider as BaseServiceProvider;

Expand Down

0 comments on commit 081cb6a

Please sign in to comment.