FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Entity Class Reference

Entity manager component. More...

Inheritance diagram for Entity:
Component Thing

Public Member Functions

 item ($type, $id)
 Retrieve an entity, or create a new if nonexistence. More...
 
 has ($type, $id)
 Check if an entity already exists. More...
 
 flush ($type=null, $id=null)
 Flush entities. More...
 
 __call ($func_name, $params)
 
 __invoke ($type, $id)
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

 $classNames = []
 Classnames for item types (key = type, value = class name). More...
 
 $defaultNamespace = ''
 Namespace to look for an item class (ucfirst(id)) when not found in classNames. More...
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Attributes

 $_entities = []
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Additional Inherited Members

- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Detailed Description

Entity manager component.

Definition at line 8 of file Entity.php.

Member Function Documentation

◆ __call()

__call (   $func_name,
  $params 
)

Definition at line 51 of file Entity.php.

◆ __invoke()

__invoke (   $type,
  $id 
)

Definition at line 55 of file Entity.php.

◆ flush()

flush (   $type = null,
  $id = null 
)

Flush entities.

Parameters
string$typeEntity type (empty to flush al entities).
string$idEntity ID (empty to flush all entities of this type).

Definition at line 44 of file Entity.php.

◆ has()

has (   $type,
  $id 
)

Check if an entity already exists.

Parameters
string$typeEntity type.
string$idEntity ID.
Returns
bool True if the entity exists.

Definition at line 36 of file Entity.php.

◆ item()

item (   $type,
  $id 
)

Retrieve an entity, or create a new if nonexistence.

Parameters
string$typeEntity type.
string$id,...Entity ID, and other parameters - passed when creating a new entity.
Returns
object Entity.

Definition at line 21 of file Entity.php.

Field Documentation

◆ $_entities

$_entities = []
protected

Definition at line 13 of file Entity.php.

◆ $classNames

$classNames = []

Classnames for item types (key = type, value = class name).

Definition at line 10 of file Entity.php.

◆ $defaultNamespace

$defaultNamespace = ''

Namespace to look for an item class (ucfirst(id)) when not found in classNames.

Definition at line 11 of file Entity.php.


The documentation for this class was generated from the following file: