Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bus Map
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Sarukhanov
Bus Map
Commits
2d8667f3
Commit
2d8667f3
authored
9 years ago
by
Anton Sarukhanov
Browse files
Options
Downloads
Patches
Plain Diff
Message-Agency FK relationship
parent
205cef6e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doctrine.php
+13
-0
13 additions, 0 deletions
doctrine.php
src/BusMap/Agency.php
+2
-9
2 additions, 9 deletions
src/BusMap/Agency.php
src/BusMap/Message.php
+2
-3
2 additions, 3 deletions
src/BusMap/Message.php
with
17 additions
and
12 deletions
doctrine.php
+
13
−
0
View file @
2d8667f3
...
@@ -4,12 +4,25 @@
...
@@ -4,12 +4,25 @@
*
*
*/
*/
use
Doctrine\Common\Cache\ArrayCache
;
use
Doctrine\Common\Annotations\AnnotationReader
;
use
Doctrine\ORM\Tools\Setup
;
use
Doctrine\ORM\Tools\Setup
;
use
Doctrine\ORM\EntityManager
;
use
Doctrine\ORM\EntityManager
;
use
Doctrine\ORM\Mapping\Driver\AnnotationDriver
;
require_once
"vendor/autoload.php"
;
require_once
"vendor/autoload.php"
;
require_once
"config.php"
;
require_once
"config.php"
;
$paths
=
array
(
realpath
(
__DIR__
.
"/src/BusMap"
)
);
$isDevMode
=
true
;
$isDevMode
=
true
;
$cache
=
new
ArrayCache
();
$reader
=
new
AnnotationReader
();
$driver
=
new
AnnotationDriver
(
$reader
,
$paths
);
$config
=
Setup
::
createAnnotationMetadataConfiguration
(
array
(
__DIR__
.
"/src"
),
$isDevMode
);
$config
=
Setup
::
createAnnotationMetadataConfiguration
(
array
(
__DIR__
.
"/src"
),
$isDevMode
);
$config
->
setMetadataCacheImpl
(
$cache
);
$config
->
setQueryCacheImpl
(
$cache
);
$config
->
setMetadataDriverImpl
(
$driver
);
$entityManager
=
EntityManager
::
create
(
$cfg
[
'db'
],
$config
);
$entityManager
=
EntityManager
::
create
(
$cfg
[
'db'
],
$config
);
This diff is collapsed.
Click to expand it.
src/BusMap/Agency.php
+
2
−
9
View file @
2d8667f3
...
@@ -12,19 +12,12 @@ use Doctrine\ORM\Mapping as ORM;
...
@@ -12,19 +12,12 @@ use Doctrine\ORM\Mapping as ORM;
*/
*/
class
Agency
class
Agency
{
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private
$id
;
/**
/**
* @var string
* @var string
*
*
* @ORM\Column(name="tag", type="string", length=50, nullable=true)
* @ORM\Column(name="tag", type="string", length=50, nullable=false)
* @ORM\Id
*/
*/
private
$tag
;
private
$tag
;
...
...
This diff is collapsed.
Click to expand it.
src/BusMap/Message.php
+
2
−
3
View file @
2d8667f3
...
@@ -22,9 +22,8 @@ class Message
...
@@ -22,9 +22,8 @@ class Message
private
$id
;
private
$id
;
/**
/**
* @var string
* @ORM\ManyToOne(targetEntity="Agency")
*
* @ORM\JoinColumn(name="agency", referencedColumnName="tag")
* @ORM\Column(name="agency", type="string", length=50, nullable=true)
*/
*/
private
$agency
;
private
$agency
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment