-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 Continued implementing support for many-to-many relationships
- Loading branch information
Showing
10 changed files
with
77 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
* | ||
* Thrown when a requested entity does not exist in storage. | ||
* | ||
* TODO: Enforce the entity name via the constructor and provide a convenient factory method | ||
* | ||
* @author Chris Andrew <[email protected]> | ||
*/ | ||
class EntityNotFoundException extends RuntimeException | ||
|
@@ -17,16 +19,16 @@ class EntityNotFoundException extends RuntimeException | |
* | ||
* @var string | ||
*/ | ||
protected $entity; | ||
protected string $entity; | ||
|
||
/** | ||
* Get the name of the entity. | ||
* | ||
* @return string | ||
*/ | ||
public function getEntityName() | ||
public function getEntityName(): string | ||
{ | ||
return $this->entity; | ||
return $this->entity ?? ''; | ||
} | ||
|
||
/** | ||
|
@@ -35,7 +37,7 @@ public function getEntityName() | |
* @param string $entity | ||
* @return $this | ||
*/ | ||
public function setEntityName($entity) | ||
public function setEntityName(string $entity) | ||
{ | ||
$this->entity = $entity; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Darya\ORM\Exception; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
/** | ||
* Darya's mapping exception. | ||
* | ||
* Thrown for entity mapping related errors. | ||
* | ||
* @author Chris Andrew <[email protected]> | ||
*/ | ||
class MappingException extends RuntimeException | ||
{ | ||
public static function unknownStorage(string $storage, Throwable $previous = null): self { | ||
return new static("Unknown storage '$storage'", null, $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters