Skip to content

Commit

Permalink
minor #1435 Doctrine xml config (TorbenBr)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Doctrine xml config

Commits
-------

0d7aa04 Doctrine xml config
  • Loading branch information
stof committed Jan 19, 2015
2 parents cb3a5d3 + 0d7aa04 commit e71ff8a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Resources/doc/index.md
Expand Up @@ -184,6 +184,45 @@ Acme\UserBundle\Entity\User:
strategy: AUTO
```

##### xml

If you use xml to configure Doctrine you must add two files. The Entity and the orm.xml:

```php
<?php
// src/Acme/UserBundle/Entity/User.php

namespace Acme\UserBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;

/**
* User
*/
class User extends BaseUser
{
public function __construct()
{
parent::__construct();
// your own logic
}
}
```
```xml
<?xml version="1.0" encoding="utf-8"?>
<!-- src/Acme/UserBundle/Resources/config/doctrine/User.orm.xml -->
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity name="Acme\UserBundle\Entity\User" table="fos_user">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>
```

#### b) MongoDB User class

If you're persisting your users via the Doctrine MongoDB ODM, then your `User`
Expand Down

0 comments on commit e71ff8a

Please sign in to comment.