1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.CMS.CmsUser.dcm.yml

124 lines
3.3 KiB
YAML
Raw Normal View History

2012-03-10 06:03:25 +04:00
Doctrine\Tests\Models\CMS\CmsUser:
type: entity
table: cms_users
namedQueries:
all: SELECT u FROM __CLASS__ u
namedNativeQueries:
fetchIdAndUsernameWithResultClass:
resultClass: CmsUser
query: SELECT id, username FROM cms_users WHERE username = ?
fetchAllColumns:
name: fetchAllColumns
resultClass: CmsUser
query: SELECT * FROM cms_users WHERE username = ?
fetchJoinedAddress:
name: fetchJoinedAddress
resultSetMapping: mappingJoinedAddress
query: SELECT u.id, u.name, u.status, a.id AS a_id, a.country, a.zip, a.city FROM cms_users u INNER JOIN cms_addresses a ON u.id = a.user_id WHERE u.username = ?
fetchJoinedPhonenumber:
name: fetchJoinedPhonenumber
resultSetMapping: mappingJoinedPhonenumber
query: SELECT id, name, status, phonenumber AS number FROM cms_users INNER JOIN cms_phonenumbers ON id = user_id WHERE username = ?
fetchUserPhonenumberCount:
name: fetchUserPhonenumberCount
resultSetMapping: mappingUserPhonenumberCount
query: SELECT id, name, status, COUNT(phonenumber) AS numphones FROM cms_users INNER JOIN cms_phonenumbers ON id = user_id WHERE username IN (?) GROUP BY id, name, status, username ORDER BY username
sqlResultSetMappings:
mappingJoinedAddress:
entityResult:
0:
entityClass: __CLASS__
fieldResult:
0:
name: id
1:
name: name
2:
name: status
3:
name: address.zip
4:
name: address.city
5:
name: address.country
6:
name: address.id
column: a_id
mappingJoinedPhonenumber:
name: mappingJoinedPhonenumber
entityResult:
user:
entityClass: CmsUser
fieldResult:
0:
name: id
1:
name: name
2:
name: status
3:
name: phonenumbers.phonenumber
column: number
mappingUserPhonenumberCount:
name: mappingUserPhonenumberCount
columnResult:
0:
name: numphones
entityResult:
user_0:
entityClass: CmsUser
fieldResult:
0:
name: id
1:
name: name
2:
name: status
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
username:
type: string
length: 255
unique: true
status:
type: string
length: 50
unique: true
oneToOne:
address:
targetEntity: CmsAddress
orphanRemoval: true
inversedBy: user
joinColumn:
name: address_id
referencedColumnName: id
cascade: [ persist ]
oneToOne:
email:
targetEntity: CmsEmail
orphanRemoval: true
inversedBy: user
joinColumn:
nullable: true
referencedColumnName: id
cascade: [ persist ]
manyToMany:
groups:
targetEntity: CmsGroup
joinTable:
name: cms_users_groups
joinColumns:
user_id:
referencedColumnName: id
inverseJoinColumns:
group_id:
referencedColumnName: id
cascade: [ persist , detach, merge]