src/Backend/Modules/Commerce/Domain/OrderAddress/Factory/OrderAddressFactory.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 OrderAddressDataTransferObject();
                $dto->country = $attributes['country'];
                $dto->first_name = $attributes['first_name'];
                $dto->last_name = $attributes['last_name'];
                $dto->email_address = $attributes['email_address'];
                $dto->phone = $attributes['phone'];
                $dto->street = $attributes['street'];
                $dto->house_number = $attributes['house_number'];
                $dto->city = $attributes['city'];
                $dto->zip_code = $attributes['zip_code'];
                return OrderAddress::fromDataTransferObject($dto);
            });
    }
protected function initialize ( ) : self { return $ this -> instantiateWith ( function ( array $ attributes ) { $ dto = new OrderAddressDataTransferObject ( ) ; $ dto -> country = $ attributes [ 'country' ] ; $ dto -> first_name = $ attributes [ 'first_name' ] ; $ dto -> last_name = $ attributes [ 'last_name' ] ; $ dto -> email_address = $ attributes [ 'email_address' ] ; $ dto -> phone = $ attributes [ 'phone' ] ; $ dto -> street = $ attributes [ 'street' ] ; $ dto -> house_number = $ attributes [ 'house_number' ] ; $ dto -> city = $ attributes [ 'city' ] ; $ dto -> zip_code = $ attributes [ 'zip_code' ] ; return OrderAddress :: fromDataTransferObject ( $ dto ) ; } ) ; }
Our entities use private properties, no setters and a private constructor.
Our entities use private properties no setters and a private constructor .