Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
grifart libs
tables
Commits
3b40eadf
Commit
3b40eadf
authored
3 years ago
by
Daniel Kurowski
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-scaffolding' into 'master'
Fix scaffolding See merge request
!16
parents
41957682
8c419f2d
No related branches found
No related tags found
1 merge request
!16
Fix scaffolding
Pipeline
#36854
passed
3 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Scaffolding/Definitions.php
+10
-6
10 additions, 6 deletions
src/Scaffolding/Definitions.php
src/Scaffolding/Scaffolding.php
+4
-36
4 additions, 36 deletions
src/Scaffolding/Scaffolding.php
with
14 additions
and
42 deletions
src/Scaffolding/Definitions.php
+
10
−
6
View file @
3b40eadf
...
...
@@ -2,6 +2,7 @@
namespace
Grifart\Tables\Scaffolding
;
use
Grifart\ClassScaffolder\Capabilities\Capability
;
use
Grifart\ClassScaffolder\Definition\ClassDefinition
;
...
...
@@ -29,19 +30,22 @@ final class Definitions implements \IteratorAggregate
);
}
public
function
getR
owClass
():
ClassDefinition
public
function
r
owClass
With
(
Capability
$capability
,
Capability
...
$capabilities
):
self
{
return
$this
->
rowClass
;
$this
->
rowClass
=
$this
->
rowClass
->
with
(
$capability
,
...
$capabilities
);
return
$this
;
}
public
function
getM
odificationsClass
():
ClassDefinition
public
function
m
odificationsClass
With
(
Capability
$capability
,
Capability
...
$capabilities
):
self
{
return
$this
->
modificationsClass
;
$this
->
modificationsClass
=
$this
->
modificationsClass
->
with
(
$capability
,
...
$capabilities
);
return
$this
;
}
public
function
getT
ableClass
():
ClassDefinition
public
function
t
ableClass
With
(
Capability
$capability
,
Capability
...
$capabilities
):
self
{
return
$this
->
tableClass
;
$this
->
tableClass
=
$this
->
tableClass
->
with
(
$capability
,
...
$capabilities
);
return
$this
;
}
...
...
This diff is collapsed.
Click to expand it.
src/Scaffolding/Scaffolding.php
+
4
−
36
View file @
3b40eadf
...
...
@@ -39,45 +39,13 @@ final class Scaffolding
string
$primaryKeyClass
):
Definitions
{
return
self
::
buildersForPgTable
(
$pgReflector
,
$mapper
,
$schema
,
$table
,
$rowClassName
,
$modificationsClassName
,
$tableClassName
,
$primaryKeyClass
,
);
}
/**
* Usage:
* ```php
* $builders = Scaffolding::buildersForPgTable(...);
* $builders->getRowClass()->decorate(...);
* return $builders;
* ```
*/
public
static
function
buildersForPgTable
(
PostgresReflector
$pgReflector
,
TypeMapper
$mapper
,
string
$schema
,
string
$tableClass
,
string
$rowClassName
,
string
$modificationsClassName
,
string
$tableClassName
,
string
$primaryKeyClass
):
Definitions
{
$columnsNativeTypes
=
$pgReflector
->
retrieveColumnInfo
(
$schema
,
$tableClass
);
$columnsNativeTypes
=
$pgReflector
->
retrieveColumnInfo
(
$schema
,
$table
);
if
(
\count
(
$columnsNativeTypes
)
===
0
)
{
throw
new
\LogicException
(
'No columns found for given configuration. Does referenced table exist?'
);
}
$location
=
function
(
string
$column
)
use
(
$schema
,
$table
Class
):
string
{
return
self
::
location
(
$schema
,
$table
Class
,
$column
);
$location
=
function
(
string
$column
)
use
(
$schema
,
$table
):
string
{
return
self
::
location
(
$schema
,
$table
,
$column
);
};
$columnsPhpTypes
=
[];
...
...
@@ -109,7 +77,7 @@ final class Scaffolding
$tableClass
=
(
new
ClassDefinition
(
$tableClassName
))
->
with
(
new
TableImplementation
(
$schema
,
$table
Class
,
$table
,
$primaryKeyClass
,
$rowClassName
,
$modificationsClassName
,
...
...
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