{
    "href": "/post/2018/07/31/atlas-orm-integration-with-symfony/",
    "relId": "2018/07/31/atlas-orm-integration-with-symfony",
    "title": "Atlas ORM Integration with Symfony",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/atlas/",
            "relId": "atlas",
            "title": "Atlas",
            "author": null,
            "created": "2020-09-21 14:37:38 UTC",
            "updated": [
                "2020-09-21 14:37:38 UTC",
                "2023-06-22 02:17:41 UTC"
            ],
            "markup": "markdown"
        },
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2018-07-31 12:34:41 UTC",
    "updated": [
        "2018-07-31 12:34:41 UTC",
        "2020-10-29 21:53:27 UTC"
    ],
    "html": "<p>Are you using Symfony 4? Do you want to use <a href=\"http://atlasphp.io\">Atlas</a> with it? We now have a <a href=\"https://github.com/atlasphp/Atlas.Symfony\">Symfony bundle and Flex recipe</a> that makes installation and integration a breeze. Two commands and one <code>.env</code> file edit, and you\u2019re ready to go:</p>\n\n<pre><code>composer config extra.symfony.allow-contrib true\ncomposer require atlas/symfony ~1.0\n</code></pre>\n\n<p>Build out all your mapper files from your database tables with a single command:</p>\n<pre><code>php bin/console atlas:skeleton</code></pre>\n<p>Then let Symfony inject the Atlas ORM object in your controller or application service constructors automatically (no further configuration needed):</p>\n<pre><code>&lt;?php\nnamespace App;\n\nuse Atlas\\Orm\\Atlas;\nuse App\\DataSource\\Thread\\Thread\nuse App\\DataSource\\Thread\\ThreadRecord;\n\nclass ApplicationService\n{\n    public function __construct(Atlas $atlas)\n    {\n        $this-&gt;atlas = $atlas;\n    }\n\n    public function fetchThreadById($thread_id) : ThreadRecord\n    {\n        return $this-&gt;atlas-&gt;fetchRecord(Thread::class, $thread_id);\n    }\n}\n</code></pre>\n<p>That\u2019s it \u2013 you can now use Atlas for all the heavy lifting of your database work:</p>\n<ul>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/relationships.html\">Defining relationships between mappers</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/reading.html\">Fetching Records and RecordSets</a></p>\n</li>\n<li>\n<p>Working with <a href=\"http://atlasphp.io/cassini/orm/records.html\">Records</a> and <a href=\"http://atlasphp.io/cassini/orm/record-sets.html\">RecordSets</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/transactions.html\">Managing transactions</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/behavior.html\">Adding behaviors</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/events.html\">Handling events</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/direct.html\">Direct lower-level queries</a></p>\n</li>\n<li>\n<p><a href=\"http://atlasphp.io/cassini/orm/other.html\">Other issues</a> such as custom mapper methods, single table inheritance, many-to-many relationships, and automated validation</p>\n</li>\n</ul>\n<p>If you\u2019re looking for a good persistence model data mapper, give <a href=\"http://atlasphp.io\">Atlas</a> a try!</p>\n"
}
