Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil
Oil enum error - enhancement maybe
KoolCoder
September 2013
Hi,
Using oil and the enum type I was getting an error on this enum:
cron_type:enum[batch,non-batch,stop]
The enum datatype will not allow any type of word separators like - _ etc;
This doe's work:
cron_type:enum[batch,nonbatch,stop]
But we should be able to separate multiple words in an enum.
Thank you
Harro
September 2013
I think the problem with the minus sign isn't oil, but the fact that your shell sees it as a command delimiter.
The code does this, it really splits on the comma only:
if ($type === 'enum')
{
$values = explode(',', $option[1]);
$option[1] = '"'.implode('","', $values).'"';
$field_array['constraint'] = $option[1];
}
KoolCoder
September 2013
Why will it not accept an underscore or a space then? I can enter them in the field name using git bash.
Oil generate line 683:
preg_match('/([a-z0-9_-]+)(?:\[([0-9a-z\,\s]+)\])?/i', $part, $part_matches);
RegExp: /([a-z0-9_-]+)(?:\[([0-9a-z\,\s]+)\])?/i
pattern: ([a-z0-9_-]+)(?:\[([0-9a-z\,\s]+)\])?
flags: i
2 capturing groups:
group 1: ([a-z0-9_-]+) <-- field name
group 2: ([0-9a-z\,\s]+) <-- field value - this is not allowing for the underscore.
This is FuelPHP 1.7 dev
Harro
September 2013
Accepted Answer
Ah, there's a regex before that. I don't think it should be a problem to expand that. Could you create an issue for this at
https://github.com/fuel/oil/issues
?
KoolCoder
September 2013
Issue created thank you Harro
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
September 2013
KoolCoder
September 2013