ryan Posted March 9, 2018 Share Posted March 9, 2018 This week we take a look at something really cool we added a few months ago but haven’t told you about yet: owner selectors. We also take a brief look at what’s new in ProcessWire 3.0.95 and and the status of our next master version, which is just about ready! https://processwire.com/blog/posts/processwire-3.0.95-core-updates/ 17 3 Link to comment Share on other sites More sharing options...
Sergio Posted March 9, 2018 Share Posted March 9, 2018 (edited) Ryan, great work, as always, on the "owner" selection! Very cool stuff!! I'm eager to use it someday! Edited March 9, 2018 by Sergio grammar 1 Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted March 9, 2018 Share Posted March 9, 2018 option 1: w/ 'owner' selector (as mentioned in blog post) $items = $pages->find( "template=architect, " . "architects.owner.parent.name=atlanta, " . "architects.owner.height>1000" ); option 2: w/o 'owner' selector (2 queries required) $architects = new PageArray(); foreach($pages->find("template=building,height>1000,parent.name=atlanta") as $building) { $architects->add($building->architects); } option 3: w/o 'owner' selector but requires a bi-directional relationship field called 'buildings' on the 'architect' template (using the bi-directional approach or possibly PagefieldPairs, or ConnectPageFields): $pages->find("parent=/architects/,template=architect,buildings.parent.name=atlanta,buildings.height>1000"); Hopefully that de-mystifies it. I come across this brain twister once in a while. 5 Link to comment Share on other sites More sharing options...
DaveP Posted March 10, 2018 Share Posted March 10, 2018 13 hours ago, Jonathan Lahijani said: I come across this brain twister once in a while. Know exactly what you mean! I had something similar a couple of years ago and did find a kinda solution, but was never happy with it. Just hope I remember about this next time the need arises. Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted March 10, 2018 Share Posted March 10, 2018 Cool stuff @ryan! Are there any chances this could be implemented for Table and TableRows? Would be great to have it there too. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now