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

Commit

Permalink
Updated docblocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Feb 19, 2015
1 parent 516cac7 commit dc544c0
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 150 deletions.
2 changes: 1 addition & 1 deletion conf/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

return (object) [
Expand Down
9 changes: 3 additions & 6 deletions src/DataObjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
/**
* Data Object interface.
*
* Objects which hold data from some type of storage.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/

/**
* Objects which hold data from some type of storage.
* @package Nymph
* @link http://nymph.io/
*/
interface DataObjectInterface {
/**
Expand Down
8 changes: 2 additions & 6 deletions src/Drivers/DriverInterface.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?php namespace Nymph\Drivers;

/**
* Nymph driver interface.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/

/**
* Nymph database abstraction layer or object relational mapper.
* @package Nymph
* @link http://nymph.io/
*/
interface DriverInterface {
public function connect();
Expand Down
13 changes: 4 additions & 9 deletions src/Drivers/DriverTrait.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<?php namespace Nymph\Drivers;
/**
* Common Nymph driver methods.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/
use Nymph\Exceptions;

/**
Expand All @@ -16,6 +7,10 @@
* Provides basic methods for a Nymph ORM driver.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://nymph.io/
*/
trait DriverTrait {
/**
Expand Down
13 changes: 4 additions & 9 deletions src/Drivers/MySQLDriver.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?php namespace Nymph\Drivers;
use Nymph\Exceptions;

/**
* MySQLDriver class.
* MySQL based Nymph driver.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/
use Nymph\Exceptions;

/**
* MySQL ORM based Nymph driver.
*
* @package Nymph
* @link http://nymph.io/
*/
class MySQLDriver implements DriverInterface {
use DriverTrait {
Expand Down
13 changes: 4 additions & 9 deletions src/Drivers/PostgreSQLDriver.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?php namespace Nymph\Drivers;
use Nymph\Exceptions;

/**
* PostgreSQLDriver class.
* PostgreSQL based Nymph driver.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/
use Nymph\Exceptions;

/**
* PostgreSQL ORM based Nymph driver.
*
* @package Nymph
* @link http://nymph.io/
*/
class PostgreSQLDriver implements DriverInterface {
use DriverTrait {
Expand Down
72 changes: 64 additions & 8 deletions src/Entity.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,74 @@
<?php namespace Nymph;

/**
* Entity class.
* Database abstraction object.
*
* Used to provide a standard, abstract way to access, manipulate, and store
* data.
*
* The GUID is not set until the entity is saved. GUIDs must be unique forever,
* even after deletion. It's the job of the entity manager to make sure no two
* entities ever have the same GUID.
*
* Tags are used to classify entities. Where an etype is used to separate data
* by table, tags are used to separate entities within a table. You can define
* specific tags to be protected, meaning they cannot be added/removed on the
* frontend. It can be useful to allow user defined tags, such as for a blog
* post.
*
* Simply calling delete() will not unset the entity. It will still take up
* memory. Likewise, simply calling unset will not delete the entity from
* storage.
*
* Some notes about equals() and is():
*
* equals() performs a more strict comparison of the entity to another. Use
* equals() instead of the == operator, because the cached entity data causes ==
* to return false when it should return true. In order to return true, the
* entity and $object must meet the following criteria:
*
* - They must be entities.
* - They must have equal GUIDs. (Or both can have no GUID.)
* - They must be instances of the same class.
* - Their data must be equal.
*
* is() performs a less strict comparison of the entity to another. Use is()
* instead of the == operator when the entity's data may have been changed, but
* you only care if it is the same entity. In order to return true, the entity
* and $object must meet the following criteria:
*
* - They must be entities.
* - They must have equal GUIDs. (Or both can have no GUID.)
* - If they have no GUIDs, their data must be equal.
*
* Some notes about saving entities in other entity's variables:
*
* The entity class often uses references to store an entity in another entity's
* variable or array. The reference is stored as an array with the values:
*
* - 0 => The string 'nymph_entity_reference'
* - 1 => The reference entity's GUID.
* - 2 => The reference entity's class name.
*
* Since the reference entity's class name is stored in the reference on the
* entity's first save and used to retrieve the reference entity using the same
* class, if you change the class name in an update, you need to reassign the
* reference entity and save to storage.
*
* When an entity is loaded, it does not request its referenced entities from
* the entity manager. This is done the first time the variable/array is
* accessed. The referenced entity is then stored in a cache, so if it is
* altered elsewhere, then accessed again through the variable, the changes will
* *not* be there. Therefore, you should take great care when accessing entities
* from multiple variables. If you might be using a referenced entity again
* later in the code execution (after some other processing occurs), it's
* recommended to call clearCache().
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
*/

/**
* Database abstraction object.
*
* @package Nymph
* @link http://nymph.io/
* @property int $guid The entity's Globally Unique ID.
* @property int $cdate The entity's creation date, as a Unix timestamp.
* @property int $mdate The entity's modification date, as a Unix timestamp.
Expand Down
65 changes: 2 additions & 63 deletions src/EntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,11 @@
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

/**
* Database abstraction object.
*
* Used to provide a standard, abstract way to access, manipulate, and store
* data.
*
* The GUID is not set until the entity is saved. GUIDs must be unique forever,
* even after deletion. It's the job of the entity manager to make sure no two
* entities ever have the same GUID.
*
* Tags are used to classify entities. Where an etype is used to separate data
* by table, tags are used to separate entities within a table. You can define
* specific tags to be protected, meaning they cannot be added/removed on the
* frontend. It can be useful to allow user defined tags, such as for a blog
* post.
*
* Simply calling delete() will not unset the entity. It will still take up
* memory. Likewise, simply calling unset will not delete the entity from
* storage.
*
* Some notes about equals() and is():
*
* equals() performs a more strict comparison of the entity to another. Use
* equals() instead of the == operator, because the cached entity data causes ==
* to return false when it should return true. In order to return true, the
* entity and $object must meet the following criteria:
*
* - They must be entities.
* - They must have equal GUIDs. (Or both can have no GUID.)
* - They must be instances of the same class.
* - Their data must be equal.
*
* is() performs a less strict comparison of the entity to another. Use is()
* instead of the == operator when the entity's data may have been changed, but
* you only care if it is the same entity. In order to return true, the entity
* and $object must meet the following criteria:
*
* - They must be entities.
* - They must have equal GUIDs. (Or both can have no GUID.)
* - If they have no GUIDs, their data must be equal.
*
* Some notes about saving entities in other entity's variables:
*
* The entity class often uses references to store an entity in another entity's
* variable or array. The reference is stored as an array with the values:
*
* - 0 => The string 'nymph_entity_reference'
* - 1 => The reference entity's GUID.
* - 2 => The reference entity's class name.
*
* Since the reference entity's class name is stored in the reference on the
* entity's first save and used to retrieve the reference entity using the same
* class, if you change the class name in an update, you need to reassign the
* reference entity and save to storage.
*
* When an entity is loaded, it does not request its referenced entities from
* the entity manager. This is done the first time the variable/array is
* accessed. The referenced entity is then stored in a cache, so if it is
* altered elsewhere, then accessed again through the variable, the changes will
* *not* be there. Therefore, you should take great care when accessing entities
* from multiple variables. If you might be using a referenced entity again
* later in the code execution (after some other processing occurs), it's
* recommended to call clearCache().
* Entity interface.
*
* @package Nymph
* @property int $guid The GUID of the entity.
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/EntityCorruptedException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Nymph\Exceptions;

/**
* EntityCorruptedException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class EntityCorruptedException extends \Exception {}
4 changes: 2 additions & 2 deletions src/Exceptions/EntityInvalidDataException.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace Nymph\Exceptions;

/**
* EntityInvalidDataException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class EntityInvalidDataException extends \Exception {
private $fields = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/InvalidParametersException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Nymph\Exceptions;

/**
* InvalidParametersException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class InvalidParametersException extends \InvalidArgumentException {}
4 changes: 2 additions & 2 deletions src/Exceptions/NotConfiguredException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Nymph\Exceptions;

/**
* NotConfiguredException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class NotConfiguredException extends \Exception {}
4 changes: 2 additions & 2 deletions src/Exceptions/QueryFailedException.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace Nymph\Exceptions;

/**
* QueryFailedException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class QueryFailedException extends \Exception {
protected $query;
public function __construct($message, $code, $previous, $query = null) {
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/UnableToConnectException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Nymph\Exceptions;

/**
* UnableToConnectException exception.
*
* @package Nymph
* @license http://www.gnu.org/licenses/lgpl.html
* @author Hunter Perrin <[email protected]>
* @copyright SciActive.com
* @link http://sciactive.com/
* @link http://nymph.io/
*/

class UnableToConnectException extends \Exception {}
Loading

0 comments on commit dc544c0

Please sign in to comment.