Skip to content

Commit

Permalink
Fixed exception related that Datetimeimmutables were used were doctri…
Browse files Browse the repository at this point in the history
…ne expected mutable ones

this prevented the saving of parts from info providers
  • Loading branch information
jbtronics committed Jun 13, 2024
1 parent 6e9b337 commit 7ad2fab
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/Entity/Attachments/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ abstract class Attachment extends AbstractNamedDBElement
protected ?AttachmentType $attachment_type = null;

#[Groups(['attachment:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['attachment:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


public function __construct()
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Attachments/AttachmentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ class AttachmentType extends AbstractStructuralDBElement
protected Collection $attachments_with_type;

#[Groups(['attachment_type:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['attachment_type:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


public function __construct()
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Base/AbstractCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
abstract class AbstractCompany extends AbstractPartsContainingDBElement
{
#[Groups(['company:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['company:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;

/**
* @var string The address of the company
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/Base/TimestampTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@
trait TimestampTrait
{
/**
* @var \DateTimeInterface|null the date when this element was modified the last time
* @var \DateTime|null the date when this element was modified the last time
*/
#[Groups(['extended', 'full'])]
#[ApiProperty(writable: false)]
#[ORM\Column(name: 'last_modified', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;

/**
* @var \DateTimeInterface|null the date when this element was created
* @var \DateTime|null the date when this element was created
*/
#[Groups(['extended', 'full'])]
#[ApiProperty(writable: false)]
#[ORM\Column(name: 'datetime_added', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;

/**
* Returns the last time when the element was modified.
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/LogSystem/AbstractLogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ abstract class AbstractLogEntry extends AbstractDBElement
#[ORM\Column(type: Types::STRING)]
protected string $username = '';

/** @var \DateTimeInterface The datetime the event associated with this log entry has occured
/** @var \DateTime The datetime the event associated with this log entry has occured
*/
#[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)]
protected \DateTimeInterface $timestamp;
protected \DateTime $timestamp;

/**
* @var LogLevel The priority level of the associated level. 0 is highest, 7 lowest
Expand Down Expand Up @@ -174,7 +174,7 @@ public function getTimestamp(): \DateTimeInterface
*
* @return $this
*/
public function setTimestamp(\DateTimeInterface $timestamp): self
public function setTimestamp(\DateTime $timestamp): self
{
$this->timestamp = $timestamp;

Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Parts/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ class Category extends AbstractPartsContainingDBElement
protected Collection $parameters;

#[Groups(['category:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['category:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;

#[Assert\Valid]
#[ORM\Embedded(class: EDACategoryInfo::class)]
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Parts/Footprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ class Footprint extends AbstractPartsContainingDBElement
protected Collection $parameters;

#[Groups(['footprint:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['footprint:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;

#[Assert\Valid]
#[ORM\Embedded(class: EDAFootprintInfo::class)]
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Parts/InfoProviderReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class InfoProviderReference

#[Column(type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
#[Groups(['provider_reference:read'])]
private ?\DateTimeInterface $last_updated = null;
private ?\DateTime $last_updated = null;

/**
* Constructing is forbidden from outside.
Expand Down Expand Up @@ -139,7 +139,7 @@ public static function providerReference(string $provider_key, string $provider_
$ref->provider_key = $provider_key;
$ref->provider_id = $provider_id;
$ref->provider_url = $provider_url;
$ref->last_updated = new \DateTimeImmutable();
$ref->last_updated = new \DateTime();
return $ref;
}

Expand All @@ -154,7 +154,7 @@ public static function fromPartDTO(SearchResultDTO $dto): self
$ref->provider_key = $dto->provider_key;
$ref->provider_id = $dto->provider_id;
$ref->provider_url = $dto->provider_url;
$ref->last_updated = new \DateTimeImmutable();
$ref->last_updated = new \DateTime();
return $ref;
}
}
4 changes: 2 additions & 2 deletions src/Entity/Parts/MeasurementUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
protected Collection $parameters;

#[Groups(['measurement_unit:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['measurement_unit:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Parts/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ class Part extends AttachmentContainingDBElement
protected ?Attachment $master_picture_attachment = null;

#[Groups(['part:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['part:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


public function __construct()
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Parts/PartLot.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
protected string $comment = '';

/**
* @var \DateTimeInterface|null Set a time until when the lot must be used.
* @var \DateTime|null Set a time until when the lot must be used.
* Set to null, if the lot can be used indefinitely.
*/
#[Groups(['extended', 'full', 'import', 'part_lot:read', 'part_lot:write'])]
#[ORM\Column(name: 'expiration_date', type: Types::DATETIME_MUTABLE, nullable: true)]
#[Year2038BugWorkaround]
protected ?\DateTimeInterface $expiration_date = null;
protected ?\DateTime $expiration_date = null;

/**
* @var StorageLocation|null The storelocation of this lot
Expand Down Expand Up @@ -246,7 +246,7 @@ public function getExpirationDate(): ?\DateTimeInterface
*
*
*/
public function setExpirationDate(?\DateTimeInterface $expiration_date): self
public function setExpirationDate(?\DateTime $expiration_date): self
{
$this->expiration_date = $expiration_date;

Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Parts/StorageLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ class StorageLocation extends AbstractPartsContainingDBElement
protected ?Attachment $master_picture_attachment = null;

#[Groups(['location:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['location:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


/********************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/PriceInformations/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class Currency extends AbstractStructuralDBElement
protected Collection $pricedetails;

#[Groups(['currency:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['currency:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


public function __construct()
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/ProjectSystem/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ class Project extends AbstractStructuralDBElement
protected Collection $parameters;

#[Groups(['project:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;
#[Groups(['project:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;


/********************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions src/Entity/UserSystem/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected ?int $id = null;

#[Groups(['user:read'])]
protected ?\DateTimeInterface $lastModified = null;
protected ?\DateTime $lastModified = null;

#[Groups(['user:read'])]
protected ?\DateTimeInterface $addedDate = null;
protected ?\DateTime $addedDate = null;

/**
* @var bool Determines if the user is disabled (user can not log in)
Expand Down Expand Up @@ -317,10 +317,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected ?PermissionData $permissions = null;

/**
* @var \DateTimeInterface|null the time until the password reset token is valid
* @var \DateTime|null the time until the password reset token is valid
*/
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
protected ?\DateTimeInterface $pw_reset_expires = null;
protected ?\DateTime $pw_reset_expires = null;

/**
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
Expand Down Expand Up @@ -535,7 +535,7 @@ public function getPwResetExpires(): \DateTimeInterface|null
/**
* Sets the datetime when the password reset token expires.
*/
public function setPwResetExpires(\DateTimeInterface $pw_reset_expires): self
public function setPwResetExpires(\DateTime $pw_reset_expires): self
{
$this->pw_reset_expires = $pw_reset_expires;

Expand Down
2 changes: 1 addition & 1 deletion src/Entity/UserSystem/WebauthnKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WebauthnKey extends BasePublicKeyCredentialSource implements TimeStampable
protected ?User $user = null;

#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
protected ?\DateTimeInterface $last_time_used = null;
protected ?\DateTimeImmutable $last_time_used = null;

public function getName(): string
{
Expand Down

0 comments on commit 7ad2fab

Please sign in to comment.