Download the PHP package matatirosoln/doctrine-odata-driver without Composer

On this page you can find all versions of the php package matatirosoln/doctrine-odata-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-odata-driver

Doctrine OData Driver

A Doctrine DBAL driver that translates SQL into OData v4 HTTP requests, allowing OData backends to be used as first-class database connections in Doctrine-based applications.

The primary target backend is FileMaker Server's OData API, though the driver is designed to work with any OData v4 compliant endpoint.

Requirements

Installation

Symfony configuration

Add the driver to your doctrine.yaml:

Add the corresponding variables to your .env:

Connection options

The following keys are supported under options: in doctrine.yaml (or as top-level keys when using DriverManager::getConnection() directly):

Option Default Description
ssl true Use HTTPS and verify SSL certificates.
port 443 Server port.
timeout 30 Default HTTP request timeout in seconds. Binary methods (container upload/download) accept a per-call override.
url_prefix /fmi/odata/v4 URL path prefix before the database name. Change for non-FileMaker servers.
quote_guids false Keep UUID values as quoted strings in $filter expressions. Required for FileMaker; see below.
metadata_ttl 0 TTL in seconds for the PSR-16 metadata cache. 0 means no expiry. Only used when metadata_cache is also set.
metadata_cache null A Psr\SimpleCache\CacheInterface instance for caching $metadata across requests. Cannot be set via YAML; see below.

The base OData URL is constructed as {scheme}://{host}:{port}/{url_prefix}/{dbname}.

Metadata caching

The driver fetches the OData $metadata endpoint once per ODataConnection instance (i.e. once per web request in a typical Symfony app) and caches the result in memory for the duration of that connection. This means every web request makes exactly one $metadata HTTP call before the first entity query.

For long-running processes (queue workers, console commands) or high-traffic applications where even one $metadata call per request is too much, inject a PSR-16 CacheInterface to persist the parsed metadata across requests.

Because doctrine.yaml only supports scalar values, the cache instance cannot be set there directly. The recommended approach in Symfony is to install matatirosoln/doctrine-odata-bundle, which wires the cache automatically via a DBAL middleware — no factory or manual wiring required.

If you need to wire the cache manually (e.g. outside Symfony, or without the bundle), pass the instance in the connection params:

Primary key detection

The driver automatically uses OData key-path URLs (/EntitySet('key')) for single-entity lookups — which is the correct OData v4 form — rather than ?$filter=pk eq value (a collection filtered to one result).

To do this it needs to know which field is the primary key for each entity set. This is discovered automatically at runtime from the OData $metadata EDMX response. When the driver first connects, it fetches /$metadata and parses it using EdmxParser to extract each entity set's primary key field name. That parsed result is held in ODataConnection::$parsedMetadata and accessed by each statement as needed — no additional configuration is required.

For this to work, your entities must have an explicit table name and column name on the identifier:

How FileMaker determines the primary key

FileMaker OData identifies a field as the primary key if it satisfies both of the following conditions:

If no field meets these criteria, FileMaker falls back to the internal ROWID system field (equivalent to Get(RecordID)). The ROWID is a numeric record ID that is not stable across record deletion and recreation, and is not exposed as a regular application field. A table that relies on ROWID as its OData primary key will not work correctly with the driver — every single-entity lookup and write will fail. Ensure every table you expose via OData has an explicit primary key field with the correct field options set in FileMaker.

Standard usage with Doctrine ORM

Once configured, use Doctrine ORM normally:

DBAL-only usage

The driver can also be used directly via DBAL without the ORM:

FileMaker-specific notes

quote_guids: true

By default the driver emits GUID values as bare Edm.Guid literals in $filter expressions, as required by the OData v4 specification:

FileMaker's OData parser cannot handle this — it interprets the leading hex segment as a number and fails. Setting quote_guids: true keeps GUIDs as quoted string literals:

This option is only needed for FileMaker. Leave it unset (or false) for any OData v4 spec-compliant server.

Note: Single-entity primary-key lookups use the key-path URL form (/Contact('uuid')) and are not affected by this option — quote_guids only applies to GUIDs that appear in compound $filter expressions.

Table occurrences, not layouts

FileMaker OData exposes table occurrences from the relationship graph as entity sets — not layouts (which are used by the FileMaker Data API) and not raw base tables. The entity set name in your SQL and your #[ORM\Table(name: '...')] attribute must match the table occurrence name exactly.

OData annotations are stripped

FileMaker includes @odata.id, @odata.editLink, and similar metadata annotations in every response. These are automatically stripped before rows are returned to your application.

Server setup

To use FileMaker OData you must:

  1. Enable OData in FileMaker Server Admin Console → Connectors → OData
  2. Ensure the connecting account's privilege set has the fmodata extended privilege enabled

How SQL is translated to OData

SQL construct OData equivalent
SELECT * No $select (all fields returned)
SELECT a, b ?$select=a,b
WHERE field = value ?$filter=field eq value
WHERE pk = 'uuid' (single equality) /EntitySet('uuid') key-path (no $filter)
ORDER BY col ASC ?$orderby=col asc
LIMIT n ?$top=n
LIMIT n OFFSET m ?$top=n&$skip=m
COUNT(*) /$count
INSERT INTO … POST /EntitySet
UPDATE … WHERE pk = 'uuid' PATCH /EntitySet('uuid')
DELETE … WHERE pk = 'uuid' DELETE /EntitySet('uuid')

SQL UPDATE and DELETE without a WHERE clause will throw an exception to prevent accidental bulk modifications.

Known limitations

Running tests

Licence

MIT

Contact

Steve Winter — Matatiro Solutions Ltd — [email protected]


All versions of doctrine-odata-driver with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-dom Version *
doctrine/dbal Version ^4.0
matatirosoln/sql-to-odata Version ^0.1.0
psr/simple-cache Version ^3.0
symfony/http-client Version ^7.0|^8.0
symfony/http-client-contracts Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package matatirosoln/doctrine-odata-driver contains the following files

Loading the files please wait ...