Detailed Description
Class provides routine for ownership relations.
- Author
- Dodonov A.A.
Definition at line 29 of file ownership_access.php.
Constructor & Destructor Documentation
Constructor.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 69 of file ownership_access.php.
{
try
{
$this->Link =
get_package(
'link' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
| add_owner |
( |
|
$Object1Id, |
|
|
|
$Object2Id, |
|
|
|
$Object1Type, |
|
|
|
$Object2Type |
|
) |
| |
Creation of the relationship.
- Parameters
-
| $Object1Id | - Id of the first object. |
| $Object2Id | - Id of the second object. |
| $Object1Type | - Type of the first object. |
| $Object2Type | - Type of the second object. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 111 of file ownership_access.php.
{
try
{
$this->Link->create_link( $Object1Id , $Object2Id , $Object1Type , $Object2Type , true );
}
catch( Exception $e )
{
}
}
| delete_owner |
( |
|
$Object1Id, |
|
|
|
$Object2Id, |
|
|
|
$Object1Type, |
|
|
|
$Object2Type |
|
) |
| |
Function deletes relationship.
- Parameters
-
| $Object1Id | - Id of the first object. |
| $Object2Id | - Id of the second object. |
| $Object1Type | - Type of the first object. |
| $Object2Type | - Type of the second object. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 153 of file ownership_access.php.
{
try
{
$this->Link->delete_link( $Object1Id , $Object2Id , $Object1Type , $Object2Type , true );
}
catch( Exception $e )
{
}
}
| object_has_owner |
( |
|
$ObjectId, |
|
|
|
$ObjectType |
|
) |
| |
Function validates relationship.
- Parameters
-
| $ObjectId | - Id of the object. |
| $ObjectType | - Type of the object. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 234 of file ownership_access.php.
{
try
{
if( $this->Owners === false )
{
throw( new Exception( "No owners were registered" ) );
}
foreach( $this->Owners as $i => $Owner )
{
if( $this->Link->link_exists( $Owner[ 'id' ] , $ObjectId , $Owner[ 'type' ] , $ObjectType ) )
{
return( true );
}
}
return( false );
}
catch( Exception $e )
{
}
}
| owner_was_registered |
( |
|
$ObjectId, |
|
|
|
$ObjectType |
|
) |
| |
Function validates owner existence.
- Parameters
-
| $ObjectId | - Id of the object. |
| $ObjectType | - Type of the object. |
- Returns
- true if the owner was registered.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 285 of file ownership_access.php.
{
try
{
if( $this->Owners === false )
{
return( false );
}
foreach( $this->Owners as $i => $Owner )
{
if( $Owner[ 'id' ] == $ObjectId && $Owner[ 'type' ] == $ObjectType )
{
return( true );
}
}
return( false );
}
catch( Exception $e )
{
}
}
| register_owner |
( |
|
$OwnerId, |
|
|
|
$OwnerType |
|
) |
| |
Function registers owner.
- Parameters
-
| $OwnerId | - Id of the owner. |
| $OwnerType | - Type of the owner. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 187 of file ownership_access.php.
{
try
{
if( $this->Owners === false )
{
$this->Owners = array();
}
foreach( $this->Owners as $i => $Owner )
{
if( $Owner[ 'id' ] == $OwnerId && $Owner[ 'type' ] == $OwnerType )
{
return;
}
}
$this->Owners [] = array( 'id' => $OwnerId , 'type' => $OwnerType );
}
catch( Exception $e )
{
}
}
Field Documentation
The documentation for this class was generated from the following file: