Fork me on GitHub

When do PNObjectUtil functions trigger?  Bottom

  • When creating an object from a class:

    Code

    $object = new $class ('D', $id)


    What is the 'D' for?

    Also, does the previous trigger PNObjectUtil select and selectPostProcess functions in the object class?

    What I need to do is find a suitable place to do an "Edit Own" check and am using a generic edit function for all objects. This would only need to trigger during the edit function, not detail or view functions.

    Using class functions, what would be the best way? If I create a custom class function that is defined for 1 object class, and not for another, will the script fail? ie, $object->checkeditown(); where checkeditown exists in the class definition for object A but not for object B

    Or, what is the best method for passing to the class functions that the current mode is EDIT and to trigger a special case in a standard function - like selectPostProcess or validate()

    Any ideas? icon_smile

    NCM



  • Quote

    What is the 'D' for?

    The 'D' stands for 'get from Database'. This evaluates to the same code as:

    Code

    $object = new $class ();
    $object->get($id)



    Quote

    Also, does the previous trigger PNObjectUtil select and selectPostProcess functions in the object class?

    Yes.

    Quote

    What I need to do is find a suitable place to do an "Edit Own" check and am using a generic edit function for all objects. This would only need to trigger during the edit function, not detail or view functions.

    Use/Overide the PNObject->validate() or implement the PNObject->validatePostProcess() function(s) for this.

    Quote

    Or, what is the best method for passing to the class functions that the current mode is EDIT and to trigger a special case in a standard function - like selectPostProcess or validate()

    What I usually do in this case is to see if the object data has the object/table ID field set. If it has a proper ID field, you're editing, otherwise you're creating/inserting a new object.


    Greetings
    R
  • Thx for the info!

This list is based on users active over the last 60 minutes.