Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
added set-default-author to metadata (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored and danrot committed Jun 21, 2017
1 parent a6e1dfd commit cfb4258
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
CHANGELOG for Sulu Document Manager
===================================

* dev-develop
* FEATURE #116 Added set-default-author to metadata

* 0.10.0-RC1 (2017-06-01)
* BUGFIX #113 Updated ProxyManager to be compatible with PHP 7
* BUGFIX #112 Fixed overwrite of exist created date.
Expand Down
25 changes: 25 additions & 0 deletions lib/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ class Metadata
*/
private $syncRemoveLive = true;

/**
* @var bool
*/
private $setDefaultAuthor = true;

/**
* Add a field mapping for field with given name, for example.
*
Expand Down Expand Up @@ -213,4 +218,24 @@ public function setSyncRemoveLive($syncRemoveLive)
{
$this->syncRemoveLive = $syncRemoveLive;
}

/**
* Returns set-default-author.
*
* @return bool
*/
public function getSetDefaultAuthor()
{
return $this->setDefaultAuthor;
}

/**
* Set setDefaultAuthor.
*
* @param bool $setDefaultAuthor
*/
public function setDefaultAuthor($setDefaultAuthor)
{
$this->setDefaultAuthor = $setDefaultAuthor;
}
}
4 changes: 4 additions & 0 deletions lib/Metadata/BaseMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ private function loadMetadata($mapping)
'form_type' => null,
'class' => null,
'mapping' => [],
'sync_remove_live' => true,
'set_default_author' => true,
], $mapping);

if (isset($this->metadata[$mapping['alias']])) {
Expand All @@ -209,6 +211,8 @@ private function loadMetadata($mapping)
$metadata->setPhpcrType($mapping['phpcr_type']);
$metadata->setFormType($mapping['form_type']);
$metadata->setClass($mapping['class']);
$metadata->setSyncRemoveLive($mapping['sync_remove_live']);
$metadata->setDefaultAuthor($mapping['set_default_author']);

foreach ($mapping['mapping'] as $fieldName => $fieldMapping) {
$fieldMapping = array_merge([
Expand Down

0 comments on commit cfb4258

Please sign in to comment.