Does anyone know how I might achieve something like this using Propel?
Afternoon all! Does anyone know how I might achieve something like this using Propel?
SELECT * FROM spy_sales_order sso LEFT JOIN spy_customer sc ON LOWER(sso.email)=LOWER(sc.email) WHERE sc.customer_reference != sso.customer_reference AND sso.email is not null;
Specifically the LOWER()
in the ON
criteria.
new SpySalesOrderQuery()) ->addJoin('spy_sales_order.email', 'spy_customer.email', Criteria::LEFT_JOIN) ->where('spy_customer.customer_reference != spy_sales_order.customer_reference') ->where('spy_sales_order.email is not null')
Doesn't appear to allow you to do anything like that 🤔
Comments
-
You could use the function
setJoinCondition
to add your condition
something likenew SpySalesOrderQuery()) ->addJoin('spy_sales_order.email', 'spy_customer.email', Criteria::LEFT_JOIN) ->setJoinCondition('spy_sales_order.email', 'LOWER(spy_sales_order.email) = LOWER(spy_customer.email)') ->where('spy_customer.customer_reference != spy_sales_order.customer_reference') ->where('spy_sales_order.email is not null')
0 -
Thanks for the reply 🙂 Unfortunately this doesn't seem to be working.
The
addJoin
method calls a method to add the join to an in memory array of "joins", indexed by a string name. But it doesn't pass the name as a parameter (which defaults to null).Then
setJoinCondition
attempts to do a lookup in that array by name, which then fails. I might look to see though if that can be patched 👍0 -
Unfortunately, I can't call
join()
either to add it initially (it seems), as there is no foreign key relation between the customer table in the orders table0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 924 Developer Corner
- 783 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random