2 Replies Latest reply on Mar 1, 2013 1:32 AM by mbraendle

    PHP API private functions

    mbraendle

      Eclipse shows me two functions of the PHP API (FMS 11) which are not available in the documentation made with phpDocumentor.

      Both are marked as "@access private".

       

      - loadExtendedInfo($recid = null) in Layout.php "Loads extended (FMPXMLLAYOUT) layout information."

      - getRelatedRecordById($relatedSetName, $recordId) in Record.php "Gets a specific related record"

       

      Is there any argument speaking against using them?

      Are these functions also available in PHP API for FMS 12 (just don't have it at hand).

        • 1. Re: PHP API private functions
          steve.winter

          Hi Martin

           

          I can confirm that loadExtendedInfo exists in the FM12 API, however looking at the @return for the function it's not actually going to be much use calling the function

           

          /**

                

          • Loads extended (FMPXMLLAYOUT) layout information.

               *

                

          • @access private

               *

                

          • @param string  $recid Record from which to load extended information.

               *

                

          • @return boolean|FileMaker_Error TRUE, if successful. Otherwise, an

                

          •         Error object.

               */

              function loadExtendedInfo($recid = null)

           

          All you're going to get back (according to the docs above) is either TRUE, or an error object. Looking at function which it calls in LayoutImpl.php, and then further on into FMPXMLLAYOUT.php it's going to be very difficult for you to get to the data which is being set a a property of the current layout object because it vanishes off into obfuscated code.

           

          The getRelatedRecordByID method also still exists in 12, and calling it looks like it may be more useful;

           

              /**

                

          • Gets a specific related record.

               *

                

          • @access private

               *

                

          • @param string $relatedSetName Name of the portal.

                

          • @param string $recordId Record ID of the record in the portal.

                

                

          • @return FileMaker_Response Response object.

               */

              function getRelatedRecordById($relatedSetName, $recordId)

           

          since at least it will actually return an FM response object (i.e. you should get the data back). From the look of what's happening in RecordImpl.php, so long as you call that against a record object, it should prove to be useful - I'm not however sure how you intend to discover the $recordId, without first calling another method which would also have provided you with all of the data which calling that method would…?

           

          What's the problem that you're trying to solve by calling either of these…?

           

          Cheers

          Steve

          • 2. Re: PHP API private functions
            mbraendle

            Thank you Steve,

             

            yes, this was also my thought - you could address a specific related record directly, but for this you need the record ID. Well, if the record ID is not the internal ID used in the database, but an ID that just counts the portal rows, there is some chance.

             

            Well, I discovered this function by accident while migrating my Library Navigator project (http://www.infochembio.ethz.ch/en/librarynavigator.html ) from XML/XSLT (about 20 files) to PHP. At the end, everything should be PHP/HTML5/JavaScript only.

             

            I solved the specific question I had in another way.

             

            There's a certain inconsistency in the PHP API. While there are getFoundSetCount(), getFetchCount() and getTableRecordCount() functions for the master table/result set, there isn't anything similar for the related set, and you need to use the PHP count() function on the getRelatedSet array to obtain the number of portal rows. However, if you look at the corresponding XML result set in the fmresultset grammar, the count of portal rows is indeed there:

             

            <relatedset count="1" table="Views">

            <record mod-id="14" record-id="1">

            <field name="Views::ID">

            <data>1</data>

            </field>

            <field name="Views::Modus">
              <data>0</data>

            </field>

            </record>

            </relatedset>

             

            But aren't we all used to inconsistencies across implementation of features in FileMaker?

             

             

            steveWinter wrote:

             

            Hi Martin

             

            (...)

             

                function getRelatedRecordById($relatedSetName, $recordId)

             

            since at least it will actually return an FM response object (i.e. you should get the data back). From the look of what's happening in RecordImpl.php, so long as you call that against a record object, it should prove to be useful - I'm not however sure how you intend to discover the $recordId, without first calling another method which would also have provided you with all of the data which calling that method would…?

             

            What's the problem that you're trying to solve by calling either of these…?

             

            Cheers

            Steve