Jump to content

Recommended Posts

Posted

I understand from the selectors documentation:

Quote

Selector values are not case sensitive unless you configure your MySQL with a case sensitive collation.

I have a repeater field `promo_codes` consisting of text field `title` and an integer field `number1`. I'm running a find:

$page->promo_codes->find('title=gmtest');

The database column collation is `utf8_general_ci` so I would expect this to work, but it only works when I match the case exactly ("GMTEST").

This is on PW 3.0.42. Any ideas? Is there an exception for finds on repeater fields?

Posted

The selectors documentation is focused on PageFinder operations that query the database - $pages->find(), $page->children(), etc.

When you use find() on a Repeater field value you are searching a PageArray in memory and the database is not involved, so that is probably the reason for the difference. You could use a different operator like ~= or %= for a case-insensitive search.

It would be good if the selectors documentation had more information about the differences between selectors used in PageFinder::find() vs WireArray::find().

  • Like 1
  • Thanks 1
Posted

Aha, that makes sense. For now I'll make a note the field should be entered in uppercase, then I'll use strtoupper() when building my selector.

Thanks!

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...