Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brookinsconsulting committed Aug 29, 2018
2 parents 6424544 + 4803c63 commit dbd1f59
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Persistence/Handler.php
Expand Up @@ -78,6 +78,11 @@ public function bookmarkHandler();
*/
public function notificationHandler();

/**
* @return \eZ\Publish\SPI\Persistence\UserPreference\Handler
*/
public function userPreferenceHandler();

/**
* @return \eZ\Publish\SPI\Persistence\TransactionHandler
*/
Expand Down
47 changes: 47 additions & 0 deletions Persistence/UserPreference/Handler.php
@@ -0,0 +1,47 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\SPI\Persistence\UserPreference;

interface Handler
{
/**
* Store UserPreference ValueObject in persistent storage.
*
* @param \eZ\Publish\SPI\Persistence\UserPreference\UserPreferenceSetStruct $setStruct
*
* @return \eZ\Publish\SPI\Persistence\UserPreference\UserPreference
*/
public function setUserPreference(UserPreferenceSetStruct $setStruct): UserPreference;

/**
* Get UserPreference by its user ID and name.
*
* @param int $userId
* @param string $name
*
* @return \eZ\Publish\SPI\Persistence\UserPreference\UserPreference
*/
public function getUserPreferenceByUserIdAndName(int $userId, string $name): UserPreference;

/**
* @param int $userId
* @param int $offset
* @param int $limit
*
* @return \eZ\Publish\SPI\Persistence\UserPreference\UserPreference[]
*/
public function loadUserPreferences(int $userId, int $offset, int $limit): array;

/**
* @param int $userId
*
* @return int
*/
public function countUserPreferences(int $userId): int;
}
46 changes: 46 additions & 0 deletions Persistence/UserPreference/UserPreference.php
@@ -0,0 +1,46 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\SPI\Persistence\UserPreference;

use eZ\Publish\SPI\Persistence\ValueObject;

class UserPreference extends ValueObject
{
/**
* ID of the user preference.
*
* @var int
*/
public $id;

/**
* The ID of the user this user preference belongs to.
*
* @var int
*/
public $userId;

/**
* Name of user preference.
*
* Eg: timezone
*
* @var string
*/
public $name;

/**
* Value of user preference.
*
* Eg: America/New_York
*
* @var string
*/
public $value;
}
29 changes: 29 additions & 0 deletions Persistence/UserPreference/UserPreferenceSetStruct.php
@@ -0,0 +1,29 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\SPI\Persistence\UserPreference;

use eZ\Publish\SPI\Persistence\ValueObject;

class UserPreferenceSetStruct extends ValueObject
{
/**
* @var int
*/
public $userId;

/**
* @var string
*/
public $name;

/**
* @var string
*/
public $value;
}
2 changes: 1 addition & 1 deletion Tests/FieldType/AuthorIntegrationTest.php
Expand Up @@ -92,7 +92,7 @@ public function getFieldDefinitionData()
array(
'fieldSettings' => new FieldType\FieldSettings(
array(
'defaultAuthor' => 1,
'defaultAuthor' => 0,
)
),
)
Expand Down

0 comments on commit dbd1f59

Please sign in to comment.