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
f24a965d
Commit
f24a965d
authored
3 years ago
by
Daniel Kurowski
Browse files
Options
Downloads
Patches
Plain Diff
Unified variable names
parent
a7f1c1ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
Allow customizations on scaffolded objects
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Scaffolding/Scaffolding.php
+21
-21
21 additions, 21 deletions
src/Scaffolding/Scaffolding.php
with
21 additions
and
21 deletions
src/Scaffolding/Scaffolding.php
+
21
−
21
View file @
f24a965d
...
...
@@ -34,9 +34,9 @@ final class Scaffolding
TypeMapper
$mapper
,
string
$schema
,
string
$table
,
string
$rowClass
,
string
$modificationClass
,
string
$tableClass
,
string
$rowClass
Name
,
string
$modification
s
Class
Name
,
string
$tableClass
Name
,
string
$primaryKeyClass
):
array
{
...
...
@@ -45,9 +45,9 @@ final class Scaffolding
$mapper
,
$schema
,
$table
,
$rowClass
,
$modificationClass
,
$tableClass
,
$rowClass
Name
,
$modification
s
Class
Name
,
$tableClass
Name
,
$primaryKeyClass
,
)
->
buildAll
();
}
...
...
@@ -57,7 +57,7 @@ final class Scaffolding
* Usage:
* ```php
* $builders = Scaffolding::buildersForPgTable(...);
* $builders->
row
()->decorate(...);
* $builders->
getRowClass
()->decorate(...);
* return $builders->buildAll();
* ```
*/
...
...
@@ -65,20 +65,20 @@ final class Scaffolding
PostgresReflector
$pgReflector
,
TypeMapper
$mapper
,
string
$schema
,
string
$table
,
string
$rowClass
,
string
$modificationClass
,
string
$tableClass
,
string
$rowClassName
,
string
$modificationsClassName
,
string
$tableClassName
,
string
$primaryKeyClass
):
Builders
{
$columnsNativeTypes
=
$pgReflector
->
retrieveColumnInfo
(
$schema
,
$table
);
$columnsNativeTypes
=
$pgReflector
->
retrieveColumnInfo
(
$schema
,
$table
Class
);
if
(
\count
(
$columnsNativeTypes
)
===
0
)
{
throw
new
\LogicException
(
'No columns found for given configuration. Does referenced table exist?'
);
}
$location
=
function
(
string
$column
)
use
(
$schema
,
$table
):
string
{
return
self
::
location
(
$schema
,
$table
,
$column
);
$location
=
function
(
string
$column
)
use
(
$schema
,
$table
Class
):
string
{
return
self
::
location
(
$schema
,
$table
Class
,
$column
);
};
$columnsPhpTypes
=
[];
...
...
@@ -96,7 +96,7 @@ final class Scaffolding
// row class
$row
=
$addTableFields
(
new
ClassDefinitionBuilder
(
$rowClass
))
$row
Class
=
$addTableFields
(
new
ClassDefinitionBuilder
(
$rowClass
Name
))
->
implement
(
Row
::
class
)
->
decorate
(
new
PropertiesDecorator
())
->
decorate
(
new
InitializingConstructorDecorator
())
...
...
@@ -105,22 +105,22 @@ final class Scaffolding
->
decorate
(
new
ReconstituteConstructorDecorator
());
// row modification class
$modifications
=
$addTableFields
(
new
ClassDefinitionBuilder
(
$modificationClass
))
->
decorate
(
new
ModificationsDecorator
(
$tableClass
,
$primaryKeyClass
));
$modifications
Class
=
$addTableFields
(
new
ClassDefinitionBuilder
(
$modification
s
Class
Name
))
->
decorate
(
new
ModificationsDecorator
(
$tableClass
Name
,
$primaryKeyClass
));
// table class
$table
=
(
new
ClassDefinitionBuilder
(
$tableClass
))
$table
Class
=
(
new
ClassDefinitionBuilder
(
$tableClass
Name
))
->
decorate
(
new
TableDecorator
(
$schema
,
$table
,
$table
Class
,
$primaryKeyClass
,
$rowClass
,
$modificationClass
,
$rowClass
Name
,
$modification
s
Class
Name
,
$columnsNativeTypes
,
$columnsPhpTypes
,
));
return
Builders
::
from
(
$row
,
$modifications
,
$table
);
return
Builders
::
from
(
$row
Class
,
$modifications
Class
,
$table
Class
);
}
}
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