5959use Doctrine \Common \Collections \ArrayCollection ;
6060use Doctrine \Common \Collections \Collection ;
6161use Doctrine \ORM \Mapping as ORM ;
62+ use Doctrine \DBAL \Types \Types ;
6263use Symfony \Bridge \Doctrine \Validator \Constraints \UniqueEntity ;
6364use Symfony \Component \Serializer \Annotation \Groups ;
6465use Symfony \Component \Validator \Constraints as Assert ;
99100#[ApiFilter(PartStoragelocationFilter::class, properties: ["storage_location " ])]
100101#[ApiFilter(LikeFilter::class, properties: ["name " , "comment " , "description " , "ipn " , "tags " , "manufacturer_product_number " ])]
101102#[ApiFilter(BooleanFilter::class, properties: ["favorite " , "needs_review " ])]
102- #[ApiFilter(RangeFilter::class, properties: ["mass " , "minamount " ])]
103+ #[ApiFilter(RangeFilter::class, properties: ["mass " , "minamount " , " orderamount " ])]
103104#[ApiFilter(DateFilter::class, strategy: DateFilterInterface::EXCLUDE_NULL )]
104- #[ApiFilter(OrderFilter::class, properties: ['name ' , 'id ' , 'addedDate ' , 'lastModified ' ])]
105+ #[ApiFilter(OrderFilter::class, properties: ['name ' , 'id ' , 'orderDelivery ' , ' addedDate ' , 'lastModified ' ])]
105106class Part extends AttachmentContainingDBElement
106107{
107108 use AdvancedPropertyTrait;
@@ -124,6 +125,15 @@ class Part extends AttachmentContainingDBElement
124125 #[UniqueObjectCollection(fields: ['name ' , 'group ' , 'element ' ])]
125126 protected Collection $ parameters ;
126127
128+ /**
129+ * @var \DateTimeInterface|null Set a time when the new order will arive.
130+ * Set to null, if there is no known date or no order.
131+ */
132+ #[Groups(['extended ' , 'full ' , 'import ' , 'part_lot:read ' , 'part_lot:write ' ])]
133+ #[ORM \Column(name: 'orderDelivery ' , type: Types::DATETIME_MUTABLE , nullable: true )]
134+ #[Year2038BugWorkaround]
135+ protected ?\DateTimeInterface $ orderDelivery = null ;
136+
127137
128138 /** *************************************************************
129139 * Overridden properties
@@ -214,6 +224,26 @@ public function __clone()
214224 parent ::__clone ();
215225 }
216226
227+ /**
228+ * Gets the expected delivery date of the part. Returns null, if no delivery is due.
229+ */
230+ public function getOrderDelivery (): ?\DateTimeInterface
231+ {
232+ return $ this ->orderDelivery ;
233+ }
234+
235+ /**
236+ * Sets the expected delivery date of the part. Set to null, if no delivery is due.
237+ *
238+ *
239+ */
240+ public function setOrderDelivery (?\DateTimeInterface $ orderDelivery ): self
241+ {
242+ $ this ->orderDelivery = $ orderDelivery ;
243+
244+ return $ this ;
245+ }
246+
217247 #[Assert \Callback]
218248 public function validate (ExecutionContextInterface $ context , $ payload ): void
219249 {
0 commit comments