Revision: Thu, 18 Apr 2024 09:24:10 GMT
v1.0 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.12
Edit this page

ORM

Spiral Framework includes an ORM engine to help you manage your persistence data. ORM is capable of schema generation, multiple data carry mechanisms and support relation extensions.

Table of Contents

ActiveRecord vs DataMapper

Spiral ORM uses features specific to both ActiveRecord and DataMapper approach, though, at this moment there is no native support to map data to pure php objects (see RecordInterface).

Consider using Doctrine or writing your own hydration using RecordSelector->fetchData method and existed relation loaders.

Schemas

Please note, ORM engine uses second level cache/schema to store information about mapping between persistence layer and your data entity models. Do not forget to run command spiral orm:schema -m to update the schema cache and generate migrations.

Standalone Usage

You are able to use ORM component separately from framework, take a look at initialization here.