Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
symfony_2504
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Lech Sawoń
symfony_2504
Commits
657042b6
Commit
657042b6
authored
Oct 25, 2021
by
Lech Sawon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migration and changes
parent
d68905ba
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
11 deletions
+52
-11
Version20211025132503.php
migrations/Version20211025132503.php
+32
-0
Reservation.php
src/Entity/Reservation.php
+12
-8
Room.php
src/Entity/Room.php
+5
-0
ReservationType.php
src/Form/ReservationType.php
+1
-1
index.html.twig
templates/reservation/index.html.twig
+1
-1
show.html.twig
templates/reservation/show.html.twig
+1
-1
No files found.
migrations/Version20211025132503.php
0 → 100644
View file @
657042b6
<?php
declare
(
strict_types
=
1
);
namespace
DoctrineMigrations
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\Migrations\AbstractMigration
;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final
class
Version20211025132503
extends
AbstractMigration
{
public
function
getDescription
()
:
string
{
return
''
;
}
public
function
up
(
Schema
$schema
)
:
void
{
// this up() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE reservation ADD CONSTRAINT FK_42C8495554177093 FOREIGN KEY (room_id) REFERENCES room (id) NOT DEFERRABLE INITIALLY IMMEDIATE'
);
$this
->
addSql
(
'CREATE INDEX IDX_42C8495554177093 ON reservation (room_id)'
);
}
public
function
down
(
Schema
$schema
)
:
void
{
$this
->
addSql
(
'ALTER TABLE reservation DROP CONSTRAINT FK_42C8495554177093'
);
$this
->
addSql
(
'DROP INDEX IDX_42C8495554177093'
);
}
}
src/Entity/Reservation.php
View file @
657042b6
...
@@ -18,9 +18,10 @@ class Reservation
...
@@ -18,9 +18,10 @@ class Reservation
private
$id
;
private
$id
;
/**
/**
* @ORM\Column(type="integer")
* @ORM\ManyToOne(targetEntity="Room")
* @ORM\JoinColumn(name="room_id", referencedColumnName="id", nullable=false)
*/
*/
private
$roomId
;
private
Room
$room
;
/**
/**
* @ORM\Column(type="datetime")
* @ORM\Column(type="datetime")
...
@@ -37,18 +38,21 @@ class Reservation
...
@@ -37,18 +38,21 @@ class Reservation
return
$this
->
id
;
return
$this
->
id
;
}
}
public
function
getRoom
Id
()
:
?
int
public
function
getRoom
()
:
Room
{
{
return
$this
->
room
Id
;
return
$this
->
room
;
}
}
public
function
setRoomId
(
int
$roomId
)
:
self
/**
* @param Room $room
*/
public
function
setRoom
(
Room
$room
)
:
void
{
{
$this
->
roomId
=
$roomId
;
$this
->
room
=
$room
;
return
$this
;
}
}
public
function
getDateFrom
()
:
?
\DateTimeInterface
public
function
getDateFrom
()
:
?
\DateTimeInterface
{
{
return
$this
->
dateFrom
;
return
$this
->
dateFrom
;
...
...
src/Entity/Room.php
View file @
657042b6
...
@@ -38,4 +38,9 @@ class Room
...
@@ -38,4 +38,9 @@ class Room
return
$this
;
return
$this
;
}
}
public
function
__toString
()
:
string
{
return
$this
->
getName
();
}
}
}
src/Form/ReservationType.php
View file @
657042b6
...
@@ -12,7 +12,7 @@ class ReservationType extends AbstractType
...
@@ -12,7 +12,7 @@ class ReservationType extends AbstractType
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
:
void
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
:
void
{
{
$builder
$builder
->
add
(
'room
Id
'
)
->
add
(
'room'
)
->
add
(
'dateFrom'
)
->
add
(
'dateFrom'
)
->
add
(
'dateEnd'
)
->
add
(
'dateEnd'
)
;
;
...
...
templates/reservation/index.html.twig
View file @
657042b6
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
{%
for
reservation
in
reservations
%}
{%
for
reservation
in
reservations
%}
<tr>
<tr>
<td>
{{
reservation.id
}}
</td>
<td>
{{
reservation.id
}}
</td>
<td>
{{
reservation.room
Id
}}
</td>
<td>
{{
reservation.room
}}
</td>
<td>
{{
reservation.dateFrom
?
reservation.dateFrom
|
date
(
'Y-m-d H:i:s'
)
:
''
}}
</td>
<td>
{{
reservation.dateFrom
?
reservation.dateFrom
|
date
(
'Y-m-d H:i:s'
)
:
''
}}
</td>
<td>
{{
reservation.dateEnd
?
reservation.dateEnd
|
date
(
'Y-m-d H:i:s'
)
:
''
}}
</td>
<td>
{{
reservation.dateEnd
?
reservation.dateEnd
|
date
(
'Y-m-d H:i:s'
)
:
''
}}
</td>
<td>
<td>
...
...
templates/reservation/show.html.twig
View file @
657042b6
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
</tr>
</tr>
<tr>
<tr>
<th>
RoomId
</th>
<th>
RoomId
</th>
<td>
{{
reservation.room
Id
}}
</td>
<td>
{{
reservation.room
}}
</td>
</tr>
</tr>
<tr>
<tr>
<th>
DateFrom
</th>
<th>
DateFrom
</th>
...
...
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