I have a product and it has relation tables(ex: category). When we modify anything on the relation table. The audit listener is not updating the product updated time. I have entity listeners but it is only updating when we update the data in the product table.
#EntityListeners(value = AuditListener.class)
How I can achieve this?
Thanks , in advance.
Sri.
Related
I have two tables Order and OrderItem where OrderItem has the order_id as foreign key from Orders table. I have used laravel relationship in each of their model. Upon deleting a record from Order table which has relation in the OrderItem, I want to update a column name "Cancel" to true in OrderItem table and then soft delete the record.
I only know the manual method where I find the record by id, then update and soft delete it. Can anyone help me with shorter and easier method? Thank you.
I think you're mean is soft delete.
you can see this document.
I'm building query to load modules in Many To Many (Polymorphic) relation with another model; and this query will be used in Laravel-Excel to export excel file.
The excel file generated successfully but with pivot table query, how can I hide the pivot table from the query?
Please advice,
I have following Database Tables
User
-idUser
Products
-idProducts
Product_Collector
-Product_CollectorID
-idProducts (foreign)
-idUser (foreign)
Ticket
-idTicket
-Product_CollectorID
Currently I'm modeling all these Database Tables in Laravel.
But I'm struggeling with the function to get the Products associated with the Tickets.
Do I have to create a model for the Product_Collector? Or is there any other good solution?
If there any particular column in tables where Magento stores this data? For example if i want to fetch the data from somewhere else. By running raw php mysql queries.
Not using Magento layer.
I know there is a function getTotal(). But hope you understand what I am trying to say.
Is there any way other than creating own custom API?
Thanks
You're probably looking for the sales_flat_order table. Specifically, if you want the sum of all sales taken by your store:
SELECT SUM(grand_total) FROM sales_flat_order WHERE is_active = 1;
I was wondering if there is a way to get a record with all relational data, something like a 'Deep-Fetch'
So if a model Child were related to another model Parent,
can we fetch Child & then access Child->Parent->name thru a single query?
Doctrine today fires a query whenever a relationship is accessed. Is this too costly? does it need to be optimizeD?
thanks
Doctrine automatically hydrates related objects when you select fields from that relations:
Doctrine_Query::create()
->select('a.*, c.*)
->from('Article a')
->innerJoin('Category c');
In this example both Article and Category objects are being hydrated (no additional queries are made).