Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ModelAdmin: Wrong datarecords in ResultSet


Go to End


4 Posts   1312 Views

Avatar
Matze0681

Community Member, 25 Posts

11 May 2010 at 10:13am

Hi,

i got a problem that there are wrong datarecords displayed in one Models Results. I got Countries which has_many Schools and one School has_one Country. But in ModelAdmin results (just in some countries) are Schools listet which are related to another country than the selectet. I checked the database entries for both schools and countries and the relations are setup correctly there.. One School got one CountryID and only exists once, but some schools are shown in different Countries.

Couldnt find out anything about that problem in the Internet.

Did somebody experience a similar problem with perhaps possible cause of that error ? Perhaps a ModelAdmin Bug ?

thanks in advance
matze

Avatar
Matze0681

Community Member, 25 Posts

19 May 2010 at 11:20am

Nobody got an advice? really stuck with that...:(

I attached an example screenshot to this post. There u can see we are in the Country "Angleterre", but the first two Schools/Cities are in Spain (The database entries / relations are pointing to the correct ID(Spain) from these Schools!!). The Entry(Result Count) is wrong too. There are no 30 Entries in the Displayed Resultset...

any ideas ?

Attached Files
Avatar
Matze0681

Community Member, 25 Posts

20 May 2010 at 11:01am

im getting a step forward with that..

i know where the error comes from, but not how to solve it.

The error appears only in Schools which CountryID >= 10

and for example:
in ModelAdmin when i select the School
-> with ID 1 -> Entries from ID 10 and 13 are shown in the result table( + the correct entries with ID 1)
-> with ID 2 -> Entries from ID 12 are shown in the result table (+ the correct entries with ID 2)
-> with ID 3 -> Entries from ID 13 are shown (+ the correct entries with ID 3)
...

Does that help you to help me ? ;)

Avatar
Matze0681

Community Member, 25 Posts

20 May 2010 at 1:30pm

the problem was that the default Filter for searchable_fields = PartialMatchFilter. So the search found everthing LIKE %ID%

Solution:

	static $searchable_fields = array(
		'Name',
		'Country.ID' => 'ExactMatchFilter'
	);