Jump to content

Marina Syhanath

  • Content Count

  • Joined

  • Last visited

  • Days Won


Marina Syhanath last won the day on November 14 2019

Marina Syhanath had the most liked content!

1 Follower

About Marina Syhanath

  • Rank

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
  • Interests
    Nouvelles technologies, FileMaker, Réseaux

FileMaker Profile

  • FM
  • Certification
    --Non certifié--
  • Claris Partner

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Are you too always struggling with creating nice looking progress elements in FileMaker to show the user the status of the current task? Well, look no further! FMProgressIndicator will provide you with the right tools you need to implement such a progress element in FileMaker that is supported on all platforms! All it requires is some basic knowledge on FileMaker. If you have some basic knowledge on Bootstrap this will help you in making full use of the formatting options. Progress indicators? We all know that, whenever we are running a long task, the best practice is to inform the user about this. For a task that runs longer than 1 second, it’s best to use an indicator. This way the user always has feedback that the app is still working and performing the task. How do we usually do this? By simply doing nothing. Most of the times the cursor switches to a load icon and that’s it. But wait… Isn’t this the same icon that we see whenever the app is stuck and we need to force quit? Yup, that's the one! It’s up to the user to determine if this time this icon is actually an indicator of a running task. As you can understand this might be confusing for the user, especially whenever a task is long. We forward the user to a FileMaker layout where we display the text “Loading...”. This is already a better practice but without animation or an indication of the progress itself this is static content and does not give the user dynamic feedback on the actual status of the task. How we should actually be doing it Every time we perform a task that is longer than 1 second, we should forward the user to a layout where he or she can track the process or can confirm the application is still working. FileMaker provides us with various window types that we can use for displaying a dynamic progress indicator. How does FMProgressIndicator help you with this? FMProgressIndicatorInside the configuration tab you will see that you have two possible progress indicators that can be used (a bar and a spinner). By selecting one of these two you can configure and style the progress element to your needs. Each progress indicator has its own values that can be configured and styled. As an addition for displaying dynamic text you can make use of Bootstrap classes. FMProgressIndicator supports the latest Bootstrap version. If you are familiar with Bootstrap, you can use this knowledge to your advantage. Below you will find some examples of the limitless possibilities. Please also take a look at the examples inside the FileMaker file. This should give you a good idea of its capabilities. Progress barindicator — Example 1Progress bar indicator — Example 2Spinner indicator — Example 3How is it made? We make use of the FileMaker web viewer and HTML technology powered by Bootstrap to give us a rich environment to create kickass, nice looking progress indicators. Now how do I set this up? The complete guide on how to install an indicator can be found within the tool, but just to show you how easy it is: Copy and paste the required custom function inside your FileMaker solution (use the appropriate function you intend to use): • CF_ProgressIndicator_CreateProgressbar — required for display of the progress bar indicator • CF_ProgressIndicator_CreateSpinner —required for display of the spinner indicator Copy and paste the script “FMProgressIndicator.Show” to your FileMaker solution. Build and style your own progress indicator by using the configuration tab. Create an empty web viewer with minimal configuration and give the web viewer object a proper name. Create a script where you execute the script step “Perform Script” and call the script “FMProgressIndicator.Show”. The script parameter is the result of your custom configuration. (tip: take a look at the example scripts. Don’t forget to add your custom web viewer object name and pause time as parameters!). That’s all folks! Once the first two steps are completed, you can create various configurations and paste them as script parameters to see the result. The configuration tab should always give you a perfect example of how the progress element will look. Now the most interesting part… The FMProgressIndicator tool is completely free, written in FileMaker Pro 18 Advanced and completely open-source under the GNU license. Enjoy! Discover the product page on myFMbutler.com. Create nice looking progress elements in FileMaker easily with the FMProgressIndicator was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  2. Photo by Plush Design StudioCreating more gender-inclusive solutions Where we discuss what simple things can be done in an application or database to improve gender inclusivity. As a FileMaker developer, I create databases that are designed to store various kinds of data on a daily basis, for a lot of clients in very different fields of work ; one of the most common modules I usually develop is a “Contacts” module, where my clients can enter the info they have on their own clients, for example. Usually, between the classic “First name”, “Last name” or “e-mail address” fields, I just add a “Gender” field, and a simple value list, “Mr / Mrs”, and leave it like that. However, on a recent project, I wanted to change a little thing — nothing too fancy — and added a “Non-binary” value to the value list. But as soon as the client got access to the database, they removed the “Non-binary” option. Meh, their application, their rules, I guess. This annoyed me a little ; so, in order to get a small revenge on life, the universe and everything, I decided to write a small article on gender inclusion in the applications that we develop. Here goes! (Note: this article is written in English, but includes some references to specific French possibilities, as it is my first language. Also, the given examples are created in FileMaker, as it is the technology that I use in my job, but everything that you see in screenshots can be applied to any technology.) About gender forms Before even starting to create a “gender” field, ask yourself: is this info important to your database, and what it will add to your business? After all, you don’t need to know a client’s gender to invoice them, for example. If you don’t have that field in your database, you can avoid the following considerations all-together. So, if we want to enter someone’s gender in a database, we can start by adding “Man / Woman” or “Mr / Mrs” in a value list, right? Well, first, “Mr” and “Mrs” are more titles than genders, but we can indeed start here. The label next to our field can then be “Title” instead ; if it is not clear enough for you, keep “Gender”, but avoid things like “Sex”, as sex and gender are not the same at all — one being biological, the other a social construct. And the other values? You can add “Neutral” in order to avoid having only the 2 previous values — or “Mx” as a neutral equivalent to “Mr” and “Mrs” — but people might still need other options. If you don’t want a long list of items that can be harder and harder to maintain and may be misinterpreted, you can add another field next to it, a “custom” field, where people can enter their preferred gender in a free text. And is knowing the gender of one of your contacts that important to you? Should it really be a mandatory field? If you don’t need it that much, make it optional, by adding a “prefer not to answer” value in your value list for example. A free text field is shown if the user chooses the value “Custom”Speaking of other values, some have to be avoided, like “miss”: you are asking a person’s gender, not if they are married or not. Also, I don’t know what is the position on the “miss” word in English, but friendly reminder that “Mademoiselle” is forbidden in official French documents since 2012… Other values to avoid are job titles ; if you need to send an e-mail and want to start by “Dear Mr / Mrs / Doctor / Colleague”, try to have a separated field for that — you can have an auto-enter option on this field depending on the selected gender to save time. A doctor still has a gender, and there isn’t supposed to be a hierarchy where doctors are above gender. Finally, even if it starts with a good intention, try to avoid putting the value “Other” as a possible gender, as it can be seen as pejorative and too general. The title is separated from the gender (with a visualisation of the final text next to it)Are you proud of your form, now? Well, let’s change everything then! Asking for a gender is nice, but asking for pronouns is better, as it tends to be easier to answer. Don’t worry, there is not a lot to modify: replace “Mr” by “He/him/his”, “Mrs” by “She/her/hers”, and “Mx” by “They/their/theirs” — “They” being more and more used as a neutral equivalent to “He/she”, and not just for the 3rd person of plural. In French, the equivalent that is also being more and more used is “iel”, neutral equivalent of “il/elle”. The “Gender” is replaced by “Pronouns”You can of course find other ways of creating gender forms ; for example, by using checkbox sets instead of asking the user to choose only one option. And maybe think of other original kinds of forms! But what about GDPR? YES, what about GDPR? Don’t forget, gender is of course considered as personal data, and then falls under the GDPR (General Data Protection Regulation, asking you to store personal data only if you can justify how you will use it)! Once again, ask yourself if you really have a valid reason to store the gender of your contacts ; if not, then you are not supposed to store this info. And if you do store it, then, like for any other personal data, inform your contacts in which way the info about their gender is going to be used. For better security, be sure to give access to personal data only to the people that are going to use it. Not everyone in your company that is going to use your database should have access to it, just the people that will, for example, use the gender to generate headers for an e-mail campaign (“Dear Mr/Mrs/Mx, …”). A small popover indicates the way this personal data will be usedBe sure to stay in a well-defined environment: you can ask for someone’s gender or pronouns, but don’t go too far. For example, don’t put options like “trans woman” or “trans man”, as this is a really personal subject, with very little cases where its use can be justified. Moreover, asking for someone’s sexual orientation is completely off-subject and CANNOT be stored ; following GDPR, this falls under the “highly-sensitive” data, information that can only be stored with a special licence, only given for very specific cases — in other examples, a modeling agency can be delivered a special license to store info about someone’s measurements, skin colour, etc. And in the rest of the application? Indeed, you can improve the gender-inclusion of your application in other parts, and not just in a gender form. For example, in the field that usually comes just after the gender: the first name. You can have 2 fields, one for the “legal” name, and the other for the “preferred” name — but again, think about how to justify it on a GDPR point of view! Concerning jobs/occupations, there is no point in trying to gender them ; even if a job is supposed to be occupied by a majority of men/women in the common imaginary, these views have no room in an application and can often be false, and always condescending! For example, instead of using “barman” or “barmaid”, use “bartender” ; instead of “housewife” or “househusband”, use “housemaker”. These cases are more common in languages like French, where for example the job of “Assistant” takes an “e” when practiced by a woman, “Assistante”. To avoid that, a usage that is progressively getting more attention is “inclusive writing” (“écriture inclusive”), where a separator is used to transform a word and make it more “neutral” — the example would then become: “Assistant·e”. The separator used is often the character “·”, but can virtually be anything that you prefer (“.” / “-” / “( )” / etc). Finally, choices can be made while choosing colours and images & icons: no need to choose blue & pink if your application is supposed to be used by a majority of men or women, and no need to choose clearly gendered characters in your different icons or illustrations. A possible version of a simple “Contacts” module.But what’s the point? More and more people declare that they are not ok with their assigned gender — this does not mean that it is a new phenomenon, but that the world is evolving and starting to accept that the “male/female” division is not the only possible division. All of these suggestions are pretty simple to develop ; a few added fields, one or two more items in a value list, maybe a calculation that regroups everything if you need to make reports or sorts in your application, and a few changes in some labels ; but these small changes can add up to create an application designed for everyone, and create a safe and comfortable space for everyone. Changing mindsets can start with changing small habits ; and if you are not at ease with these topics, then starting to use that kind of forms and interfaces might lead you and others to slowly change of point of view on gender identity. Creating more gender-inclusive applications was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  3. myFMbutler — myFMApiLibrary for Javascript, one library to rule them all, again The Lesterius Team has developed a Javascript library to make the FileMaker Data Api 18 easier to use. Lesterius co-creates FileMaker Platform based solutions with their customers. Sharing knowledge is in our DNA, that’s why we developed this library to make the FileMaker Data API easy-to-use with Javascript. Photo by Artem Beliaikin on PexelsWhy do we provide a wrapper while the data REST API already works? To make it simple. In our library, we’ve already coded all cURL requests. You don’t need to read the FileMaker Data API documentation to make it work, you just have to follow our documentation. Readable by every Javascript developer, you can use it even if you don’t know anything about FileMaker. Even better: this library doesn’t have any dependencies, just add it in a webViewer and start using it! Download it and it’s ready. Go to our GitHub and download it or do a composer install: composer require myfmbutler/myfmapilibrary-for-js See how to enable FileMaker Data Api on your FileMaker Server with this video, then create a user with the fmrest privilege and allow them to access your target data and layouts. Here is an example that shows how to find records with credentials method login (if you’re using WebDirect, please, use the token method for more security): <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My html page</title> <script src="DataApi.js"></script> </head> <body> <script type="text/javascript"> let apiURL = "https://test.fmconnection.com/fmi/data"; let login = "User"; let password = "password"; let databaseName = "MyDatabase"; let layoutName = "My Layout"; console.log("Login to the FileMaker Server"); let options = { 'apiUrl': apiURL, 'databaseName' : databaseName, 'login' : login, 'password' : password }; let api = new DataApi(options); console.log("Find records"); let search = [ { 'fields' : {'fieldname': 'First Name', 'fieldvalue': '==John'}, 'options' : {'omit': false} } ]; let sort = [ { 'fieldName': 'First Name', 'sortOrder': 'ascend' }, { 'fieldName':'Last Name', 'sortOrder':'descend' } ]; // My results are here console.log(api.findRecords(layoutName, search, sort)); console.log("Logout"); api.logout(); </script> </body> </html> Enjoy! You can also see all the examples in the readme here. What’s the difference with others libraries? No depencies One file only A “token method” for login (WebDirect usage) Ready for FileMaker 18 Readable by every developer, even beginners JOIN US ON GITHUB! Free download Download the latest version and documentation from GitHub. myFMbutler — myFMApiLibrary for Javascript, one library to rule them all, again was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  4. La vague de chaleur n'en finit pas : Les inscriptions pour la conférence FileMaker sont ouvertes !!! 🔥🔥🔥 Découvrez l'annonce faite via mailing : FM Conférence 2019 - Découvrez le programme Programme : https://www.fmconf.com/programme Inscriptions : https://www.fmconf.com/#inscription Rendez-vous les 16, 17 et 18 octobre 2019 à Futuroscope-Poitiers pour une édition futuriste !
  5. Bonjour, Nous sommes toujours à la recherche d'intervenant·e·s pour la conférence FileMaker à Futuroscope/Poitiers. 🙂 Voici le lien pour envoyer vos propositions de sujets : Pour rappel, vous avez le choix entre le topic (= 15 minutes) et la session (= 1 heure), questions/réponses incluses. Je vous souhaite une très belle semaine !
  6. La semaine dernière, des chercheurs en sécurité ont découvert au sein des processeurs Intel les failles de sécurité MDS, ZombieLoad et RIDL. En raison de ces vulnérabilités, il est possible d’obtenir une petite quantité de données qui sont traitées par le processeur. Quelles actions menons-nous ? La sécurité et la protection de vos données sont une grande préoccupation pour Lesterius. C’est pourquoi nous en avons directement étudié l’impact sur votre hébergement. La mise à jour de votre hardware a bien été déployée dans les temps. De nouvelles mises à jour peuvent être publiées dans les prochains jours. Dès que celles-ci seront disponibles, nous commencerons à mettre à jour tous nos systèmes. Grâce à nos migrations automatiques, nous pouvons mettre à jour l’ensemble de notre plateforme VPS sans aucun temps d’arrêt de votre VPS. Outre ces correctifs matériels, vos systèmes d’exploitation doivent être mis à jour. Cela peut entraîner des temps d’arrêt pour votre VPS. Nous vous en informerons à l’avance et tenterons d’en limiter l’impact. Que pouvez-vous faire ? Nos serveurs ne sont pas les seuls exposés à cette faille : par exemple votre serveur local et vos autres périphériques sont aussi touchés. Vous pouvez prendre les mesures nécessaires pour vous protéger de ces failles sur la plupart d’entre eux. Pour cela, vous devez mettre à jour votre système d’exploitation et le firmware de votre ordinateur. Nous vous conseillons de contacter votre partenaire informatique si vous avez des questions additionnelles et un besoin de support. Si vous avez des questions concernant ce message, n’hésitez pas à nous contacter à hostmaster@lesterius.com. Merci de votre compréhension. Bien cordialement, L’équipe FM Connection Vulnérabilité de sécurité MDS sur votre VPS was originally published in Lesterius FR on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  7. Bonjour tout le monde, Le nouveau site de la FM Conférence est en ligne : tout beau, tout neuf pour l'édition 2019 (ça rime !) Nous vous retrouvons du mercredi 16 au vendredi 18 octobre 2019 au Novotel Poitiers Site du Futuroscope, à deux pas du parc donc. La phase d'appel à sujets a commencé, suivez ce lien si vous souhaitez devenir un·e super intervenant·e de la FMConf : https://www.fmconf.com/#appel-a-sujets Les programmes de la journée de formation Design UI/UX et des topos/sessions seront disponibles en juin, en même temps que l'ouverture des inscriptions. N'hésitez pas à laisser un commentaire sous cette publication si vous avez des questions. Le forum est fait pour ça. 🙂 Je vous souhaite une très (très très) belle journée ensoleillée.
  8. Importing data in a FileMaker database from a “flat file” Importing data can be easy when doing it table after table, with well structured data; but what about importing a “flat file”, where data destined to be put in different tables are mixed? Let’s take a simple FileMaker database, where companies are linked to multiple contacts. Here is a simple “company” record, linked to a contact in a portalIn order to have this kind of layouts, the relationship between the companies and the contacts is set up so that the foreign key IdCompany in the Contacts table is linked to the primary key IdCompany in the Companies table. Relationship between companies and contacts in the FileMaker graphWe now need to import in this database an Excel file structured like the following one: 1 column with data from the company, the 2 following ones with data from the contactIn this file, data from the companies AND from the contacts have been written on the same lines; however, we need to separate these data in our relational database. It could still be possible to import the file table by table; but in that case, it would also create duplicate companies (when the same company is linked to different contacts), and the link between the companies and the contacts would be lost. A solution to that would be to create a new table then, only used for the import, that would have the exact same fields as in the original Excel flat file. A simple import (File > Import Records > File… ) can then be used. Normal import processWe can now create a new point of view in our relationships graph, using an occurrence based on this import table. As we plan to create companies and contacts records from this point of view, we will create a new global text field in the current “Import” table (that we will call “GlobalUniqueText” here); this field will be reset each time that we will handle a new record. On the other end, in both the Company and Contact tables, we will create a “Creation” field; this field will only be used for the creation by link. The links between the Import table and the 2 tables where records will be created have to be set between the GlobalUniqueText field and the Creation field, and the creation by link has to be checked. For each record, a new random, unique UUID value will be set into the GlobalUniqueText field; by doing this, the link between the Import table and the 2 other tables will be reset. When values will be set in the 2 other tables, the records will then automatically be created, thanks to the checked option to create records by link. left : The new “import” point of view | right : “Allow creation of records in this table via this relationship”The script used to create data from the Import table in the 2 other tables can now be created. The detail of this process is described in the comments of the script: Script used to distribute data from the “flat file” import table into the tables used in the databaseIn the end, the companies and contacts records are created, and the link between these new records is conserved. This method can be applied to a greater scale, with a lot of different columns going to a lot of different tables in you FileMaker database, but the principle stays the same: create your temporary import table that matches to your Excel flat file, and re-process, adapt and distribute your data, field by field, in your own tables. Leave a comment below if you have any question! Importing data in a FileMaker file from a “flat file” was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  9. Lesterius recently published the myFMApiLibrary for PHP. The myFMApiLibrary for PHP is a REST client library for PHP that allows you to easily interact with the FileMaker Data API and integrate it faster. But how do you use it? In this article I will show you how I use it with Symfony 3.4, a popular Web Application framework based on a set of PHP Components. Feel free to improve it. Prerequisites This article assumes that you already have experience with Symfony. Before using the DataApi from FileMaker, make sure that your FileMaker Server has a proper SSL certificate installed. First you need to get the library using composer: composer require myfmbutler/myfmapilibrary-for-php You will also need JMS serializer library (follow documentation found here) and doctrine annotations to be able to link FileMaker fields with your PHP properties: composer require jms/serializer composer require doctrine/doctrine-bundle Then create 4 parameters in parameters.yml file: database_api_url, database_name, database_user and database_password. Create services Now that everything is fine, we’ll create 2 services in services.yml: One to set the myFMAPI library The other one to set-up the Event Subscriber. The first one needed is used to set-up the myFMAPI library: Lesterius\FileMakerApi\DataApi: arguments: ['%database_api_url%','%database_name%', null, null, true] The second one is used to set-up the connection to the DataApi to be able to use our first service: AppBundle\EventSubscriber\RequestEventSubscriber: arguments: ['@Lesterius\FileMakerApi\DataApi', '%database_user%', '%database_password%'] Here follows the class RequestEventSubscriber.php that must be put in src/AppBundle/EventSubscriber repository: <?php namespace AppBundle\EventSubscriber; use Lesterius\FileMakerApi\DataApi; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; class RequestEventSubscriber implements EventSubscriberInterface { /** * @var string */ private $apiUser; /** * @var string */ private $apiPassword; /** * @var DataApi */ private $dataApi; public function __construct(DataApi $dataApi, string $apiUser, string $apiPassword) { $this->apiUser = $apiUser; $this->apiPassword = $apiPassword; $this->dataApi = $dataApi; } /** * Returns an array of event names this subscriber wants to listen to. * * The array keys are event names and the value can be: * * * The method name to call (priority defaults to 0) * * An array composed of the method name to call and the priority * * An array of arrays composed of the method names to call and respective * priorities, or 0 if unset * * For instance: * * * array('eventName' => 'methodName') * * array('eventName' => array('methodName', $priority)) * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) * * @return array The event names to listen to */ public static function getSubscribedEvents() { return [ KernelEvents::REQUEST => ['apiLogin'] ]; } /** * @param GetResponseEvent $event * * @throws \AppBundle\Service\FileMakerApi\Exception\Exception */ public function apiLogin(GetResponseEvent $event) { if (is_null($this->dataApi->getApiToken())) { $this->dataApi->login($this->apiUser, $this->apiPassword); } } } Create entities With the old FileMaker Php library I used to create a table with the field names and the property names. In Symfony, I can use annotations to link fields with properties. An example of using annotationsUsually you need a lot of entities. I think it is best to make an abstract class for all of them. In this class, I create methods to manage the internal FileMaker id and to get the field names found in FileMaker. Here follows my AbstractEntity.php in src/AppBundle/Entity: <?php namespace AppBundle\Entity; use Doctrine\Common\Annotations\AnnotationReader; use JMS\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; /** * Class AbstractEntity * * @package AppBundle\Entity */ abstract class AbstractEntity { /** * @Serializer\SerializedName("recordId") * @Serializer\Type("integer") * @Serializer\Groups({"internal"}) */ public $idRecordFileMaker; /** * @Serializer\SerializedName("modId") * @Serializer\Type("integer") * @Serializer\Groups({"internal"}) */ public $idModificationFileMaker; const SEPARATOR = "\r"; /** * @return int */ public function getInternalFmId() { return $this->idRecordFileMaker; } /** * @param int $idRecordFileMaker */ public function setInternalFmId($idRecordFileMaker) { $this->idRecordFileMaker = $idRecordFileMaker; } /** * Get the name of Annotation Name with the property name * * @param $name * @return mixed * @throws \Doctrine\Common\Annotations\AnnotationException * @throws \ReflectionException */ public static function getSerializedNameByPropertyName($name) { $reflectionClass = new \ReflectionClass(get_called_class()); $property = $reflectionClass->getProperty($name); $annotationReader = new AnnotationReader(); $classAnnotations = $annotationReader->getPropertyAnnotation( $property, 'JMS\Serializer\Annotation\SerializedName' ); return $classAnnotations->name; } } Now in my entity, I’ll need to use: use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; Every class that extends the AbstractEntity Class will need an “IdNameClass” property. The name of the property must start with “id”, followed by the name of the class in camel case, otherwise it will not work. As an example if I have Class Attendee, I’ll need a property with the name $idAttendee. Next, I’ll put my FileMaker field names in “Serializer\SerializedName” annotations. In “Serializer\Type” we store the data type. Here‘s the types you can find: int string Datetime (with UTC format) boolean In “Serializer\Groups” you define the actions that can be done on the field: create update internal excluded default These groups are managed in the AbstractRepository class. The “default” group is set if you didn’t define it. The group will be used when needed, in a “create” case to insert some data you choose not to update, or in an “internal” case where you only need to retrieve data (i.e. modification timestamps). A example of using Types and GroupsCreating Repositories You need to create a repository for your entity. Like entities, I made a AbstractRepository to simulate a database call, similar to what I did for Doctrine. For my own reading comfort I prefer writing all my database functions in my repositories files. An example of repository with a script call and an upload to container instructionA simple example of findByA complexe example of findBy with OMITHere follows my AbstractRepository.php in src/AppBundle/Repository: <?php namespace AppBundle\Repository; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerBuilder; use Lesterius\FileMakerApi\DataApi; use Psr\Http\Message\ResponseInterface; abstract class AbstractRepository { const SORT_ASC = 'ascend'; const SORT_DESC = 'descend'; const BIG_RANGE_VALUE = '10000'; const OMIT = 'omit'; protected $em; protected $entityName; protected $layout; protected $serializer; /** * AbstractRepository constructor * * @param DataApi $em * @param $entityName */ public function __construct(DataApi $em, $entityName, $layout) { $this->em = $em; $this->entityName = $entityName; $this->layout = $layout; } /** * Get entity name * * @return mixed */ protected function getEntityName() { return $this->entityName; } /** * Hydrate a list of Objects * * @param array $data * * @return array * @throws \Exception */ protected function hydrateListObjects(array $data) { $list_objects = []; foreach ($data as $record) { $list_objects[] = $this->hydrateObject($record); } return $list_objects; } /** * @param array $data * * @return object * @throws \Exception */ protected function hydrateObject(array $data) { $data = $this->prepareDataForObject($data); if (is_null($this->serializer)) { $this->serializer = SerializerBuilder::create()->build(); } //-- $object = $this->serializer->deserialize(json_encode($data), $this->getEntityName(), 'json'); return $object; } /** * * @param array $data * * @return array * @throws \Exception */ private function prepareDataForObject(array $data) { $result = []; $result['recordId'] = (isset($data['recordId']) ? $data['recordId'] : null); $result['modId'] = (isset($data['modId']) ? $data['modId'] : null); if (isset($data['fieldData'])) { $result = array_merge($result, $data['fieldData']); if (isset($data['portalData']) && !empty($data['portalData'])) { $result = array_merge($result, $data['portalData']); } }else { $result = array_merge($result, $data); } return $result; } /** * Search by Array * * @param array $criterions * @param array $sortArray * * @param null $offset * @param null $range * @param null $portal * * @return array|Object * @throws \Exception */ public function findBy(array $criterions = [], array $sortArray = [], $offset = null, $range = null, $portal = []) { $sort = null; $preparedQuery = $this->prepareFindCriterions($criterions); if (!empty($sortArray)) { foreach ($sortArray as $fieldName => $sortOrder) { $sort[] = ['fieldName' => $fieldName, 'sortOrder' => $sortOrder]; } } if (is_null($range)) { $range = self::BIG_RANGE_VALUE; } $results = $this->em->findRecords($this->layout, $preparedQuery, $sort, $offset, $range, $portal); $return = $this->hydrateListObjects($results); return $return; } /** * Find All records * * @return array * @throws \Exception */ public function findAll() { $results = $this->em->getRecords($this->layout); $return = $this->hydrateListObjects($results); return $return; } /** * Search by ID * * @return Object|array * @throws \Exception */ public function find($idObject) { $propertyName = 'id'.str_replace('AppBundle\Entity\\', '', $this->entityName); $annotationName = call_user_func($this->entityName.'::getSerializedNameByPropertyName', $propertyName); $criterions = $this->prepareFindCriterions([$annotationName => $idObject]); $results = $this->em->findRecords($this->layout, $criterions); $return = $this->hydrateListObjects($results); if (isset($return[0])) { return $return[0]; } return null; } /** * * Create objet * * @param $object * * @return object * * @throws \Exception */ public function create($object) { if ($object instanceof $this->entityName) { $serializer = SerializerBuilder::create()->build(); $data = $serializer->serialize($object, 'json', SerializationContext::create()->setGroups(['Default', 'create'])); $data = json_decode($data, true); $recordId = $this->em->createRecord($this->layout, $data); if ($recordId instanceof ResponseInterface) { throw new \Exception('Error, creation fail : '.$recordId); } $results = $this->em->getRecord($this->layout, $recordId); $return = $this->hydrateObject($results); return $return; } throw new \Exception('Error, object is not a instance of the object repository'); } /** * Edit object * * @param $object * * @param array $scripts * @return object * * @throws \AppBundle\Service\FileMakerApi\Exception\Exception * @throws \Exception */ public function set($object, $scripts = []) { if ($object instanceof $this->entityName && !empty($object->{'getInternalFmId'}())) { $serializer = SerializerBuilder::create()->build(); $data = $serializer->serialize($object, 'json', SerializationContext::create()->setGroups(['Default', 'update'])); $data = json_decode($data, true); $modId = $this->em->editRecord($this->layout, $object->{'getInternalFmId'}(), $data, null, [], $scripts); if ($modId instanceof ResponseInterface) { throw new \Exception('Error, update fail : '.$object->{'getInternalFmId'}()); } $results = $this->em->getRecord($this->layout, $object->{'getInternalFmId'}()); $return = $this->hydrateObject($results); return $return; } throw new \Exception('Error, object is not a instance of the object repository'); } /** * @param $object * @param array $fileOption * @param int $repetition * @return object * @throws \AppBundle\Service\FileMakerApi\Exception\Exception * @throws \Exception */ public function setFile($object, $fileOption = [], $repetition = 1) { if ($object instanceof $this->entityName && !empty($object->{'getInternalFmId'}()) && !empty($fileOption)) { foreach ($fileOption as $fieldName => $filePath) { $modId = $this->em->uploadToContainer($this->layout, $object->{'getInternalFmId'}(), $fieldName, $repetition, $filePath); if ($modId instanceof ResponseInterface) { throw new \Exception('Error, update fail : '.$object->{'getInternalFmId'}()); } } $results = $this->em->getRecord($this->layout, $object->{'getInternalFmId'}()); $return = $this->hydrateObject($results); return $return; } } /** * @param array $criterions * * @return array */ private function prepareFindCriterions(array $criterions) { $preparedCriterions = []; foreach ($criterions as $index => $criterion) { if (is_array($criterion)) { $fields = []; foreach ($criterion as $field => $value) { $fields[] = ['fieldname' => $field, 'fieldvalue' => $value]; } $preparedCriterions[]['fields'] = $fields; } else { $fields[] = ['fieldname' => $index, 'fieldvalue' => $criterion]; } } if (empty($preparedCriterions) && !empty($criterions)) { $preparedCriterions[]['fields'] = $fields; } return $preparedCriterions; } /** * @return DataApi */ public function getEm(): DataApi { return $this->em; } /** * @param DataApi $em */ public function setEm(DataApi $em) { $this->em = $em; } /** * @return mixed */ public function getLayout() { return $this->layout; } /** * @param mixed $layout */ public function setLayout($layout) { $this->layout = $layout; } /** * @return mixed */ public function getSerializer() { return $this->serializer; } /** * @param mixed $serializer */ public function setSerializer($serializer) { $this->serializer = $serializer; } } How to use it? I created 2 functions in my BaseController.php: one to call the myFMApiLibrary-for-PHP service and connect to the database. one to close the connection (don’t forget this part!). Then in my controller, I can create my repository object and my object: An example of using with a creation, an upload to container and a script executionWhat about error messages? The error messages you could have should be explicit (and with their FileMaker error code). DataApi works the same way as another FileMaker Client. As an example, two users can’t edit the same record at the same time, and will throw an error. Conclusion Follow these steps, and you will be able to easily connect your Symfony to the FileMaker 17 DataAPI (with myFMApiLibrary for PHP), and significantly save your work time, which is good for you, but event better for your clients! What were your thoughts on this tutorial? Please let me know in the comments. Don’t forget to subscribe to follow our reviews and updates of this article once the FileMaker 18 DataAPI will be released. Some Tips If you choose “int” as “Serializer\Type” annotation, be sure the field is always filled. “Empty” is not an int or a boolean, change to “string” to avoid this. @Serializer\Type(“DateTime<’m/d/Y’, ‘Europe/Paris’>”) can be @Serializer\Type(“DateTime<’m/d/Y H:i:s’, ‘Europe/Paris’>”), for example. If you don’t put @Serializer annotation, the property won’t be linked to FileMaker. And please, don’t forget to set stricter privileges to your DataApi user for more security. How I integrated myFMApiLibrary for PHP with Symfony 3.4 was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  10. With the launch of the FileMaker 17 Platform, the new FileMaker User Licensing program was introduced. Each FileMaker User Licensing contract includes 3 licenses of FileMaker Server. An organisation can, for example, have a production server, backup server, and development server. FileMaker is a unique product that gives us the possibility of developing in a live environment while users are actively using the FileMaker database. However this does have as implication that the programmer needs to be careful not to break anything when altering structure / code. For larger scale applications this way of programming is not an option and a separate development / production environment is essential. When you have such a separate environment, at a certain point you will decide that the current development you have done on the development server needs to published to the live environment. This means that you will have to migrate all the production data / accounts into the current development database. This was time consuming process. As a developer you had to take care that each table got correctly imported. Let alone update the possible serial numbers inside a table. With the release of the FileMaker Data Migration tool this all changes. What is the FileMaker Data Migration Tool? The FileMaker data migration tool is a command-line tool from FileMaker, Inc. to migration all record data and user accounts from a source file in the FileMaker Pro 12 format (FMP12) to a target file. This tool is cross platform (macOS and Windows) and dramatically speeds up the data migration process. When you run this command line tool a full access user account or an account with the “fmmigration extended privilege” is required. When using the extended privilege, the specified user does not require access to any table, scripts or layouts and thus provides a secure method for migration. The specified account you will use for the migration process does need to be present in the source and clone file. Do mind when using the extended privilege, the option for verbose logging is not available. Verbose logging is only full access accounts. After the migration this tool gives either a brief overview of the migration result or a verbose log depending on your given account. The FileMaker Data Migration tool is available to people who have bought a FileMaker Developer Subscription (FDS). Please refer to your community profile for downloading after you have purchased a FDS. How to migrate your data? Open the file to be cloned. Choose File menu > Save a Copy As, then choose clone (no records). Make sure the source file and the clone are closed. Download the file Win_FMDataMigration_x64.zip (Windows) or Mac_FMDataMigration.zip (macOS). Unzip the downloaded file and move the contents to a location of your choice. Use the following command at the command-line prompt: FMDataMigration -src_path <path> -clone_path <path> The parameters -src_path and -clone_path are required. All the other parameters are optional. The optional parameters are: -src_path: Source filename and path. -src_account: Account name used for opening the source file. The default is Admin. -src_pwd: Password for accessing the source file. -src_key: Encryption password for decrypting the source file. -clone_path: Clone filename and path. -clone_account: Account name for accessing the clone. The default is Admin. -clone_pwd: Password for accessing the clone. -clone_key: Encryption password for decrypting the clone. -target_path: Target filename and path. The default target file, source filename migrated.fmp12, is located in the same folder as the source file. -force: Overwrites an existing target file. If you have an existing target file, you must use a different name for the new target file, or use -force to overwrite the existing file. -ignore_valuelists: Uses custom value lists from the clone instead of the source file. -ignore_accounts: Uses the account names, passwords, and the encryption password from the clone instead of the source file. -ignore_fonts: Doesn't check the font mapping for field contents. -v (verbose mode): For accounts with the Full Access privilege set, provides a detailed report about the data migration process. For accounts with the fmmigration extended privilege, in both normal and verbose modes, the tool provides only a brief report without displaying any information about the schema. -q (quiet mode): Doesn't provide a report. More information about the FileMaker Data Migration tool can be found here. FMDataMigration Since the FileMaker Data Migration is a command line it does require some knowledge for executing this correctly. You have to compose a correct command with valid paths and options. This is where the FMDataMigration comes in. This tool will automate the migration process for you. It gives you a FileMaker interface with configurable options before executing the migration. FMDataMigration — DatabaseThe result of the migration process is a log file that does include a detailed report of the migration process itself. It is important to use a full access account in order to receive a detailed log result as described above. The FileMaker database FMDataMigration was build with purpose to either help the developer for migration your data by using a FileMaker interface that guides you through the process AND to give a detailed report of the migration process itself. After the migration, the created log file gets imported and parsed into the FileMaker database. This gives you a clear view of possible warnings / errors where you should have a second look at before using this file again in a production environment. Below is an example of a possible result: FMDataMigration — Result summaryFMDataMigration — Result tablesHow does the FMDataMigration works? At launch this tool will verify if you have the required plugin (BaseElements, FREE plugin) installed. If not, this will be installed automatically. This FREE plugin is used for executing the command line in the backend. Before using this tool you must upload a .zip file off the “FileMaker Data Migration command line tool” which you have downloaded from your FileMaker community profile. FMDataMigration — Settings — Migration toolAfter you have uploaded a valid .zip for for macOS / Windows you are ready to go. Inside the configuration tab, specify a valid source-/clone- and target path. Provide a full access account to make fully use of the FMDataMigration tool. Verify after the configured options. Verbose logging is ticked on by default. You are now ready to migrate your data / account. The FMDataMigration will first verify if all parameters are configured properly. After, the migration itself will start. You will get a good overview how many % of the migration is completed. FMDataMigration — MigratingAfter the migration the FMDataMigration database will parse the created log file into native FileMaker tables for a detailed report. The progress bar gives you an idea of how long it will take. FMDataMigration — Parsing resultAfter this stage the migration is completed and the result can be checked. The detailed result gives an in dept view of possible warnings / errors that are reported by the migration process. Inside the detailed report you will get an overview of the following parts: Accounts Privileges Value Lists Tables Fields Fonts Each warning / error will be logged. It is important to know as a developer what happend during the migration process as this is crucial information before deciding if the new file is ready for production. The FMDataMigration tool is a free tool, written in FileMaker Pro 17 Advanced, is completely open-source under the GNU license. Discover the product page on myFMbutler.com. FMDataMigration for the FileMaker Data Migration Tool was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  11. myFMbutler — myFMApiLibrary for PHP, one library to rule them all Lesterius Team has developed a PHP library to make the FileMaker Data Api 17 easier to use. Lesterius co-creates FileMaker Platform based solutions with their customers. Sharing knowledge takes part of our DNA, that’s why we developed this library to make the FileMaker Data API easy-to-use with PHP. We already used it for our FileMaker 16 internal projects and we improved it enough with FileMaker 17 to share it with the world. Photo by Porapak Apichodilok on PexelsWhy do we provide a wrapper while the data REST API already works? To make it simple. In our library, we’ve already coded all cURL requests. You don’t need to read the FileMaker Data API documentation to make it work, you just have to follow our documentation. Readable by every PHP developers, you can use it even if you don’t know anything about FileMaker. Download it and it’s ready. Go to our GitHub and download it or do a composer install: composer require myFMbutler/myFMApiLibrary-for-PHP See how to enable FileMaker Data Api on your FileMaker Server with this video, then create a user with the fmrest privilege and allow him to access your target data and layouts. Here is an example that shows how to find records with credentials method login: <?php require_once __DIR__ . '/vendor/autoload.php'; // Link librairy to FileMalker database dataApi = new \Lesterius\FileMakerApi\DataApi('https://test.fmconnection.com/fmi/data', 'MyDatabase'); // Log user using the credentials method $dataApi->login('filemaker api user', 'filemaker api password', 'layout name'); // My search parameters $query = [ [ 'fields' => [ ['fieldname' => 'FirstName', 'fieldvalue' => '==Test'], ['fieldname' => 'LastName', 'fieldvalue' => '==Test'], ], 'options' => [ 'omit' => false ] ] ]; try { $results = $dataApi->findRecords('layout name', $query, $sort, $offset, $limit, $portals, $scripts, $responseLayout); } catch(\Exception $e) { // log exception here } // Show data echo "<pre>", var_dump($results), "</pre>"; // Logout user $dataApi->logout(); Enjoy. You can also see all the examples in the readme here. That’s all? Where there are no features, there is no pleasure. We also have ideas for some new features: Number of bytes per request, Choose response format (xml, JSON, etc), Same library, another language, And more… JOIN US ON GITHUB! Free download Download the latest version and documentation from Github. You can also find the product page here. myFMbutler — myFMApiLibrary for PHP, one library to rule them all was originally published in Lesterius on Medium, where people are continuing the conversation by highlighting and responding to this story. Afficher la totalité du billet
  • Create New...