View Single Post
  #10  
Old 10-04-2019, 05:38 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: "Fake" orders (or how do a cart become an order ?)

Quote:
Originally Posted by cflsystems
Yes. The DescriminatorColumn defines the column in the table and the DescriminatorMap maps its value to class.


So if you need only non-orders create new query with placeOnly equal false.


Alternatively you can just decorate the Order model class and add another field for your own use - if true it is your fake order. Then use it in a query to find your own records.


I think I got it. Well, if I create new query with placeOnly equal false, I will get both real and fake orders, right? Since I am removing the "where" clause.


Now my next problem is this: in the end, I would like to have ItemsList of real orders only (as there are currently) and ItemsList of fake orders only. In the future I might want to have a "mixed" list, but let's forget it for now. How can I do this?


Can I override from itemslist class the default parameter of createquerybuilder set in repo class? At a first glance, this doesn't look possible. If there is such a way, it will really save me...



Of course, I can decorate the repository class, but this would affect all itemslists concerning products. Since these itemslists don't seem to call createquerybuilder with the third argument (they don't seem to directly call createquerybuilder, so the third argument could be only set by default in the repository class), this means I will have to decorate all itemslist classes where I only want "real" orders.


I also have an extra property in the order model, but using this instead of is_order=0 gives me the same problem (well, at least I won't have to decorate the createquerybuilder function), i.e., I will have to redecorate all existing product lists not to show the fake orders.



I am tempted to create a new model "fake orders" which are in one to one to the orders that are fake, and this should solve all my problems, but I wonder if there could be a simpler way.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote