\midcom_baseclasses_core_dbobject

This class only contains static functions which are there to hook into the classes you derive from the midcom_core_dbaobject.

The static members will invoke a number of callback methods so that you should normally never have to override the base midgard methods like update or the like.

Summary

Methods
Properties
Constants
update_pre_checks()
update()
update_post_ops()
create_pre_checks()
create()
create_post_ops()
delete()
delete_tree()
delete_post_ops()
undelete()
undelete_parameters()
undelete_attachments()
purge()
purge_parameters()
purge_attachments()
post_db_load_checks()
refresh()
get_by_id()
get_by_guid()
get_by_path()
is_object_visible_onsite()
delete_pre_checks()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_set_owner_privileges()
_pre_check_name()
_delete_privileges()
No private properties found
N/A

Methods

update_pre_checks()

update_pre_checks(\midcom_core_dbaobject  $object) 

"Pre-flight" checks for update method

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

update()

update(\midcom_core_dbaobject  $object) : boolean

Execute a DB update of the object passed. This will call the corresponding event handlers. Calling sequence with method signatures:

  1. Validate privileges using can_do. The user needs midgard:update privilege on the content object.
  2. bool $object->_on_updating() is executed. If it returns false, update is aborted.
  3. bool $object->__object->update() is executed to do the actual DB update. This has to execute parent::update() and return its value, nothing else.
  4. void $object->_on_updated() is executed to notify the class from a successful DB update.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating success.

update_post_ops()

update_post_ops(\midcom_core_dbaobject  $object) 

Post object creation operations for create

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

create_pre_checks()

create_pre_checks(\midcom_core_dbaobject  $object) 

"Pre-flight" checks for create method

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

create()

create(\midcom_core_dbaobject  $object) : boolean

Execute a DB create of the object passed. This will call the corresponding event handlers. Calling sequence with method signatures:

  1. Validate privileges using can_do. The user needs midgard:create privilege to the parent object or in general, if there is no parent.
  2. bool $object->_on_creating() is executed. If it returns false, create is aborted.
  3. bool $object->__object->create() is executed to do the actual DB create. This has to execute parent::create() and return its value, nothing else.
  4. void $object->_on_created() is executed to notify the class from a successful DB creation.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating success.

create_post_ops()

create_post_ops(\midcom_core_dbaobject  $object) 

Post object creation operations for create

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

delete()

delete(\midcom_core_dbaobject  $object) : boolean

Execute a DB delete of the object passed. This will call the corresponding event handlers. Calling sequence with method signatures:

  1. Validate privileges using can_do. The user needs midgard:delete privilege on the content object.
  2. bool $object->_on_deleting() is executed. If it returns false, delete is aborted.
  3. All extensions of the object are deleted
  4. bool $object->__object->delete() is executed to do the actual DB delete. This has to execute parent::delete() and return its value, nothing else.
  5. void $object->_on_deleted() is executed to notify the class from a successful DB deletion.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating success.

delete_tree()

delete_tree(\midcom_core_dbaobject  $object) : boolean

Execute a DB delete of the object passed and delete its descendants. This will call the corresponding event handlers. Calling sequence with method signatures:

  1. Get all of the child objects
  2. Delete them recursively starting from the top, working towards the root
  3. Finally delete the root object

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating success.

delete_post_ops()

delete_post_ops(\midcom_core_dbaobject  $object) 

Post object creation operations for delete

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

undelete()

undelete(array  $guids) : integer

Undelete objects

Parameters

array $guids

Returns

integer —

Size of undeleted objects

undelete_parameters()

undelete_parameters(string  $guid) : integer

Recover the parameters related to a deleted object

Parameters

string $guid

Returns

integer —

Size of undeleted objects

undelete_attachments()

undelete_attachments(string  $guid) : integer

Recover the attachments related to a deleted object

Parameters

string $guid

Returns

integer —

Size of undeleted objects

purge()

purge(array  $guids, string  $type) : integer

Purge objects

Parameters

array $guids
string $type

Returns

integer —

Size of purged objects

purge_parameters()

purge_parameters(string  $guid) : integer

Purge the parameters related to a deleted object

Parameters

string $guid

Returns

integer —

Size of purged objects

purge_attachments()

purge_attachments(string  $guid) : integer

Purge the attachments related to a deleted object

Parameters

string $guid

Returns

integer —

Size of purged objects

post_db_load_checks()

post_db_load_checks(\midcom_core_dbaobject  $object) 

After we instantiated the midgard object do some post processing and ACL checks

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

refresh()

refresh(\midcom_core_dbaobject  $object) : boolean

This is a simple wrapper with (currently) no additional functionality over get_by_id that resynchronizes the object state with the database.

Use this if you think that your current object is stale. It does full access control.

On any failure, the object is cleared.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating Success

get_by_id()

get_by_id(\midcom_core_dbaobject  $object, integer  $id) : boolean

This call wraps the original get_by_id call to provide access control.

The calling sequence is as with the corresponding constructor.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

integer $id

The id of the object to load from the database.

Returns

boolean —

Indicating Success

get_by_guid()

get_by_guid(\midcom_core_dbaobject  $object, string  $guid) : boolean

This call wraps the original get_by_guid call to provide access control.

The calling sequence is as with the corresponding constructor.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

string $guid

The guid of the object to load from the database.

Returns

boolean —

Indicating Success

get_by_path()

get_by_path(\midcom_core_dbaobject  $object, string  $path) : boolean

This call wraps the original get_by_guid call to provide access control.

The calling sequence is as with the corresponding constructor.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

string $path

The path of the object to load from the database.

Returns

boolean —

Indicating Success

is_object_visible_onsite()

is_object_visible_onsite(\midcom_core_dbaobject  $object) : boolean

This is a metadata helper that maps to the metadata onsite visibility check function, making checks against visibility far easier.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

Returns

boolean —

Indicating visibility state.

delete_pre_checks()

delete_pre_checks(\midcom_core_dbaobject  $object) 

"Pre-flight" checks for delete method

Separated so that dbfactory->import() can reuse the code

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

_set_owner_privileges()

_set_owner_privileges(\midcom_core_dbaobject  $object) 

Add full privileges to the owner of the object.

This is essentially sets the midgard:owner privilege for the current user.

Parameters

\midcom_core_dbaobject $object

The DBA object we're working on

_delete_privileges()

_delete_privileges(\midcom_core_dbaobject  $object) : boolean

Unconditionally drop all privileges assigned to the given object.

Called upon successful delete

Parameters

\midcom_core_dbaobject $object

Returns

boolean —

Indicating Success.