Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
204b6d71
Commit
204b6d71
authored
Oct 08, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Finishing the AnnotationExporter to export relationships properly
parent
aba096cc
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
139 additions
and
32 deletions
+139
-32
AnnotationExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
+113
-26
Address.php
tools/sandbox/Entities/Address.php
+1
-1
User.php
tools/sandbox/Entities/User.php
+12
-1
cli-config.php
tools/sandbox/cli-config.php
+4
-2
index.php
tools/sandbox/index.php
+9
-2
No files found.
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
View file @
204b6d71
This diff is collapsed.
Click to expand it.
tools/sandbox/Entities/Address.php
View file @
204b6d71
...
@@ -11,7 +11,7 @@ class Address {
...
@@ -11,7 +11,7 @@ class Address {
private
$id
;
private
$id
;
/** @Column(type="string", length=255) */
/** @Column(type="string", length=255) */
private
$street
;
private
$street
;
/** @OneToOne(targetEntity="User", mappedBy="address") */
/** @OneToOne(targetEntity="User", mappedBy="address"
, cascade={"persist"}
) */
private
$user
;
private
$user
;
public
function
getId
()
{
public
function
getId
()
{
...
...
tools/sandbox/Entities/User.php
View file @
204b6d71
...
@@ -15,9 +15,20 @@ class User {
...
@@ -15,9 +15,20 @@ class User {
private
$test
;
private
$test
;
/**
/**
* @OneToOne(targetEntity="Address")
* @OneToOne(targetEntity="Address")
* @JoinColumn(name="address_id", referencedColumnName="id")
* @JoinColumns({
* @JoinColumn(name="address_id", referencedColumnName="id"),
* @JoinColumn(name="address2_id", referencedColumnName="id")
* })
*/
*/
private
$address
;
private
$address
;
/**
* @ManyToMany(targetEntity="Group")
* @JoinTable(name="user_group",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")
* })
*/
private
$groups
;
public
function
getId
()
{
public
function
getId
()
{
return
$this
->
id
;
return
$this
->
id
;
...
...
tools/sandbox/cli-config.php
View file @
204b6d71
...
@@ -23,8 +23,10 @@ $config = new \Doctrine\ORM\Configuration();
...
@@ -23,8 +23,10 @@ $config = new \Doctrine\ORM\Configuration();
$config
->
setMetadataCacheImpl
(
new
\Doctrine\Common\Cache\ArrayCache
);
$config
->
setMetadataCacheImpl
(
new
\Doctrine\Common\Cache\ArrayCache
);
$connectionOptions
=
array
(
$connectionOptions
=
array
(
'driver'
=>
'pdo_sqlite'
,
'driver'
=>
'pdo_mysql'
,
'path'
=>
'database.sqlite'
'user'
=>
'root'
,
'password'
=>
''
,
'dbname'
=>
'doctrine2'
);
);
$em
=
\Doctrine\ORM\EntityManager
::
create
(
$connectionOptions
,
$config
);
$em
=
\Doctrine\ORM\EntityManager
::
create
(
$connectionOptions
,
$config
);
...
...
tools/sandbox/index.php
View file @
204b6d71
...
@@ -14,7 +14,7 @@ $classLoader->register();
...
@@ -14,7 +14,7 @@ $classLoader->register();
// Set up caches
// Set up caches
$config
=
new
\Doctrine\ORM\Configuration
;
$config
=
new
\Doctrine\ORM\Configuration
;
$cache
=
new
\Doctrine\Common\Cache\A
pc
Cache
;
$cache
=
new
\Doctrine\Common\Cache\A
rray
Cache
;
$config
->
setMetadataCacheImpl
(
$cache
);
$config
->
setMetadataCacheImpl
(
$cache
);
$config
->
setQueryCacheImpl
(
$cache
);
$config
->
setQueryCacheImpl
(
$cache
);
...
@@ -30,6 +30,13 @@ $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
...
@@ -30,6 +30,13 @@ $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
## PUT YOUR TEST CODE BELOW
## PUT YOUR TEST CODE BELOW
$user
=
new
User
;
$user
=
new
User
;
$user
->
setName
(
'jwage'
);
$address
=
new
Address
;
$address
=
new
Address
;
$address
->
setStreet
(
'6512 Mercomatic Court'
);
$address
->
setUser
(
$user
);
$user
->
setAddress
(
$address
);
echo
"Hello World!"
;
$em
->
persist
(
$user
);
\ No newline at end of file
$em
->
persist
(
$address
);
$em
->
flush
();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment