예제 #1
0
 /**
  * @param ServiceManager $serviceManager
  * @param AbstractEntity $entity
  * @param SimpleFMAdapter $simpleFMAdapter
  */
 public function __construct(AbstractEntity $entity, SimpleFMAdapter $simpleFMAdapter, Identity $identity = NULL, $encryptionKey = NULL)
 {
     $this->setSimpleFMAdapter($simpleFMAdapter);
     $this->setEntityName(get_class($entity));
     $this->setEntityLayout($entity->getDefaultWriteLayoutName());
     if (!empty($identity) && !empty($encryptionKey)) {
         $this->simpleFMAdapter->setUsername($identity->getUsername());
         $this->simpleFMAdapter->setPassword($identity->getPassword($encryptionKey));
     }
 }
예제 #2
0
$adapter->setHostParams(array('hostname' => 'localhost', 'dbname' => 'FMServer_Sample', 'username' => 'someusername', 'password' => 'somepassword'));
/**
 * After you have initialized a SimpleFMAdapter with valid credentials, there are a number of ways to make calls with it.
 * The simplest is to setCallParams with a layoutname and a commandstring. The commandstring follows the XML RPC
 * syntax for FileMaker Server 12. See /documentation/fms12_cwp_xml_en.pdf, Appendix A on page 43 for details.
 */
$adapter->setCallParams(array('layoutname' => 'Tasks', 'commandstring' => '-max=10&-skip=5&-findall'));
/**
 * You may also update an adapter's credentials at runtime, either by setCredentials with a new array
 */
$adapter->setCredentials(array('username' => 'someotherusername', 'password' => 'someotherpassword'));
/**
 * ...or with the setUsername and setPassword methods.
 */
$adapter->setUsername('Admin');
$adapter->setPassword('');
/**
 * There are individual getters and settes for every property (except there is no getter for the password property)
 * Experiment with the getters and setters to modify the adapter and set new queries for execution
 */
$adapter->setLayoutname('Projects');
/**
 * As already mentioned, for basic usage, you can define commands using the FileMaker XML url api syntax.
 * See /documentation/fms12_cwp_xml_en.pdf
 */
$adapter->setCommandstring('-findall');
/**
* For more fine-grained control, you can also interact with the adapter's commandarray.
* This is useful because it lets you modify existing commands on the adpater, and add new commands
* without blowing away existing command properties. For example: