Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6985301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:39:45+00:00 2026-05-27T18:39:45+00:00

I got the following: $post = (array) json_decode($post); $pushUser->dagen = (array) $post[‘days’]; The ‘days’

  • 0

I got the following:

$post = (array) json_decode($post);
$pushUser->dagen = (array) $post['days'];

The ‘days’ part of the post is:

[dagen] => Array
    (
        [0] => Monday
        [1] => Wednesday 
    )

All I want to do is store in $pushUser-dagen the array with days :)… pretty easy huh?

But then I get these errors:

exception ‘RedBean_Exception_Security’ with message ‘Invalid Bean: property dagen ‘ in E:\Documenten\Dropbox\Dropbox\dummy-htdocs\VID_service\vid_push\libs\rb.php:3465
Stack trace:
#0 E:\Documenten\Dropbox\Dropbox\dummy-htdocs\VID_service\vid_push\libs\rb.php(3496): RedBean_OODB->check(Object(RedBean_OODBBean))
#1 E:\Documenten\Dropbox\Dropbox\dummy-htdocs\VID_service\vid_push\libs\rb.php(7376): RedBean_OODB->store(Object(RedBean_OODBBean))
#2 E:\Documenten\Dropbox\Dropbox\dummy-htdocs\VID_service\vid_push\api\registerpush.php(32): R::store(Object(RedBean_OODBBean))
#3 {main}

Is it not possible to store arrays in a RedBean Object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:39:46+00:00Added an answer on May 27, 2026 at 6:39 pm

    There is no way to store arrays in beans because RedBeanPHP cannot predict how you want the array to be represented in the database.

    The solution depends on what you want to do with this information later. Do you want to add other things than just weekdays, like evenings or overtime (in case of scheduling?), in this case I would opt for the most flexible yet easy solution:

    //Flexible solution
    foreach($days as $day) 
    $user->sharedDay[] = R::findOne('day',' name = ? ',array($day));
    

    Because we use sharedDay instead of ownDay, the records will not be duplicated. This solution creates a neat link table day_user.

    Of course you need to store the week days in the database once:

     $days = array('monday',...);
     foreach($days as $dayname) {
        $d = R::dispense('day');
        $d->name = $dayname;
        R::store($d);
     }
    

    If you want to be able to quickly trace a user with a certain weekday profile you may want to encode the days:

    //Performance solution
    function days($days) {
        $weekdays = array('sunday','monday','tuesday',...);
        $field = '';
        foreach($weekdays as $day) {
                $field .= (in_array($day,$days)) ? '1' : '0';
        }
        return $field;
    }
    
    
    $user->days = bindec(days($days)); 
    

    In this case you can find every user that has ‘monday’ and ‘saturday’ by querying: days = 33. That’s really fast.

    If you don’t care about the data at all you might go with:

    //Quick and dirty solution
    $user->days = implode(',',$days);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got following part of one of functions if(continiueSend) { $.ajax ({ type: POST,
I've got the following F# code: //Array iter version let toSecureString (s:string) = let
I got the following class and I want to know if it is possible
I got the following exception when i try to post a message on a
I got following code in an XHTML-document and every browser saysit is malformed :(
I got following error... System.NullReferenceException: Object reference not set to an instance of an
I've got following problem: (c#) There is some class (IRC bot), which has method,
i've got following example xml: <entity id=1> <name>computer</name> <type>category</type> <entities> <entity id=2> <name>mac</name> <type>category</type>
I've got following URL in symfony (specifics not important): /frontend_dev.php/something/25/apple ... and a routing
I tried installing TurboGears 1.0 on Windows 7 using tgsetup.py. and got following error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.