A place for users and developers of the Xataface to discuss and receive support.
by silma » Fri Jun 12, 2009 9:47 am
Hello,
I'd like to filter my "add existing record" but each time i write
"vocabulary:existing = " in my relationship.ini, i've got this error :
Warning: array_keys() [function.array-keys]: The first argument should be an array in /(...)/web/xataface/Dataface/Relationship.php on line 1175
Warning: Invalid argument supplied for foreach() in /(...)/web/xataface/Dataface/Relationship.php on line 1175
The error appears with all the type of valuelist i could think of (even empty one, or well specified as "array" in a valuelist fonction in my delegate class).
It happen with all my relationship (some are defined by sql, some in the "xatafacel" way), and whathever table I choose.
I'm quite sure i'm doing something wrong..
Is there a special syntax for this sort of valuelist ?
Thanks a lot for your help,
Silma
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
by shannah » Fri Jun 12, 2009 10:38 am
What values are you putting for your vocabulary:existing? I believe it should be the name of a valuelist.
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by silma » Fri Jun 12, 2009 12:26 pm
Yes, it's the name of my valuelist.
I tried to describe this valuelist in my valuelist.ini, or in my delegate class, but i always have the same error.
On the other hand, I don't have any problem with the valuelist of the form : they works perfectly well, even the one with "complicated" request.
It's just with the existing record list that i've got trouble, so i wonder what's so different.
Thank you very much for the time you spend helping me !
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
by shannah » Fri Jun 12, 2009 12:33 pm
I just took a peak at the code in this part. One place that could be steering you wrong is that the valuelist should be defined in the domain table (i.e. the target table of the relationship, or at the application level -- not in the source table.
E.g. try moving the valuelist definition into your application valuelists.ini file
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by silma » Sat Jun 13, 2009 8:17 am
Hello Steve,
It works !
Not in my app valuelist, but in the target table valuelist.
I would never have thought of that by myself.
Thank you, once more !
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
by silma » Sat Jun 13, 2009 9:35 am
Hello again,
I noticed a curious thing :
When I use the "add existing record" button, Xataface insert a new record in my jointable, but also an empty one in my second table.
For example :
Table1 (Table1ID, Name, Comments, BaseID)
Table2 (Table2ID, Adress, Color, BaseID)
Table1Table2 (Table1ID, Table2ID, BaseID)
If I'm in my Table1 view, i choose the Table2 relationship tab, and then "add existing record".
I choose one of my record, and then "Save".
Two records appear in my database :
- one in Table1Table2 , with the good value
- one in Table2, with everything empty except the autoincremented Table2ID.
I first thought it was coming from my brand new valuelist, but then I noticed that it happened with all my many to many relationship. (even the one without valuelist)
It's not really embarrassing, because i clean my database quite often, but it puzzled me.
Is this the normal behaviour ?
Thanks again,
Silma
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
by shannah » Sat Jun 13, 2009 10:29 am
Can you post the relationship definition from the relationships.ini file?
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by silma » Sun Jun 14, 2009 3:19 am
Hello,
Reading your response, i guess that's not a normal behaviour, so i took my old relationship.ini files and look at what could be different from the wiki exemple :
- Code: Select all
[Ventilation] ventilation.VentilationID=batimentventilations.VentilationIDE ventilation.BaseID=batimentventilations.BaseIDE batimentventilations.BatimentIDE="$BatimentID" vocabulary:existing = Ventilation
I transformed it like that : - Code: Select all
[Ventilation] ventilation.VentilationID=batimentventilations.VentilationIDE batimentventilations.BatimentIDE="$BatimentID" vocabulary:existing = Ventilation
This way, everything works, no more empty record generated in my ventilation table.
The trouble is, I dont have a filter on my BaseID fields anymore, and all the record appears in my related_record_list.
Is there an other way to filter this list ?
Thanks a lot,
Silma
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
by silma » Sun Jun 14, 2009 6:15 am
Hello again,
I manage to set my filter in the __sql__ function of my table delegate class.
Everything seems to work now.
Thanks a lot for your help.
Silma
-
silma
-
- Posts: 87
- Joined: Tue Apr 28, 2009 11:47 pm
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 26 guests
|