Move ProfileField from Model to Entity
This commit is contained in:
parent
39a927f213
commit
1c0f92c382
|
@ -25,13 +25,14 @@ use Friendica\BaseFactory;
|
|||
use Friendica\Collection\Api\Mastodon\Fields;
|
||||
use Friendica\Collection\ProfileFields;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Model\ProfileField;
|
||||
use Friendica\Profile\ProfileField\Entity\ProfileField;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class Field extends BaseFactory
|
||||
{
|
||||
/**
|
||||
* @param ProfileField $profileField
|
||||
* @param \Friendica\Profile\ProfileField\Entity\ProfileField $profileField
|
||||
*
|
||||
* @return \Friendica\Object\Api\Mastodon\Field
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\ProfileField;
|
||||
use Friendica\Profile\ProfileField\Entity\ProfileField;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Model;
|
||||
namespace Friendica\Profile\ProfileField\Entity;
|
||||
|
||||
use Friendica\BaseModel;
|
||||
use Friendica\Database\Database;
|
|
@ -36,7 +36,7 @@ class ProfileField extends BaseRepository
|
|||
{
|
||||
protected static $table_name = 'profile_field';
|
||||
|
||||
protected static $model_class = Model\ProfileField::class;
|
||||
protected static $model_class = \Friendica\Profile\ProfileField\Entity\ProfileField::class;
|
||||
|
||||
protected static $collection_class = Collection\ProfileFields::class;
|
||||
|
||||
|
@ -58,7 +58,8 @@ class ProfileField extends BaseRepository
|
|||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return Model\ProfileField
|
||||
*
|
||||
* @return \Friendica\Profile\ProfileField\Entity\ProfileField
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
|
@ -67,7 +68,8 @@ class ProfileField extends BaseRepository
|
|||
|
||||
/**
|
||||
* @param array $condition
|
||||
* @return Model\ProfileField
|
||||
*
|
||||
* @return \Friendica\Profile\ProfileField\Entity\ProfileField
|
||||
* @throws \Friendica\Network\HTTPException\NotFoundException
|
||||
*/
|
||||
public function selectFirst(array $condition)
|
||||
|
@ -138,7 +140,8 @@ class ProfileField extends BaseRepository
|
|||
|
||||
/**
|
||||
* @param array $fields
|
||||
* @return Model\ProfileField|bool
|
||||
*
|
||||
* @return \Friendica\Profile\ProfileField\Entity\ProfileField|bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function insert(array $fields)
|
||||
|
@ -150,7 +153,8 @@ class ProfileField extends BaseRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Model\ProfileField $model
|
||||
* @param \Friendica\Profile\ProfileField\Entity\ProfileField $model
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
@ -202,7 +206,7 @@ class ProfileField extends BaseRepository
|
|||
unset($profileFieldOrder['new']);
|
||||
|
||||
// Prunes profile field whose label has been emptied
|
||||
$profileFields = $profileFields->filter(function (Model\ProfileField $profileField) use (&$profileFieldInputs, &$profileFieldOrder) {
|
||||
$profileFields = $profileFields->filter(function (\Friendica\Profile\ProfileField\Entity\ProfileField $profileField) use (&$profileFieldInputs, &$profileFieldOrder) {
|
||||
$keepModel = !isset($profileFieldInputs[$profileField->id]) || !empty($profileFieldInputs[$profileField->id]['label']);
|
||||
|
||||
if (!$keepModel) {
|
||||
|
@ -218,7 +222,7 @@ class ProfileField extends BaseRepository
|
|||
$profileFieldOrder = array_flip(array_keys($profileFieldOrder));
|
||||
|
||||
// Update existing profile fields from form values
|
||||
$profileFields = $profileFields->map(function (Model\ProfileField $profileField) use ($uid, &$profileFieldInputs, &$profileFieldOrder) {
|
||||
$profileFields = $profileFields->map(function (\Friendica\Profile\ProfileField\Entity\ProfileField $profileField) use ($uid, &$profileFieldInputs, &$profileFieldOrder) {
|
||||
if (isset($profileFieldInputs[$profileField->id]) && isset($profileFieldOrder[$profileField->id])) {
|
||||
$psid = $this->permissionSet->selectOrCreate($this->permissionSetFactory->createFromString(
|
||||
$uid,
|
||||
|
|
Loading…
Reference in New Issue
Block a user