Product extends SomeProducts uses SetAdditionalPropertyTrait
A generic product representation enriched with commerce metadata : unit of sale, eligible quantities (unit → package → pallet), pricing categories, tax rate and stock information.
Tags
Table of Contents
Constants
- CONTEXT : string = \xyz\oihana\schema\constants\Oihana::SCHEMA
- The @context of the json-ld representation of the thing.
- JSON_PRIORITY_KEYS : array<string|int, mixed> = [\org\schema\constants\Schema::AT_TYPE, \org\sc...
- Defines the priority order of keys when serializing the object to JSON-LD.
Properties
- $_from : string|null
- The metadata to indicates the edge 'from' identifier.
- $_id : null|string
- The metadata identifier of the item.
- $_key : null|string
- The metadata unique key identifier of the thing.
- $_rev : null|string
- The metadata revision value of the thing.
- $_to : string|null
- The metadata to indicates the edge 'to' identifier.
- $active : bool|null
- The visibility flag.
- $additionalProperty : null|array<string|int, mixed>|PropertyValue
- A property-value pair representing an additional characteristic of the entity, e.g. a product feature or another characteristic for which there is no matching property in schema.org.
- $additionalType : array<string|int, mixed>|string|null|object
- An additionalType for the item.
- $aggregateRating : null|array<string|int, mixed>|AggregateRating
- The overall rating, based on a collection of reviews or ratings, of the item.
- $alternateName : string|object|array<string|int, mixed>|null
- An alias for the item.
- $asin : null|string
- An Amazon Standard Identification Number (ASIN) is a 10-character alphanumeric unique identifier assigned by Amazon.com and its partners for product identification within the Amazon organization.
- $audience : null|array<string|int, mixed>|Audience
- An intended audience, i.e. a group for whom something was created. Supersedes serviceAudience.
- $award : string|array<string|int, mixed>|null
- An award won by or for this item.
- $brand : Brand|Organization|array<string|int, mixed>|null
- The brand(s) associated with a product or service, or the brand(s) maintained by an organization or business person.
- $category : null|array<string|int, mixed>|string|CategoryCode|Thing
- A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.
- $color : string|null
- The color of the product.
- $colorSwatch : string|object|null
- A color swatch image, visualizing the color of a Product.
- $countryOfAssembly : string|null
- The place where the product was assembled.
- $countryOfLastProcessing : string|null
- The place where the item (typically Product) was last processed and tested before importation.
- $countryOfOrigin : Country|null
- The country of origin of something, including products as well as creative works such as movie and TV content.
- $created : null|string
- Date of creation of the resource.
- $density : float|null
- The density of the product.
- $depth : float|null
- The depth of the item.
- $description : string|object|array<string|int, mixed>|null
- A short description of the item.
- $disambiguatingDescription : string|null
- A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.
- $displayLocation : null|Place|array<string|int, mixed>|string
- The location at which an item can be viewed or experienced in-person.
- $eligibleQuantity : null|array<string|int, mixed>|QuantitativeValue
- The eligible quantity of the product, representing the minimum or specific ordering quantities at different levels: unit, package, and pallet.
- $funding : string|array<string|int, mixed>|Grant|null
- A Grant that directly or indirectly provide funding or sponsorship for this item.
- $gtin : string|null
- A correct gtin value should be a valid GTIN, which means that it should be an all-numeric string of either 8, 12, 13 or 14 digits, or a "GS1 Digital Link" URL based on such a string.
- $gtin12 : string|null
- The GTIN-12 code of the product, or the product to which the offer refers.
- $gtin13 : string|null
- The GTIN-13 code of the product, or the product to which the offer refers.
- $gtin14 : string|null
- The GTIN-14 code of the product, or the product to which the offer refers.
- $gtin8 : string|null
- The GTIN-8 code of the product, or the product to which the offer refers. This code is also known as EAN/UCC-8 or 8-digit EAN.
- $hasAdultConsideration : string|Enumeration|DefinedTerm|array<string|int, mixed>|null
- Used to tag an item to be intended or suitable for consumption or use by adults only.
- $hasCertification : null|array<string|int, mixed>|string|Certification
- Certification information about a product, organization, service, place, or person.
- $hasGS1DigitalLink : string|null
- The GS1 digital link associated with the object.
- $hasMeasurement : null|array<string|int, mixed>|QuantitativeValue
- A measurement of an item, For example, the inseam of pants, the wheel size of a bicycle, the gauge of a screw, or the carbon footprint measured for certification by an authority.
- $hasMerchantReturnPolicy : null|array<string|int, mixed>|MerchantReturnPolicy
- Specifies a MerchantReturnPolicy that may be applicable.
- $hasPart : string|Thing|array<string|int, Thing>|null
- Indicates an item that this part of this item.
- $height : float|null
- The height of the item.
- $id : null|int|string
- The unique identifier of the item.
- $identifier : string|null
- The identifier of the item.
- $image : string|ImageObject|array<string|int, ImageObject|string>|null
- The image reference of this resource.
- $inProductGroupWithID : string|null
- Indicates the productGroupID for a ProductGroup that this product isVariantOf.
- $inStock : null|bool
- Indicates if the product is managed in stock.
- $inventoryLevel : array<string|int, mixed>|StockLevel|null
- The current approximate inventory level for the item or items.
- $isAccessoryOrSparePartFor : null|Product|array<string|int, mixed>
- A pointer to another product (or multiple products) for which this product is an accessory or spare part.
- $isConsumableFor : null|Product|array<string|int, mixed>
- A pointer to another product (or multiple products) for which this product is a consumable.
- $isFamilyFriendly : bool|null
- Indicates whether this content is family friendly.
- $isPartOf : string|Thing|array<string|int, Thing>|null
- Indicates an item that this item is part of.
- $isRelatedTo : Product|Service|array<string|int, mixed>|null
- A pointer to another, somehow related product (or multiple products).
- $isSimilarTo : Product|Service|array<string|int, mixed>|null
- A pointer to another, functionally similar product (or multiple products).
- $isVariantOf : null|array<string|int, mixed>|ProductModel|ProductGroup
- Indicates the kind of product that this is a variant of. In the case of ProductModel, this is a pointer (from a ProductModel) to a base product from which this product is a variant.
- $itemCondition : DefinedTerm|string|OfferItemCondition|array<string|int, mixed>|null
- A predefined value from OfferItemCondition specifying the condition of the product or service, or the products or services included in the offer.
- $keywords : string|DefinedTerm|array<string|int, mixed>|null
- Keywords or tags used to describe some item. Multiple textual entries in a keywords list are typically delimited by commas, or by repeating the property.
- $length : float|null
- The length of the product.
- $license : string|object|null
- A legal document giving official permission to do something with the resource.
- $logo : string|ImageObject|null
- An associated logo.
- $mainEntityOfPage : string|null
- Indicates a page (or other CreativeWork) for which this thing is the main entity being described.
- $manufacturer : int|Organization|string|null
- The manufacturer of the product.
- $material : array<string|int, mixed>|Product|string|null
- A material that something is made from, e.g. leather, wool, cotton, paper.
- $mobileUrl : string|null
- The mobileUrl property is provided for specific situations in which data consumers need to determine whether one of several provided URLs is a dedicated 'mobile site'.
- $model : ProductModel|string|null
- The model of the product.
- $modified : null|string
- Date on which the resource was changed.
- $mpn : string|null
- The Manufacturer Part Number (MPN) of the product, or the product to which the offer refers.
- $name : int|string|null
- The name of the item.
- $negativeNotes : array<string|int, mixed>|ItemList|ListItem|string|WebContent|null
- Provides negative considerations regarding something, most typically in pro/con lists for reviews (alongside positiveNotes). For symmetry
- $nsn : string|null
- Indicates the NATO stock number (nsn) of a Product.
- $offers : array<string|int, mixed>|Offer|Demand|null
- An offer to provide this item.
- $owner : null|string|Thing
- The owner of this Thing.
- $pattern : string|DefinedTerm|null
- A pattern that something has, for example 'polka dot', 'striped', 'Canadian flag'. Values are typically expressed as text, although links to controlled value schemes are also supported.
- $positiveNotes : array<string|int, mixed>|ItemList|ListItem|string|WebContent|null
- Provides positive considerations regarding something, for example product highlights or (alongside negativeNotes) pro/con lists for reviews.
- $potentialAction : array<string|int, mixed>|Action|null
- Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
- $priceCategory : array<string|int, mixed>|string|object|null
- The price category of the product.
- $productID : string|null
- The product identifier, such as ISBN. For example: meta itemprop="productID" content="isbn:123-456-789".
- $productionDate : string|null|int
- The date of production of the item, e.g. vehicle.
- $productType : null|string|array<string|int, mixed>|DefinedTerm
- Product functional type (stock, tracking, rules, etc).
- $publisher : string|array<string|int, string|Person|Organization>|Person|Organization|null
- The publisher of the resource.
- $purchaseDate : string|int|null
- The date the item, e.g. vehicle, was purchased by the current owner.
- $releaseDate : string|int|null
- The release date of a product or product model.
- $review : null|array<string|int, mixed>|Review
- A review of the item.
- $sameAs : string|array<string|int, mixed>|null
- URL of a reference Web page that unambiguously indicates the item's identity.
- $size : null|string|DefinedTerm|QuantitativeValue|SizeSpecification|array<string|int, mixed>
- A standardized size of a product or creative work, specified either through a simple textual string (for example 'XL', '32Wx34L'), a QuantitativeValue with a unitCode, or a comprehensive and structured SizeSpecification; in other cases, the width, height, depth and weight properties may be more applicable.
- $sku : string|null
- The Stock Keeping Unit (SKU), i.e. a merchant-specific identifier for a product or service, or the product to which the offer refers.
- $slogan : string|null
- A slogan or motto associated with the item.
- $status : int|null
- The status of the product.
- $subjectOf : null|string|array<string|int, mixed>|CreativeWork|Event
- A CreativeWork or Event about this Thing.
- $unitOfSale : string|null
- A unit of sale refers to the specific quantity or grouping of a product or service that you offer for purchase.
- $url : int|string|null
- URL of the item.
- $vat : array<string|int, mixed>|TaxRate|string|int|null
- The taxe rate information of the product.
- $volume : null|float|int
- The volume of the product.
- $webCategory : array<string|int, mixed>|string|DefinedTerm|null
- The product's web category (display, navigation, etc.)
- $weight : float|null
- The weight of the item.
- $width : float|null
- The width of the item.
- $atContext : string|null
- The JSON-LD `@context` value.
- $atType : string|null
- The JSON-LD `@type` value.
- $DEFAULT_JSON_SERIALIZE_OPTIONS : array<string|int, mixed>
- The default static jsonSerialize options (class-level configuration).
- $_eligibleQuantityDefinition : array<string|int, mixed>|null
- $schemaTypeCache : array<string, string>
- Internal cache for resolved schema types.
Methods
- __construct() : mixed
- Constructor to hydrate public properties from an array or stdClass.
- __set() : void
- Magic setter for the Product class.
- findEligibleQuantityByType() : QuantitativeValue|null
- Find a QuantitativeValue inside eligibleQuantity tree matching the given UnitOfSaleType.
- getInventoryLevelInUnitOfSale() : float|null
- Calculates the inventory level in the unit of sale.
- getJsonSerializeOptions() : array<string|int, mixed>
- Returns the default JSON serialization options.
- getSchemaType() : string
- Returns the fully qualified URI of the schema type.
- getUnitOfSaleConversionFactor() : float
- Get the conversion factor from base unit to the unit of sale.
- jsonSerialize() : array<string|int, mixed>
- Serializes the current object into a JSON-LD array.
- setAdditionalProperties() : bool
- Set the optional additional properties with the magic _set method.
- setEligibleQuantityProperty() : bool
- Set the optional eligibleQuantity property with the magic _set method.
- withAtContext() : $this
- Sets the internal JSON-LD `@context` attribute.
- withAtType() : $this
- Sets the internal JSON-LD `@type` attribute.
- withJSONLDMeta() : $this
- Initializes both JSON-LD metadata: `@type` and `@context`.
- resolveUnitCode() : string|null
- Resolves a raw unit code expression into a normalized UN/CEFACT unit code.
- setAdditionalProperty() : void
- Internal method to inject custom properties in the PostalAddress property of the place.
- searchEligibleQuantityByType() : QuantitativeValue|null
- Recursive internal search for a QuantitativeValue by UnitOfSaleType.
Constants
CONTEXT
The @context of the json-ld representation of the thing.
public
string
CONTEXT
= \xyz\oihana\schema\constants\Oihana::SCHEMA
JSON_PRIORITY_KEYS
Defines the priority order of keys when serializing the object to JSON-LD.
public
array<string|int, mixed>
JSON_PRIORITY_KEYS
= [\org\schema\constants\Schema::AT_TYPE, \org\schema\constants\Schema::AT_CONTEXT, \org\schema\constants\Schema::_KEY, \org\schema\constants\Schema::_FROM, \org\schema\constants\Schema::_TO, \org\schema\constants\Schema::ID, \org\schema\constants\Schema::NAME, \org\schema\constants\Schema::URL, \org\schema\constants\Schema::CREATED, \org\schema\constants\Schema::MODIFIED]
Keys listed here will always appear first in the serialized array, in the order specified. All remaining public properties will be sorted alphabetically after these priority keys.
This ensures that important JSON-LD metadata and system fields
(like @type, @context, _key, id, url, created, modified, etc.)
appear at the top of the output for consistency and readability.
Usage:
$orderedKeys = self::JSON_PRIORITY_KEYS;
Notes:
- Can be overridden in a subclass by redefining the constant.
- Late static binding (
static::JSON_PRIORITY_KEYS) allows child classes to modify the serialization order.
List of JSON-LD keys in priority order.
Properties
$_from
The metadata to indicates the edge 'from' identifier.
public
string|null
$_from
$_id
The metadata identifier of the item.
public
null|string
$_id
$_key
The metadata unique key identifier of the thing.
public
null|string
$_key
$_rev
The metadata revision value of the thing.
public
null|string
$_rev
$_to
The metadata to indicates the edge 'to' identifier.
public
string|null
$_to
$active
The visibility flag.
public
bool|null
$active
$additionalProperty
A property-value pair representing an additional characteristic of the entity, e.g. a product feature or another characteristic for which there is no matching property in schema.org.
public
null|array<string|int, mixed>|PropertyValue
$additionalProperty
= null
Attributes
- #[HydrateWith]
- \org\schema\PropertyValue::class
$additionalType
An additionalType for the item.
public
array<string|int, mixed>|string|null|object
$additionalType
$aggregateRating
The overall rating, based on a collection of reviews or ratings, of the item.
public
null|array<string|int, mixed>|AggregateRating
$aggregateRating
Attributes
- #[HydrateWith]
- \org\schema\AggregateRating::class
$alternateName
An alias for the item.
public
string|object|array<string|int, mixed>|null
$alternateName
$asin
An Amazon Standard Identification Number (ASIN) is a 10-character alphanumeric unique identifier assigned by Amazon.com and its partners for product identification within the Amazon organization.
public
null|string
$asin
$audience
An intended audience, i.e. a group for whom something was created. Supersedes serviceAudience.
public
null|array<string|int, mixed>|Audience
$audience
Attributes
- #[HydrateWith]
- \org\schema\Audience::class
$award
An award won by or for this item.
public
string|array<string|int, mixed>|null
$award
$brand
The brand(s) associated with a product or service, or the brand(s) maintained by an organization or business person.
public
Brand|Organization|array<string|int, mixed>|null
$brand
$category
A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.
public
null|array<string|int, mixed>|string|CategoryCode|Thing
$category
$color
The color of the product.
public
string|null
$color
$colorSwatch
A color swatch image, visualizing the color of a Product.
public
string|object|null
$colorSwatch
Should match the textual description specified in the color property. This can be a URL or a fully described ImageObject.
$countryOfAssembly
The place where the product was assembled.
public
string|null
$countryOfAssembly
$countryOfLastProcessing
The place where the item (typically Product) was last processed and tested before importation.
public
string|null
$countryOfLastProcessing
$countryOfOrigin
The country of origin of something, including products as well as creative works such as movie and TV content.
public
Country|null
$countryOfOrigin
In the case of TV and movie, this would be the country of the principle offices of the production company or individual responsible for the movie. For other kinds of CreativeWork it is difficult to provide fully general guidance, and properties such as contentLocation and locationCreated may be more applicable.
In the case of products, the country of origin of the product. The exact interpretation of this may vary by context and product type, and cannot be fully enumerated here.
$created
Date of creation of the resource.
public
null|string
$created
$density
The density of the product.
public
float|null
$density
$depth
The depth of the item.
public
float|null
$depth
$description
A short description of the item.
public
string|object|array<string|int, mixed>|null
$description
$disambiguatingDescription
A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.
public
string|null
$disambiguatingDescription
$displayLocation
The location at which an item can be viewed or experienced in-person.
public
null|Place|array<string|int, mixed>|string
$displayLocation
$eligibleQuantity
The eligible quantity of the product, representing the minimum or specific ordering quantities at different levels: unit, package, and pallet.
public
null|array<string|int, mixed>|QuantitativeValue
$eligibleQuantity
= null
The structure is a QuantitativeValue object where:
valueis the quantityunitCodeis the UN/CEFACT code of the unitunitTextis the human-readable name of the unitvalueReference(optional) can point to a nestedQuantitativeValuefor higher aggregation levels: unit → package → pallet
Example structure:
{
"value": "1", // unit quantity
"unitCode": "EA",
"unitText": "each",
"valueReference": // package level
{
"value": "12",
"unitCode": "BOX",
"unitText": "box",
"valueReference": { // pallet level
"value": "48",
"unitCode": "PLT",
"unitText": "pallet"
}
}
}
Attributes
- #[HydrateAs]
- \org\schema\QuantitativeValue::class
$funding
A Grant that directly or indirectly provide funding or sponsorship for this item.
public
string|array<string|int, mixed>|Grant|null
$funding
$gtin
A correct gtin value should be a valid GTIN, which means that it should be an all-numeric string of either 8, 12, 13 or 14 digits, or a "GS1 Digital Link" URL based on such a string.
public
string|null
$gtin
The numeric component should also have a valid GS1 check digit and meet the other rules for valid GTINs.
$gtin12
The GTIN-12 code of the product, or the product to which the offer refers.
public
string|null
$gtin12
The GTIN-12 is the 12-digit GS1 Identification Key composed of a U.P.C. Company Prefix, Item Reference, and Check Digit used to identify trade items.
$gtin13
The GTIN-13 code of the product, or the product to which the offer refers.
public
string|null
$gtin13
This is equivalent to 13-digit ISBN codes and EAN UCC-13. Former 12-digit UPC codes can be converted into a GTIN-13 code by simply adding a preceding zero.
$gtin14
The GTIN-14 code of the product, or the product to which the offer refers.
public
string|null
$gtin14
$gtin8
The GTIN-8 code of the product, or the product to which the offer refers. This code is also known as EAN/UCC-8 or 8-digit EAN.
public
string|null
$gtin8
$hasAdultConsideration
Used to tag an item to be intended or suitable for consumption or use by adults only.
public
string|Enumeration|DefinedTerm|array<string|int, mixed>|null
$hasAdultConsideration
Example:
- AlcoholConsideration
- DangerousGoodConsideration
- HealthcareConsideration
- NarcoticConsideration
- ReducedRelevanceForChildrenConsideration
- SexualContentConsideration
- TobaccoNicotineConsideration
- UnclassifiedAdultConsideration
- ViolenceConsideration
- WeaponConsideration
$hasCertification
Certification information about a product, organization, service, place, or person.
public
null|array<string|int, mixed>|string|Certification
$hasCertification
Attributes
- #[HydrateWith]
- \org\schema\creativeWork\Certification::class
$hasGS1DigitalLink
The GS1 digital link associated with the object.
public
string|null
$hasGS1DigitalLink
This URL should conform to the particular requirements of digital links. The link should only contain the Application Identifiers (AIs) that are relevant for the entity being annotated, for instance a Product or an Organization, and for the correct granularity.
$hasMeasurement
A measurement of an item, For example, the inseam of pants, the wheel size of a bicycle, the gauge of a screw, or the carbon footprint measured for certification by an authority.
public
null|array<string|int, mixed>|QuantitativeValue
$hasMeasurement
Usually an exact measurement, but can also be a range of measurements for adjustable products, for example belts and ski bindings.
Attributes
- #[HydrateWith]
- \org\schema\QuantitativeValue::class
$hasMerchantReturnPolicy
Specifies a MerchantReturnPolicy that may be applicable.
public
null|array<string|int, mixed>|MerchantReturnPolicy
$hasMerchantReturnPolicy
$hasPart
Indicates an item that this part of this item.
public
string|Thing|array<string|int, Thing>|null
$hasPart
$height
The height of the item.
public
float|null
$height
$id
The unique identifier of the item.
public
null|int|string
$id
$identifier
The identifier of the item.
public
string|null
$identifier
$image
The image reference of this resource.
public
string|ImageObject|array<string|int, ImageObject|string>|null
$image
$inProductGroupWithID
Indicates the productGroupID for a ProductGroup that this product isVariantOf.
public
string|null
$inProductGroupWithID
$inStock
Indicates if the product is managed in stock.
public
null|bool
$inStock
$inventoryLevel
The current approximate inventory level for the item or items.
public
array<string|int, mixed>|StockLevel|null
$inventoryLevel
= null
Attributes
- #[HydrateWith]
- \xyz\oihana\schema\products\StockLevel::class
$isAccessoryOrSparePartFor
A pointer to another product (or multiple products) for which this product is an accessory or spare part.
public
null|Product|array<string|int, mixed>
$isAccessoryOrSparePartFor
Attributes
- #[HydrateWith]
- \org\schema\Product::class
$isConsumableFor
A pointer to another product (or multiple products) for which this product is a consumable.
public
null|Product|array<string|int, mixed>
$isConsumableFor
Attributes
- #[HydrateWith]
- \org\schema\Product::class
$isFamilyFriendly
Indicates whether this content is family friendly.
public
bool|null
$isFamilyFriendly
$isPartOf
Indicates an item that this item is part of.
public
string|Thing|array<string|int, Thing>|null
$isPartOf
$isRelatedTo
A pointer to another, somehow related product (or multiple products).
public
Product|Service|array<string|int, mixed>|null
$isRelatedTo
$isSimilarTo
A pointer to another, functionally similar product (or multiple products).
public
Product|Service|array<string|int, mixed>|null
$isSimilarTo
$isVariantOf
Indicates the kind of product that this is a variant of. In the case of ProductModel, this is a pointer (from a ProductModel) to a base product from which this product is a variant.
public
null|array<string|int, mixed>|ProductModel|ProductGroup
$isVariantOf
Attributes
- #[HydrateWith]
- \org\schema\ProductModel::class
- \org\schema\ProductGroup::class
$itemCondition
A predefined value from OfferItemCondition specifying the condition of the product or service, or the products or services included in the offer.
public
DefinedTerm|string|OfferItemCondition|array<string|int, mixed>|null
$itemCondition
Also used for product return policies to specify the condition of products accepted for returns. Example:
- DamagedCondition
- NewCondition
- RefurbishedCondition
- UsedCondition
$keywords
Keywords or tags used to describe some item. Multiple textual entries in a keywords list are typically delimited by commas, or by repeating the property.
public
string|DefinedTerm|array<string|int, mixed>|null
$keywords
$length
The length of the product.
public
float|null
$length
$license
A legal document giving official permission to do something with the resource.
public
string|object|null
$license
$logo
An associated logo.
public
string|ImageObject|null
$logo
$mainEntityOfPage
Indicates a page (or other CreativeWork) for which this thing is the main entity being described.
public
string|null
$mainEntityOfPage
$manufacturer
The manufacturer of the product.
public
int|Organization|string|null
$manufacturer
$material
A material that something is made from, e.g. leather, wool, cotton, paper.
public
array<string|int, mixed>|Product|string|null
$material
$mobileUrl
The mobileUrl property is provided for specific situations in which data consumers need to determine whether one of several provided URLs is a dedicated 'mobile site'.
public
string|null
$mobileUrl
$model
The model of the product.
public
ProductModel|string|null
$model
$modified
Date on which the resource was changed.
public
null|string
$modified
$mpn
The Manufacturer Part Number (MPN) of the product, or the product to which the offer refers.
public
string|null
$mpn
$name
The name of the item.
public
int|string|null
$name
$negativeNotes
Provides negative considerations regarding something, most typically in pro/con lists for reviews (alongside positiveNotes). For symmetry
public
array<string|int, mixed>|ItemList|ListItem|string|WebContent|null
$negativeNotes
In the case of a Review, the property describes the itemReviewed from the perspective of the review; in the case of a Product, the product itself is being described. Since product descriptions tend to emphasise positive claims, it may be relatively unusual to find negativeNotes used in this way. Nevertheless for the sake of symmetry, negativeNotes can be used on Product.
The property values can be expressed either as unstructured text (repeated as necessary), or if ordered, as a list (in which case the most negative is at the beginning of the list).
$nsn
Indicates the NATO stock number (nsn) of a Product.
public
string|null
$nsn
Tags
$offers
An offer to provide this item.
public
array<string|int, mixed>|Offer|Demand|null
$offers
Attributes
- #[HydrateWith]
- \org\schema\Offer::class
- \org\schema\Demand::class
$owner
The owner of this Thing.
public
null|string|Thing
$owner
Represents any entity (person, organization, system, or other object) that can be considered the possessor of this Thing.
$pattern
A pattern that something has, for example 'polka dot', 'striped', 'Canadian flag'. Values are typically expressed as text, although links to controlled value schemes are also supported.
public
string|DefinedTerm|null
$pattern
$positiveNotes
Provides positive considerations regarding something, for example product highlights or (alongside negativeNotes) pro/con lists for reviews.
public
array<string|int, mixed>|ItemList|ListItem|string|WebContent|null
$positiveNotes
In the case of a Review, the property describes the itemReviewed from the perspective of the review; in the case of a Product, the product itself is being described.
The property values can be expressed either as unstructured text (repeated as necessary), or if ordered, as a list (in which case the most positive is at the beginning of the list).
$potentialAction
Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
public
array<string|int, mixed>|Action|null
$potentialAction
$priceCategory
The price category of the product.
public
array<string|int, mixed>|string|object|null
$priceCategory
= null
$productID
The product identifier, such as ISBN. For example: meta itemprop="productID" content="isbn:123-456-789".
public
string|null
$productID
$productionDate
The date of production of the item, e.g. vehicle.
public
string|null|int
$productionDate
$productType
Product functional type (stock, tracking, rules, etc).
public
null|string|array<string|int, mixed>|DefinedTerm
$productType
= null
$publisher
The publisher of the resource.
public
string|array<string|int, string|Person|Organization>|Person|Organization|null
$publisher
$purchaseDate
The date the item, e.g. vehicle, was purchased by the current owner.
public
string|int|null
$purchaseDate
$releaseDate
The release date of a product or product model.
public
string|int|null
$releaseDate
This can be used to distinguish the exact variant of a product.
$review
A review of the item.
public
null|array<string|int, mixed>|Review
$review
Attributes
- #[HydrateWith]
- \org\schema\Review::class
$sameAs
URL of a reference Web page that unambiguously indicates the item's identity.
public
string|array<string|int, mixed>|null
$sameAs
E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.
$size
A standardized size of a product or creative work, specified either through a simple textual string (for example 'XL', '32Wx34L'), a QuantitativeValue with a unitCode, or a comprehensive and structured SizeSpecification; in other cases, the width, height, depth and weight properties may be more applicable.
public
null|string|DefinedTerm|QuantitativeValue|SizeSpecification|array<string|int, mixed>
$size
Attributes
- #[HydrateWith]
- \org\schema\DefinedTerm::class
- \org\schema\QuantitativeValue::class
- \org\schema\SizeSpecification::class
$sku
The Stock Keeping Unit (SKU), i.e. a merchant-specific identifier for a product or service, or the product to which the offer refers.
public
string|null
$sku
$slogan
A slogan or motto associated with the item.
public
string|null
$slogan
$status
The status of the product.
public
int|null
$status
$subjectOf
A CreativeWork or Event about this Thing.
public
null|string|array<string|int, mixed>|CreativeWork|Event
$subjectOf
$unitOfSale
A unit of sale refers to the specific quantity or grouping of a product or service that you offer for purchase.
public
string|null
$unitOfSale
- UNIT : single item
- PACKAGE : grouped items (box, carton, etc.)
- PARCEL : larger aggregation (pallet, parcel of packages)
Tags
$url
URL of the item.
public
int|string|null
$url
$vat
The taxe rate information of the product.
public
array<string|int, mixed>|TaxRate|string|int|null
$vat
$volume
The volume of the product.
public
null|float|int
$volume
$webCategory
The product's web category (display, navigation, etc.)
public
array<string|int, mixed>|string|DefinedTerm|null
$webCategory
$weight
The weight of the item.
public
float|null
$weight
$width
The width of the item.
public
float|null
$width
$atContext
The JSON-LD `@context` value.
protected
string|null
$atContext
= null
Default is https://schema.org.
$atType
The JSON-LD `@type` value.
protected
string|null
$atType
= null
This can be manually set or automatically inferred from the class name.
$DEFAULT_JSON_SERIALIZE_OPTIONS
The default static jsonSerialize options (class-level configuration).
protected
static array<string|int, mixed>
$DEFAULT_JSON_SERIALIZE_OPTIONS
= []
$_eligibleQuantityDefinition
private
array<string|int, mixed>|null
$_eligibleQuantityDefinition
= null
$schemaTypeCache
Internal cache for resolved schema types.
private
static array<string, string>
$schemaTypeCache
= []
Methods
__construct()
Constructor to hydrate public properties from an array or stdClass.
public
__construct([array<string|int, mixed>|object|null $init = null ]) : mixed
This allows objects to be quickly populated with associative data without manually setting each property.
Parameters
- $init : array<string|int, mixed>|object|null = null
-
A data array or object used to initialize the instance. Keys must match public property names.
Tags
__set()
Magic setter for the Product class.
public
__set(string $property, mixed $value) : void
This method allows setting dynamic properties of the product. It delegates the handling to specific setter methods and stops immediately once a property has been successfully handled.
The order of handling is important:
- setAdditionalProperties() – sets optional additional properties.
- setEligibleQuantityProperty() – sets the eligibleQuantity hierarchy (unit → package → pallet).
If a property is not handled by any of these methods, it is silently ignored.
Parameters
- $property : string
-
The property name being set.
- $value : mixed
-
The value to assign to the property.
Tags
findEligibleQuantityByType()
Find a QuantitativeValue inside eligibleQuantity tree matching the given UnitOfSaleType.
public
findEligibleQuantityByType(string $type) : QuantitativeValue|null
This method recursively checks eligibleQuantity and its successive valueReference objects until a QuantitativeValue with a matching additionalType (UNIT, PACKAGE, PARCEL) is found.
Example:
$this->findEligibleQuantityByType(UnitOfSaleType::PACKAGE);
Parameters
- $type : string
-
One of the UnitOfSaleType::* constants.
Tags
Return values
QuantitativeValue|nullgetInventoryLevelInUnitOfSale()
Calculates the inventory level in the unit of sale.
public
getInventoryLevelInUnitOfSale(StockLevel|null $inventoryLevel) : float|null
A non-numeric value — the raw shape a base read can leave on the stock
level — yields null like an absent one, rather than a TypeError on the
division.
Parameters
- $inventoryLevel : StockLevel|null
-
The inventory level (in base unit).
Tags
Return values
float|null —The inventory level converted to the unit of sale, or null if calculation is not possible.
getJsonSerializeOptions()
Returns the default JSON serialization options.
public
getJsonSerializeOptions() : array<string|int, mixed>
This method determines how the jsonSerialize() output is reduced or compressed, etc.
It can be overridden in child classes to customize serialization behavior.
Return values
array<string|int, mixed> —Returns the reduction/compression options for JSON serialization.
getSchemaType()
Returns the fully qualified URI of the schema type.
public
static getSchemaType() : string
This method combines the class's CONTEXT constant with its short name
to produce a globally unique identifier for the entity type.
- It uses Late Static Binding to ensure the correct context is retrieved even when called from an inherited class (e.g., Corporation vs. Affiliate).
- Performance Optimization:
Results are stored in a static cache (
$schemaTypeCache) to avoid redundant Reflection calls during the same execution lifecycle.
Return values
string —The absolute URI of the type (e.g., "https://schema.org/Thing"). ** @example
echo Thing::getSchemaType(); // https://schema.org/Thing
echo Affiliate::getSchemaType(); // https://schema.oihana.xyz/Pagination
getUnitOfSaleConversionFactor()
Get the conversion factor from base unit to the unit of sale.
public
getUnitOfSaleConversionFactor() : float
Tags
Return values
float —The multiplication factor, or 1.0 if unitOfSale is UNIT.
jsonSerialize()
Serializes the current object into a JSON-LD array.
public
jsonSerialize() : array<string|int, mixed>
Includes public properties, the JSON-LD @context and @type.
Null values are automatically removed.
Tags
Return values
array<string|int, mixed> —JSON-LD representation of the object.
setAdditionalProperties()
Set the optional additional properties with the magic _set method.
public
setAdditionalProperties(string $property, mixed $value) : bool
Parameters
- $property : string
-
Property name
- $value : mixed
-
Value of the property.
Tags
Return values
bool —True if the property was handled, false otherwise
setEligibleQuantityProperty()
Set the optional eligibleQuantity property with the magic _set method.
public
setEligibleQuantityProperty(string $property, mixed $value) : bool
Parameters
- $property : string
-
Property name
- $value : mixed
-
Value of the property.
Tags
Return values
bool —True if the property was handled, false otherwise
withAtContext()
Sets the internal JSON-LD `@context` attribute.
public
withAtContext(string $context) : $this
Useful if you need a custom JSON-LD context.
Parameters
- $context : string
-
Optional JSON-LD context.
Return values
$thiswithAtType()
Sets the internal JSON-LD `@type` attribute.
public
withAtType(string $type) : $this
Allows overriding the default type inferred from the class.
Parameters
- $type : string
-
Optional JSON-LD type
Return values
$thiswithJSONLDMeta()
Initializes both JSON-LD metadata: `@type` and `@context`.
public
withJSONLDMeta([string|null $atType = null ][, string|null $atContext = null ]) : $this
Can be called from constructor or later to override default values.
Parameters
- $atType : string|null = null
-
Optional JSON-LD type
- $atContext : string|null = null
-
Optional JSON-LD context
Return values
$thisresolveUnitCode()
Resolves a raw unit code expression into a normalized UN/CEFACT unit code.
protected
resolveUnitCode(mixed $value) : string|null
By default the value is returned unchanged. Override this method in a subclass to map a proprietary nomenclature (e.g. an ERP specific unit code) to its UN/CEFACT equivalent before the $eligibleQuantity tree is built.
Only a scalar can name a unit : an array or an object yields null rather
than being cast, which produced the literal string "Array" for the first
and a fatal Error for the second.
Parameters
- $value : mixed
-
The raw unit code expression to resolve.
Return values
string|null —The normalized UN/CEFACT unit code, or null if the value is empty or not a scalar.
setAdditionalProperty()
Internal method to inject custom properties in the PostalAddress property of the place.
protected
setAdditionalProperty(array<string|int, mixed> $init) : void
Parameters
- $init : array<string|int, mixed>
Tags
searchEligibleQuantityByType()
Recursive internal search for a QuantitativeValue by UnitOfSaleType.
private
searchEligibleQuantityByType(string $type, array<string|int, mixed>|QuantitativeValue|null $qv) : QuantitativeValue|null
Parameters
- $type : string
-
One of the UnitOfSaleType::* constants.
- $qv : array<string|int, mixed>|QuantitativeValue|null