Skip to content

Commit ca085b3

Browse files
author
Paul M. Jones
committed
update with recipe
1 parent 7a12daf commit ca085b3

File tree

1 file changed

+37
-25
lines changed

1 file changed

+37
-25
lines changed

README.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,27 @@ available as a bundle for Symfony 4 projects.
77

88
## Installation and Configuration
99

10-
1. In your Symfony 4 project, add `atlas/symfony` as a requirement.
10+
1. In your Symfony 4 project, enable contributor recipes:
1111

1212
```
13-
composer require atlas/symfony ~1.0
13+
composer config extra.symfony.allow-contrib true
1414
```
1515
16-
2. Copy the Atlas config file from the bundle to your project.
16+
2. Require the `atlas/symfony` package; this will activate a Symfony Flex recipe
17+
as part of the installation:
1718
1819
```
19-
cp ./vendor/atlas/symfony/Resources/config/atlas.yaml ./config/packages/atlas.yaml
20+
composer require atlas/symfony ~1.0
2021
```
2122
22-
3. Add these variables to your `.env` file with your DSN, username, and password:
23+
3. Edit these new `.env` variables to define your database connection:
2324
2425
```
2526
ATLAS_PDO_DSN=mysql:host=myhost;dbname=mydatabase
2627
ATLAS_PDO_USERNAME=myusername
2728
ATLAS_PDO_PASSWORD=mypassword
2829
```
2930
30-
4. Finally, enable the bundle by adding it to your `config/bundles.php` file:
31-
32-
```
33-
return [
34-
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
35-
// ...
36-
Atlas\Symfony\AtlasBundle::class => ['all' => true],
37-
];
38-
```
39-
40-
(A Symfony Flex recipe to ease installation is forthcoming.)
41-
4231
> **Note:**
4332
>
4433
> If you are using PHPStorm, you may wish to copy the IDE meta file to your
@@ -52,24 +41,25 @@ available as a bundle for Symfony 4 projects.
5241
5342
### Generating Mappers
5443
55-
First, use the command-line tooling to create the skeleton files for all your
56-
database tables:
44+
Use the command-line tooling to create the skeleton files for all your database
45+
tables:
5746
5847
```
5948
mkdir src/DataSource
6049
php bin/console atlas:skeleton
6150
```
6251
63-
The `atlas.yaml` file specifies `App\DataSource\` as the namespace,
64-
and `src/DataSource/` as the directory. To change them, modify the
52+
The `config/packages/atlas.yaml` file specifies `App\DataSource\` as the
53+
namespace, and `src/DataSource/` as the directory. To change them, modify the
6554
`atlas.cli.config.input` values for `directory` and `namespace` as you see fit.
6655
6756
The database table names will be converted to singular for their relevant
6857
type names in PHP. If you want a different type names for certain tables,
69-
modify the `atlas.cli.transform` values in the `atlas.yaml` file.
58+
modify the `atlas.cli.transform` values in the `atlas.yaml` file to map a
59+
from table name to a type name.
7060
71-
When you make changes to the database, re-run the skeleton generator, and the
72-
relevant files will be regenerated.
61+
As you make changes to the database, re-run the skeleton generator, and the
62+
relevant table files will be regenerated.
7363
7464
For more information, see <http://atlasphp.io/cassini/skeleton/>.
7565
@@ -99,4 +89,26 @@ class ApplicationService
9989
}
10090
```
10191

102-
Full documentation for using Atlas is at <http://atlasphp.io/cassini/orm/>.
92+
Full documentation for using Atlas is at <http://atlasphp.io/cassini/orm/>:
93+
94+
95+
- [Defining relationships between mappers](http://atlasphp.io/cassini/orm/relationships.html)
96+
97+
- [Fetching Records and RecordSets](http://atlasphp.io/cassini/orm/reading.html)
98+
99+
- Working with [Records](http://atlasphp.io/cassini/orm/records.html)
100+
and [RecordSets](http://atlasphp.io/cassini/orm/record-sets.html)
101+
102+
- [Managing transactions](http://atlasphp.io/cassini/orm/transactions.html)
103+
104+
- [Adding behaviors](http://atlasphp.io/cassini/orm/behavior.html)
105+
106+
- [Handling events](http://atlasphp.io/cassini/orm/events.html)
107+
108+
- [Direct lower-level queries](http://atlasphp.io/cassini/orm/direct.html)
109+
110+
- [Other topics](http://atlasphp.io/cassini/orm/other.html) such as custom mapper
111+
methods, single table inheritance, many-to-many relationships, and automated
112+
validation
113+
114+
Enjoy!

0 commit comments

Comments
 (0)