Skip to content

Commit

Permalink
added the hard deletion feature to the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
philiplb committed Nov 27, 2017
1 parent 63f9825 commit 5567915
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
23 changes: 21 additions & 2 deletions docs/api/EntityDefinition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ CRUDlex\\EntityDefinition

Holds the initial sort order.

.. php:attr:: hardDeletion
protected bool

Holds whether hard deletion is activated.

.. php:attr:: navBarGroup
protected string
Expand Down Expand Up @@ -367,17 +373,30 @@ CRUDlex\\EntityDefinition

.. php:method:: setInitialSortAscending($initialSortAscending)
Sets the initial sort order.
Sets whether the initial sort order is ascending.

:type $initialSortAscending: boolean
:param $initialSortAscending: the initial sort order, true if ascending

.. php:method:: isInitialSortAscending()
Gets the initial sort order.
Gets whether the initial sort order is ascending.

:returns: boolean the initial sort order, true if ascending

.. php:method:: setHardDeletion($hardDeletion)
Sets the hard deletion state.

:type $hardDeletion: boolean
:param $hardDeletion: the hard deletion state

.. php:method:: isHardDeletion()
Gets the hard deletion state.

:returns: boolean the hard deletion state

.. php:method:: getNavBarGroup()
Gets the navigation bar group where the entity belongs.
Expand Down
20 changes: 20 additions & 0 deletions docs/api/MySQLData.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ CRUDlex\\MySQLData

Holds the events.

.. php:method:: addSoftDeletionToQuery(EntityDefinition $definition, QueryBuilder $queryBuilder, $fieldPrefix = '', $method = 'andWhere')
Adds the soft deletion parameters if activated.

:type $definition: EntityDefinition
:param $definition: the entity definition which might have soft deletion activated
:type $queryBuilder: QueryBuilder
:param $queryBuilder: the query builder to add the deletion condition to
:type $fieldPrefix: string
:param $fieldPrefix: the prefix to add before the deleted_at field like an table alias
:type $method: string
:param $method: the method to use of the query builder, "where" or "andWhere"

.. php:method:: setValuesAndParameters(Entity $entity, QueryBuilder $queryBuilder, $setMethod)
Sets the values and parameters of the upcoming given query according
Expand All @@ -70,6 +83,13 @@ CRUDlex\\MySQLData
:param $id: the current entities id
:returns: boolean true if the entity still has children

.. php:method:: deleteManyToManyReferences(Entity $entity)
Deletes any many to many references pointing to the given entity.

:type $entity: Entity
:param $entity: the referenced entity

.. php:method:: doDelete(Entity $entity, $deleteCascade)
{@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions docs/manual/crudyamlreference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ required, along with the default value or behaviour.
# the label which should be displayed if the "de" is selected as language
label_de: Bücher
table: book
# database entries will be hard deleted for this entry
hardDeletion: true
fields:
title:
type: text
Expand Down
1 change: 1 addition & 0 deletions docs/manual/datastructures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ more fields per table:
updated
* deleted_at datetime DEFAULT NULL: defines when this entry was deleted in UTC.
CRUDlex uses a soft delete mechanism hiding all rows where this is not null
(only if hard deletion is not activated)
* version int(11) NOT NULL: used for optimistic locking

See the CRUDlexSample.sql in the `sample <https://github.com/philiplb/CRUDlexSample>`_
Expand Down
19 changes: 19 additions & 0 deletions docs/manual/extendedfeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@ Currently, the listview contains all entries on the pages. Often, it is desirabl
type: integer
label: Pages
-------------
Hard Deletion
-------------

By default, CRUDlex uses a soft deletion mechanism by only setting a deleted_at field. Hard deletion from the database
can be activated though via the "hardDeletion" flag like this:

.. code-block:: yaml
library:
table: library
hardDeletion: true
fields:
name:
type: text
label: Name
If activated, the column "deleted_at" is not needed in the entities table.

------------------------------------
Group entities in the Navigation Bar
------------------------------------
Expand Down

0 comments on commit 5567915

Please sign in to comment.