-1

Tell me please, How this PHP code write on RedBean? Or why do I see error?

$group->group_list = explode(PHP_EOL, $data['group_list']);

Result:

Fatal error: Uncaught RedBeanPHP\RedException: Invalid Bean value: property group_list in /var/www/...

Qirel
  • 25,449
  • 7
  • 45
  • 62
arbalet
  • 11
  • 1
    Your error doesn't seem to be with PHP_EOL, but rather the first half of your statement. Looks like $group->group_list doesn't exist. Try dumping out $group to see what you're looking for. – Andrew Jul 12 '19 at 07:23
  • Sure this is related to `PHP_EOL`?! Because your error clearly states `Invalid Bean value: property group_list` that something is wrong with `group_list` – brombeer Jul 12 '19 at 07:23

1 Answers1

0

As far as i can see, there's simply no attribute (or property) 'group_list' in your object $group. So your error is not about PHP_EOL, but a not existing property in an existing object. That's also what your exception tells you: '....invalid Bean value: property group_list in...'. ;-)

m.baer
  • 1
  • 1
  • Why if I use $group->group_list = $data['group_list'], then everything is fine? – arbalet Jul 12 '19 at 07:29
  • Ah, ok. Seems i got the error wrong. The value you set for property group_list doesn't seem to fit. Can you please give me the complete error message? Also, what is the content for the exploded array value? And what is expected for property group_list in object? – m.baer Jul 12 '19 at 07:35
  • So maybe property group_list expects an array and not a string (which is returned by your explode, i guess)? – m.baer Jul 12 '19 at 07:43
  • I need add from one field Textarea a some lines to the database. ERROR: Fatal error: Uncaught RedBeanPHP\RedException: Invalid Bean value: property group_list in /var/www/site.com:7126 Stack trace: #0 /var/www/sote.com(7632): RedBeanPHP\Repository->check(Object(RedBeanPHP\OODBBean)) #1 – arbalet Jul 12 '19 at 07:44
  • So $data['group_list'] stores a string from a textfield - is that correct? So the result from the expldoe function is array. To be honest: I'm not familier with Red Beans...So my best guess is, to check what type of data is expected in property group_list. – m.baer Jul 12 '19 at 07:59