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 3311314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:51:44+00:00 2026-05-17T21:51:44+00:00

We are working on a Builder type interface that basically constructs a list for

  • 0

We are working on a Builder type interface that basically constructs a list for doing CRUD management of individual objects (since we’re using ActiveRecord an object == a database record).

In order to make specifying the column values and parameters for list options flexible we originally implemented the callback arguments as an array that looked like this:

'params' => array(
              'static' => $this->institution->id, 
              array(
                'method1' => array(
                                'method_name', 
                                array('arg1', 'arg2')
                             ), 
                             'prop1' => 'id')

This solution presents some obvious drawbacks just in terms of awkwardness, etc. but it worked.

At the suggestion of a coworker, we have tried implementing closures but due to another requirement with the class, we have to serialize all of the data in the class which we only just discovered won’t work with closures. The syntax with the closures was obviously much simpler:

'params' => array(
               $this->institution->id,
               function($obj) { return $obj->method_name($arg1, $arg2)->id; }
             )

So my first question is whether there is a way to store the closure in a serializable format (like a string) and then convert it back to a closure once the class is unserialized ?

Or can anyone provide a suggestion on a better interface for solving this sort of callback problem?

  • 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-17T21:51:45+00:00Added an answer on May 17, 2026 at 9:51 pm

    There is an excellent and detailed post on how to use Reflection to extend Closures to do what you want: Extending PHP 5.3 Closures with Serialization and Reflection. That said, I wonder if this is any less awkward than your original solution, since you’ll have to pass objects instead – it effectively just codifies it slightly differently and you might just end up with a performance hit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I'm working on some air stuff, and I am using Flash Builder and
I'm building a report using Report Builder 3.0. The source system I'm working with
This is a basic understanding concepts related question. Working using: Embarcadero C++ Builder What
I've been working on an iPhone application in XCode and Interface Builder of the
I am working on a model criteria builder. I have a dropdown list with
I am working on a project that is utilizing Flash Professional and Flash Builder.
I'm working a form builder interface for users to add various input fields, and
I am working with Flash Builder 4.5 using Adobe Air, Flex and Actionscript 3,
I am working on a GUI in Interface Builder for an iPhone app. In
While working in Interface Builder within Xcode (4.3.2), the application froze and I had

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.