diff --git a/src/contracts/Repository/Values/Content/Content.php b/src/contracts/Repository/Values/Content/Content.php index ae9ad3e0de..a2a03a3ef8 100644 --- a/src/contracts/Repository/Values/Content/Content.php +++ b/src/contracts/Repository/Values/Content/Content.php @@ -16,7 +16,7 @@ * this class represents a content object in a specific version. * * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo convenience getter for getVersionInfo()->getContentInfo() - * @property-read int $id convenience getter for retrieving the contentId: $versionInfo->contentInfo->id + * @property-read int $id @deprecated use {@see Content::getId()} instead. * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo calls getVersionInfo() * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\Field[] $fields access fields, calls getFields() * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail|null $thumbnail calls getThumbnail() diff --git a/src/contracts/Repository/Values/Content/ContentInfo.php b/src/contracts/Repository/Values/Content/ContentInfo.php index 6a7a4e13c9..ee50b08f23 100644 --- a/src/contracts/Repository/Values/Content/ContentInfo.php +++ b/src/contracts/Repository/Values/Content/ContentInfo.php @@ -29,7 +29,7 @@ * @property-read string $mainLanguageCode The main language code of the Content object. If the available flag is set to true the Content is shown in this language if the requested language does not exist. * @property-read int|null $mainLocationId @deprecated Use {@see ContentInfo::getMainLocationId} instead * @property-read int $status status of the Content object - * @property-read bool $isHidden status of the Content object + * @property-read bool $isHidden @deprecated Use {@see ContentInfo::$isHidden} instead */ class ContentInfo extends ValueObject { @@ -185,6 +185,11 @@ public function isTrashed(): bool return $this->status === self::STATUS_TRASHED; } + public function isHidden(): bool + { + return $this->isHidden; + } + public function getContentType(): ContentType { return $this->contentType; @@ -229,6 +234,11 @@ public function getId(): int { return $this->id; } + + public function getName(): string + { + return $this->name; + } } class_alias(ContentInfo::class, 'eZ\Publish\API\Repository\Values\Content\ContentInfo'); diff --git a/src/contracts/Repository/Values/Content/Location.php b/src/contracts/Repository/Values/Content/Location.php index 72c5348002..58fe6a5dc5 100644 --- a/src/contracts/Repository/Values/Content/Location.php +++ b/src/contracts/Repository/Values/Content/Location.php @@ -16,17 +16,17 @@ * This class represents a location in the repository. * * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo calls getContentInfo() - * @property-read int $contentId calls getContentInfo()->id - * @property-read int $id the id of the location + * @property-read int $contentId @deprecated use {@see Location::getContentId()} instead. + * @property-read int $id @deprecated use {@see Location::getId()} instead. * @property-read int $priority Position of the Location among its siblings when sorted using priority - * @property-read bool $hidden Indicates that the Location entity is hidden (explicitly or hidden by content). - * @property-read bool $invisible Indicates that the Location is not visible, being either marked as hidden itself, or implicitly hidden by its Content or an ancestor Location + * @property-read bool $hidden @deprecated use {@see Location::isHidden()} instead. + * @property-read bool $invisible @deprecated use {@see Location::isInvisible()} instead. * @property-read bool $explicitlyHidden Indicates that the Location entity has been explicitly marked as hidden. * @property-read string $remoteId a global unique id of the content object * @property-read int $parentLocationId the id of the parent location * @property-read string $pathString @deprecated use {@see Location::getPathString()} instead. * @property-read array $path Same as $pathString but as array, e.g. [ 1, 2, 4, 23 ] - * @property-read int $depth Depth location has in the location tree + * @property-read int $depth @deprecated use {@see Location::getDepth()} instead. * @property-read int $sortField Specifies which property the child locations should be sorted on. Valid values are found at {@link Location::SORT_FIELD_*} * @property-read int $sortOrder Specifies whether the sort order should be ascending or descending. Valid values are {@link Location::SORT_ORDER_*} */ @@ -194,12 +194,22 @@ abstract class Location extends ValueObject abstract public function getContentInfo(): ContentInfo; /** - * Return the parent location of of this location. + * Return the parent location of this location. * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ abstract public function getParentLocation(): ?Location; + public function getId(): int + { + return $this->id; + } + + public function getContentId(): int + { + return $this->getContentInfo()->getId(); + } + /** * Returns true if current location is a draft. * @@ -248,6 +258,28 @@ public function getPathString(): string { return $this->pathString; } + + /** + * Indicates that the Location is not visible, being either marked as hidden itself, or implicitly hidden by + * its Content or an ancestor Location. + */ + public function isInvisible(): bool + { + return $this->invisible; + } + + /** + * Indicates that the Location is hidden either explicitly or by content. + */ + public function isHidden(): bool + { + return $this->hidden; + } + + public function getDepth(): int + { + return $this->depth; + } } class_alias(Location::class, 'eZ\Publish\API\Repository\Values\Content\Location'); diff --git a/src/contracts/Repository/Values/Content/VersionInfo.php b/src/contracts/Repository/Values/Content/VersionInfo.php index f416251c89..5e698aecf7 100644 --- a/src/contracts/Repository/Values/Content/VersionInfo.php +++ b/src/contracts/Repository/Values/Content/VersionInfo.php @@ -18,7 +18,7 @@ * * @property-read \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo calls getContentInfo() * @property-read mixed $id the internal id of the version - * @property-read int $versionNo the version number of this version (which only increments in scope of a single Content object) + * @property-read int $versionNo @deprecated use {@see VersionInfo::getVersionNo()} instead. * @property-read \DateTime $modificationDate the last modified date of this version * @property-read \DateTime $creationDate the creation date of this version * @property-read mixed $creatorId the user id of the user which created this version @@ -115,6 +115,11 @@ public function getLanguageCodes(): array return $this->languageCodes; } + public function getVersionNo(): int + { + return $this->versionNo; + } + /** * Returns true if version is a draft. * diff --git a/src/contracts/Repository/Values/ContentType/ContentType.php b/src/contracts/Repository/Values/ContentType/ContentType.php index 3fdf59c188..25053d7999 100644 --- a/src/contracts/Repository/Values/ContentType/ContentType.php +++ b/src/contracts/Repository/Values/ContentType/ContentType.php @@ -19,7 +19,7 @@ * @property-read \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCollection $fieldDefinitions calls getFieldDefinitions() or on access getFieldDefinition($fieldDefIdentifier) * @property-read mixed $id the id of the content type * @property-read int $status the status of the content type. One of ContentType::STATUS_DEFINED|ContentType::STATUS_DRAFT|ContentType::STATUS_MODIFIED - * @property-read string $identifier the identifier of the content type + * @property-read string $identifier @deprecated use {@see ContentType::getIdentifier()} instead. * @property-read \DateTime $creationDate the date of the creation of this content type * @property-read \DateTime $modificationDate the date of the last modification of this content type * @property-read mixed $creatorId the user id of the creator of this content type @@ -176,6 +176,11 @@ abstract public function getContentTypeGroups(); */ abstract public function getFieldDefinitions(): FieldDefinitionCollection; + public function getIdentifier(): string + { + return $this->identifier; + } + /** * This method returns the field definition for the given identifier. * diff --git a/src/contracts/Repository/Values/ContentType/FieldDefinition.php b/src/contracts/Repository/Values/ContentType/FieldDefinition.php index f27f93bb68..52158d96d6 100644 --- a/src/contracts/Repository/Values/ContentType/FieldDefinition.php +++ b/src/contracts/Repository/Values/ContentType/FieldDefinition.php @@ -18,14 +18,14 @@ * @property-read array $fieldSettings calls getFieldSettings() * @property-read array $validatorConfiguration calls getValidatorConfiguration() * @property-read int $id the id of the field definition - * @property-read string $identifier the identifier of the field definition + * @property-read string $identifier @deprecated use {@see FieldDefinition::getIdentifier()} instead. * @property-read string $fieldGroup the field group name * @property-read int $position the position of the field definition in the content type - * @property-read string $fieldTypeIdentifier String identifier of the field type + * @property-read string $fieldTypeIdentifier @deprecated {@see FieldDefinition::getFieldTypeIdentifier()} instead. * @property-read bool $isTranslatable indicates if fields of this definition are translatable * @property-read bool $isRequired indicates if this field is required in the content object * @property-read bool $isSearchable indicates if the field is searchable - * @property-read bool $isThumbnail indicates if the field can be thumbnail + * @property-read bool $isThumbnail @deprecated use {@see FieldDefinition::isThumbnail()} instead. * @property-read bool $isInfoCollector indicates if this field is used for information collection * @property-read mixed $defaultValue the default value of the field * @property-read string $mainLanguageCode main Translation (language code) of a multilingual Field Definition @@ -129,6 +129,66 @@ abstract public function getFieldSettings(): array; * @var string */ protected $mainLanguageCode; + + public function getId(): int + { + return $this->id; + } + + public function getFieldGroup(): string + { + return $this->fieldGroup; + } + + public function getPosition(): int + { + return $this->position; + } + + public function isTranslatable(): bool + { + return $this->isTranslatable; + } + + public function isRequired(): bool + { + return $this->isRequired; + } + + public function isInfoCollector(): bool + { + return $this->isInfoCollector; + } + + public function getDefaultValue() + { + return $this->defaultValue; + } + + public function isSearchable(): bool + { + return $this->isSearchable; + } + + public function getMainLanguageCode(): string + { + return $this->mainLanguageCode; + } + + public function isThumbnail(): bool + { + return $this->isThumbnail; + } + + public function getIdentifier(): string + { + return $this->identifier; + } + + public function getFieldTypeIdentifier(): string + { + return $this->fieldTypeIdentifier; + } } class_alias(FieldDefinition::class, 'eZ\Publish\API\Repository\Values\ContentType\FieldDefinition'); diff --git a/src/contracts/Repository/Values/User/User.php b/src/contracts/Repository/Values/User/User.php index 72bf4ce906..518697a0d1 100644 --- a/src/contracts/Repository/Values/User/User.php +++ b/src/contracts/Repository/Values/User/User.php @@ -11,11 +11,9 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; /** - * This class represents a user value. - * - * @property-read string $login + * @property-read string $login @deprecated {@see User::getLogin()} instead. * @property-read string $email - * @property-read string $passwordHash + * @property-read string $passwordHash @deprecated {@see User::getPasswordHash()} instead. * @property-read string $hashAlgorithm Hash algorithm used to hash the password * @property-read \DateTimeInterface|null $passwordUpdatedAt * @property-read bool $enabled User can not login if false @@ -94,15 +92,21 @@ abstract class User extends Content implements UserReference */ protected $maxLogin; - /** - * The User id of the User. - * - * @return int - */ public function getUserId(): int { + // ATM User Id is the same as Content Id return $this->getId(); } + + public function getLogin(): string + { + return $this->login; + } + + public function getPasswordHash(): string + { + return $this->passwordHash; + } } class_alias(User::class, 'eZ\Publish\API\Repository\Values\User\User'); diff --git a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php index fc3ae105e0..badeef618e 100644 --- a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php +++ b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php @@ -9,13 +9,13 @@ use Ibexa\Contracts\Core\Repository\Values\ValueObject; /** - * @property-read string $scheme The request scheme - http or https - * @property-read string $host The host name - * @property-read string $port The port the request is made on - * @property-read string $pathinfo The path being requested relative to the executed script - * @property-read array $queryParams Array of parameters extracted from the query string - * @property-read array $languages List of languages acceptable by the client browser - * @property-read array $headers Hash of request headers + * @property-read string $scheme @deprecated use {@see SimplifiedRequest::getScheme()} instead. + * @property-read string $host @deprecated use {@see SimplifiedRequest::getHost()} instead. + * @property-read string $port @deprecated use {@see SimplifiedRequest::getScheme()} instead. + * @property-read string $pathinfo @deprecated use {@see SimplifiedRequest::getPathInfo()} instead. + * @property-read array $queryParams @deprecated use {@see SimplifiedRequest::getQueryParams()} instead. + * @property-read array $languages @deprecated use {@see SimplifiedRequest::getLanguages()} instead. + * @property-read array $headers @deprecated use {@see SimplifiedRequest::getHeaders()} instead. */ class SimplifiedRequest extends ValueObject { @@ -158,6 +158,64 @@ public function __sleep() return ['scheme', 'host', 'port', 'pathinfo', 'queryParams', 'languages', 'headers']; } + + /** + * The request scheme - http or https. + */ + public function getScheme(): string + { + return $this->scheme; + } + + public function getHost(): string + { + return $this->host; + } + + public function getPort(): string + { + return $this->port; + } + + /** + * The path being requested relative to the executed script. + */ + public function getPathInfo(): string + { + return $this->pathinfo; + } + + /** + * @return array + */ + public function getQueryParams(): array + { + return $this->queryParams; + } + + /** + * @return string[] + */ + public function getLanguages(): array + { + return $this->languages; + } + + /** + * @return array|null + */ + public function getHeader($headerName): ?array + { + return $this->headers[$headerName] ?? null; + } + + /** + * @return array> + */ + public function getHeaders(): array + { + return $this->headers; + } } class_alias(SimplifiedRequest::class, 'eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest'); diff --git a/src/lib/MVC/Symfony/Security/User.php b/src/lib/MVC/Symfony/Security/User.php index 655ec05d6e..0e2b1d65a2 100644 --- a/src/lib/MVC/Symfony/Security/User.php +++ b/src/lib/MVC/Symfony/Security/User.php @@ -57,12 +57,10 @@ public function getRoles() * * This should be the encoded password. On authentication, a plain-text * password will be salted, encoded, and then compared to this value. - * - * @return string The password */ - public function getPassword() + public function getPassword(): string { - return $this->getAPIUser()->passwordHash; + return $this->getAPIUser()->getPasswordHash(); } /** @@ -79,12 +77,10 @@ public function getSalt() /** * Returns the username used to authenticate the user. - * - * @return string The username */ - public function getUsername() + public function getUsername(): string { - return $this->getAPIUser()->login; + return $this->getAPIUser()->getLogin(); } /** @@ -142,7 +138,7 @@ public function isEqualTo(BaseUserInterface $user) public function __toString() { - return $this->getAPIUser()->contentInfo->name; + return $this->getAPIUser()->getContentInfo()->getName(); } /**