Skip to content

Commit

Permalink
Ready for Ver.29, also close #64
Browse files Browse the repository at this point in the history
  • Loading branch information
msyk committed Dec 27, 2022
1 parent eed61d5 commit f7a761e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions samples/FMDataAPI_Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Instantiate the class FMDataAPI with database name, user name, password and host.
// Although the port number and protocol can be set in parameters of constructor,
// these parameters can be omitted with default values.
$fmdb = new FMDataAPI("TestDB", "web", "password", "192.168.17.130" /*"localhost"*/);
$fmdb = new FMDataAPI("TestDB", "web", "password", "localhost");

//==============================
//$fmdb = new FMDataAPI("TestDB", "web", "password", "localserver");
Expand Down Expand Up @@ -59,7 +59,6 @@
$pInfo = var_export($result, true);
echo htmlspecialchars("Layout Metadata (Old): {$pInfo}", ENT_QUOTES, "UTF-8") . "<hr>";

exit;
// The FMDataAPI has the property as the same name of layout. This sample database has the 'person_layout' layout,
// so '$fmdb->person_layout' refers FMLayout object fo the proxy of the layout. FMLayout class has the 'query' method
// and returns FileMakerRelation class's object. The condition spefied in parameter is same as FileMaker's Find Record API.
Expand Down Expand Up @@ -271,12 +270,14 @@
}
}

//
// The getFirstRecord method returns FileMakerRelation class object.
$result = $fmdb->person_layout->query();
$first = $result->getFirstRecord();
echo "id field of the first record: {$first->field('id')}";
echo "id field of the first record: {$first->field('id')}<br>";
$portals = $first->getPortalNames();
echo "getPortalNames of the first record: " . var_export($portals, true) . "<br>";
$contacts = $first->Contact;
echo "[PORTAL(contact_to)] id: {$contacts->field("id", "contact_to")}";
echo "[PORTAL(contact_to)] id: {$contacts->field("id", "contact_to")}<br>";

} catch (Exception $e) {
echo '<div><h3>例外発生</h3>', htmlspecialchars($e->getMessage(), ENT_QUOTES, "UTF-8"), "<div>";
Expand Down
2 changes: 1 addition & 1 deletion src/FMDataAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FMDataAPI
* @param array $fmDataSource Authentication information for external data sources.
* Ex. [{"database"=>"<databaseName>", "username"=>"<username>", "password"=>"<password>"].
* If you use OAuth, "oAuthRequestId" and "oAuthIdentifier" keys have to be spedified.
* @param boolean $isUnitTest It it's set to true, the communication provider just works locally.
* @param boolean $isUnitTest If it's set to true, the communication provider just works locally.
*/
public function __construct(
$solution, $user, $password, $host = null, $port = null, $protocol = null, $fmDataSource = null, $isUnitTest = false)
Expand Down

0 comments on commit f7a761e

Please sign in to comment.