monollonom Posted June 2, 2018 Share Posted June 2, 2018 (TL;DR : I extended from Inputfield instead of InputfieldMulti. Still learning...) Hi, I'm trying to create my own Fieldtype to go along a custom Inputfield, but I can't manage to get it to work, even though it's almost identical to @ryan's FieldtypeEvents exemple. For some reason, when I hit save, there is an error saying PHP Warning: PDO::quote() expects parameter 1 to be string, array given in .../Ateliers-Renens/cms/wire/core/WireDatabasePDO.php:675 Trying to debug by comparing with the initial example behaviour, I can see that my data is properly received / translated in sleepValue() but then in sanitizeValue(), $value returns me an empty instance of my custom class. I attached screenshots showing that for both Fieldtype (the first three dumps are from sleepValue() and the last dump is from sanitizeValue()). I don't know if it has anything to do with my problem, and I must admit that I'm not that fluent in either PHP / SQL (even though ProcessWire makes me learn a lot !). In the meantime, I am going to go for another solution (just using two regular fields), but I will be glad if someone could help me on this (and make me understand where the problem is !). Just in case I made a gist : https://gist.github.com/romaincazier/43fb7c0ee1e57395fb9e839039f38100 and attached a zip (MapRoom.zip) if someone wants to install on their side, the Inputfield expect something like "0|1" (0 = room n°0, 1 = 1st floor). Thanks ! Link to comment Share on other sites More sharing options...
adrian Posted June 3, 2018 Share Posted June 3, 2018 I would put Tracy in Strict Mode (you can toggle this via the button in the Panel Selector). This way you'll get the Tracy "bluescreen" which will show you a full stack trace so you can figure out what line in your module is causing the problem, rather than the final WireDatabasePDO.php as reported in the warning. The warning is clear that you are providing an array instead of a string, but this will help you figure out where this is happening. 2 Link to comment Share on other sites More sharing options...
BitPoet Posted June 3, 2018 Share Posted June 3, 2018 What happens if you extend FieldtypeMulti instead of Fieldtype in FildtypeMapRoom? 1 1 Link to comment Share on other sites More sharing options...
monollonom Posted June 3, 2018 Author Share Posted June 3, 2018 1 hour ago, BitPoet said: What happens if you extend FieldtypeMulti instead of Fieldtype in FildtypeMapRoom? Oh. That's actually the one thing I missed from the Events tutorial... I will edit once tested. Edit: and of course it is now working... I feel a bit dumb. A big thank you @BitPoet for the pointer ! 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