-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
namespace Magomogo\Persisted; | ||
|
||
use Magomogo\Persisted\Container\ContainerInterface; | ||
|
||
interface PropertiesInterface | ||
{ | ||
/** | ||
* Returns unique identifier in given container | ||
* | ||
* @param ContainerInterface $container | ||
* @return mixed | ||
*/ | ||
public function id($container); | ||
|
||
/** | ||
* Optionally defines natural key value | ||
* null value forces container to set its artificial identifier | ||
* | ||
* @return mixed | ||
*/ | ||
public function naturalKey(); | ||
|
||
/** | ||
* The message. A container stored properties giving particular identifier | ||
* | ||
* @param mixed $id | ||
* @param ContainerInterface $container | ||
*/ | ||
public function persisted($id, $container); | ||
|
||
/** | ||
* Load all values from the container | ||
* | ||
* @param ContainerInterface$container | ||
* @param mixed $id | ||
* @return $this | ||
*/ | ||
public function loadFrom($container, $id); | ||
|
||
/** | ||
* Save all value to the container | ||
* | ||
* @param ContainerInterface $container | ||
* @return string unique identifier | ||
*/ | ||
public function putIn($container); | ||
|
||
/** | ||
* Delete this properties form the container | ||
* | ||
* @param ContainerInterface $container | ||
* @return void | ||
*/ | ||
public function deleteFrom($container); | ||
|
||
/** | ||
* Copy state to another properties of same type | ||
* | ||
* @param self $properties | ||
* @return self | ||
*/ | ||
public function copyTo($properties); | ||
} |
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