src/Backend/Modules/Commerce/Domain/Product/Factory/ProductFactory.php
/**
     * Our entities use private properties, no setters and a private constructor. Therefore, we have to use a DTO
     * object to instantiate our Entity.
     */
Our entities use private properties, no setters and a private constructor. Therefore, we have to use a DTO
object to instantiate our Entity.
Our entities use private properties no setters and a private constructor . Therefore we have to use a DTO object to instantiate our Entity .
protected function initialize(): self
    {
        return $this
            ->instantiateWith(function (array $attributes) {
                $dto = new ProductDataTransferObject(null, Locale::fromString('en'));
                $dto->meta = $attributes['meta'];
                $dto->category = $attributes['category'];
                $dto->brand = $attributes['brand'];
                $dto->vat = $attributes['vat'];
                $dto->stock_status = $attributes['stock_status'];
                $dto->hidden = $attributes['hidden'];
                $dto->type = $attributes['type'];
                $dto->title = $attributes['title'];
                $dto->weight = $attributes['weight'];
                $dto->price = $attributes['price'];
                $dto->stock = $attributes['stock'];
                $dto->sku = $attributes['sku'];
                $dto->ean13 = $attributes['ean13'];
                $dto->isbn = $attributes['isbn'];
                $dto->summary = $attributes['summary'];
                $dto->text = $attributes['text'];
                $dto->specials = $attributes['specials'];
                $dto->vat = $attributes['vat'];
                return Product::fromDataTransferObject($dto);
            });
    }
protected function initialize ( ) : self { return $ this -> instantiateWith ( function ( array $ attributes ) { $ dto = new ProductDataTransferObject ( null , Locale :: fromString ( 'en' ) ) ; $ dto -> meta = $ attributes [ 'meta' ] ; $ dto -> category = $ attributes [ 'category' ] ; $ dto -> brand = $ attributes [ 'brand' ] ; $ dto -> vat = $ attributes [ 'vat' ] ; $ dto -> stock_status = $ attributes [ 'stock_status' ] ; $ dto -> hidden = $ attributes [ 'hidden' ] ; $ dto -> type = $ attributes [ 'type' ] ; $ dto -> title = $ attributes [ 'title' ] ; $ dto -> weight = $ attributes [ 'weight' ] ; $ dto -> price = $ attributes [ 'price' ] ; $ dto -> stock = $ attributes [ 'stock' ] ; $ dto -> sku = $ attributes [ 'sku' ] ; $ dto -> ean13 = $ attributes [ 'ean13' ] ; $ dto -> isbn = $ attributes [ 'isbn' ] ; $ dto -> summary = $ attributes [ 'summary' ] ; $ dto -> text = $ attributes [ 'text' ] ; $ dto -> specials = $ attributes [ 'specials' ] ; $ dto -> vat = $ attributes [ 'vat' ] ; return Product :: fromDataTransferObject ( $ dto ) ; } ) ; }
Our entities use private properties, no setters and a private constructor.
Our entities use private properties no setters and a private constructor .