Doctrine inheritance not inserting record into parent table - doctrine

I've got the following database structure:
Account:
columns:
email: string(255)
name:
type: string(255)
UserRegistered:
columns:
email:
type: string(255)
email: true
notnull: true
unique: true
username:
type: string(255)
notnull: true
nospace: true
unique: true
minlength: 5
password:
type: string(255)
token: string(255)
inheritance:
extends: Account
type: concrete
UserOpenid:
columns:
openid: string(255)
openid_provider: string(255)
inheritance:
extends: Account
type: concrete
When I insert a new UserRegistered or UserOpenid record, I would've expected it to create a UserRegistered record as well as an Account record.
Did I misunderstand inheritance / am I misusing it, or have I done something wrong?

If you use concrete inheritance the master table will always be empty. All fields from the master table are duplicated in the child tables.. therefore there is no need to write to the master table.

Related

Swagger AWS API Gateway with Strict-Transport-Security

I'm trying to use Strict-Transport-Security header with API Gateway on swagger definition, but I keep getting Invalid mapping expression parameter specified: method.response.header.Strict-Transport-Security when I use:
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Strict-Transport-Security: "'max-age=31536000; includeSubdomains; preload'"
Full definition below:
openapi: 3.0.1
info:
title:APIs
version: 1.0.1
servers:
- url: "http://localhost:9001"
security:
- ApiGateway: []
paths:
/user/{id}:
get:
summary: Get user
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
description: return user by ID
responses:
"200":
description: user returned successfully
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"400":
description: Validation failure
"500":
description: Something went wrong
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${apiLambda.Arn}/invocations
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Strict-Transport-Security: "'max-age=31536000; includeSubdomains; preload'"
passthroughBehavior: "never"
httpMethod: "POST"
type: "aws_proxy"
/user:
post:
summary: Create user
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/User"
responses:
"200":
description: User created successfully
"400":
description: Validation failure
"500":
description: Something went wrong
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${apiLambda.Arn}/invocations
responses:
default:
statusCode: "200"
passthroughBehavior: "never"
httpMethod: "POST"
type: "aws_proxy"
components:
securitySchemes:
ApiGateway:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
User:
type: object
required:
- id
- name
properties:
id:
type: string
format: uuid
example: "317d0a1d-1a44-4a47-b2d8-cbe64665591c"
description: "user ID"
name:
type: string
example: "Josiah Morrow"
description: "User name"
minimum: 1
maximum: 50
Unable to put integration response on 'GET' for resource at path '/user/{id}': Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.response.header.Strict-Transport-Security]

OpenAPI for pagination and sorting

I have pretty common case where GET Endpoint should accept pagination and sorting parameters. REST Contract is writing with OpenAPI. And the aim is to be able to receive something like such an object:
components:
schemas:
Paging:
type: object
properties:
page:
type: integer
limit:
type: integer
sorting:
$ref: '#/components/schemas/Sorting'
Sorting:
type: object
properties:
attr:
type: array
items:
$ref: '#/comonents/schemas/SortingAttr'
SortingAttr:
type: object
properties:
sortyBy:
$ref: '#/components/schemas/SortyByEnum'
direction:
$ref: '#/components/schemas/SortDirectionEnum'
SortByEnum:
type: string
enum: [ PROP1, PROP2 ]
SortDirectionEnum:
type: string
enum: [ ASC, DESC ]
As a workaround I use POST Request and provide object 'Paging' as a body and thus get this nested object in controller. However, this does not work as query parameter for GET request.
Is there another way to get following query params?
page
limit
array of sorting params: [{sortParam, sortDirection}]

How does the kendo UI schema model ID work?

schema ID is really bothering me.
The logic I want is:
Open a modal popup window in grid A, and add the selected data (select row) in the modal popup as a new row in grid A.
Finally, we confirm this via the saveChanges () event.
This behavior works very nicely, but there are some things I don't understand.
schema: {
data : 'list' ,
model: {
id: 'prodNo',
fields: {
orderDSeq: { editable: false },
orderNo: { editable: false },
prodNo: {type: 'string'},
mtrlQt: {type: 'string'},
prodSize: {type: 'string'},
prodUnit: {type: 'string'},
orderQnt: {type: 'string'},
presentStkQnt: {type: 'string'},
prodPrice: {type: 'string'},
totalPrice: {type: 'string'},
spplLimitDt: {type: 'string'},
reMark: {type: 'string'}
Above is the schema of A grid, And
schema: {
data: 'list',
model: {
id: 'key',
fields: {
prodNm: {type: 'string'},
orderNo: {type : 'string'},
prodNo: { type: 'string' },
mtrlQt: { type: 'string' },
prodSize: { type: 'string' },
sStk: { type: 'string' },
prodPrice: { type: 'string' }
Above is the modal popup schema.
It's a bit small, but it has a very similar structure.
The key question here.
This is not about A Grid, but about the schema ID of the modal popup.
Any changes made to Grid A did not affect this operation.
As far as I know, "Key(ID)" in the schema model should be one of the values ​​of the actual fields.
However, if you set this to one of the actual fields, the saveChanges () event will not detect grid changes. (ex, id:prodNm, id:prodNo... I did it because some of the information told me to exclude the Key data from the field, but the results were the same.)
However, if I specify the ID value as an arbitrary random character, this works very nicely.
Any word like "id:key, id:sound, id:stick .." This logic is performed for any characters that do not exist in the field.
Please make me understand this behavior.
How does model ID affect this logic?
ID is an important key for detecting changes, but I can't understand this groundless behavior.

Importing Open Api 3.0 yaml to Postman 7.1

I'd like to import an open-api 3.0 yaml file into postman, v. 7.1.1.
I am generating OpenApi 3.0 docs in Laravel using darkaonline/l5-swagger. The generated open-api 3.0 yaml file produces an error-free output when pasted into editor.swagger.io. The api is being written in accordance with json:api spec (or is intended to be).
When the file is imported to postman (v 7.1.1) this error is generated : "Error while importing Open API 3.0: Could not import" All the documentation I've read says that postman now supports open api 3.0. I tried loading OpenApi 3.0 yaml examples from Zircote's github, and they imported just fine. They are much less complex than our docs, though.
Code excerpt: Warning this is a lot, but I feel like I needed to give enough context(It's actually a small chunk of the full doc--the file is 2000 lines long):
info:
title: 'NAME OF MY API'
version: 1.0.0
servers:
-
url: 'https://api.API.com/v1'
paths:
/accounts:
get:
tags:
- accounts
summary: 'list accounts'
operationId: 'App\Http\Controllers\v1\AccountsController::index'
responses:
200:
description: 'A list of accounts'
content:
application/vnd.api+json:
schema:
required:
- data
properties:
data:
description: 'Show all accounts for this request.'
type: array
items:
properties:
type:
type: string
id:
type: string
attributes:
$ref: '#/components/schemas/account'
relationships:
properties:
persons:
type: array
items:
$ref: '#/components/schemas/relationship'
type: object
links:
$ref: '#/components/schemas/relationship/properties/links'
type: object
meta:
$ref: '#/components/schemas/meta'
links:
$ref: '#/components/schemas/links'
type: object
401:
description: 'Unauthorized access'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
404:
description: 'No records found'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
servers:
-
url: 'https://api.API.com/v1'
post:
tags:
- accounts
summary: 'new account'
operationId: 'App\Http\Controllers\v1\AccountsController::store'
responses:
201:
description: 'Successful save'
401:
description: 'Unauthorized access'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
400:
description: 'Bad request, save failed'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
servers:
-
url: 'https://api.API.com/v1'
'/accounts/{id}':
get:
tags:
- accounts
summary: 'get one account'
operationId: 'App\Http\Controllers\v1\AccountsController::show'
parameters:
-
name: id
in: path
required: true
schema:
type: string
responses:
200:
description: 'An account object'
content:
application/vnd.api+json:
schema:
properties:
type:
description: 'Display the specified resource.'
type: string
id:
description: 'Display the specified resource.'
type: string
attributes:
$ref: '#/components/schemas/account'
relationships:
description: 'Display the specified resource.'
properties:
persons:
description: 'Display the specified resource.'
type: array
items:
$ref: '#/components/schemas/relationship'
type: object
links:
$ref: '#/components/schemas/relationship/properties/links'
type: object
401:
description: 'Unauthorized access'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
404:
description: 'Record not found'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
servers:
-
url: 'https://api.API.com/v1'
delete:
tags:
- accounts
summary: 'remove account'
operationId: 'App\Http\Controllers\v1\AccountsController::destroy'
parameters:
-
name: id
in: path
required: true
schema:
type: string
responses:
200:
description: 'An account object'
401:
description: 'Unauthorized access'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
405:
description: 'Method not allowed'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
400:
description: 'Bad request, save failed'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
servers:
-
url: 'https://api.API.com/v1'
patch:
tags:
- accounts
summary: 'update account'
operationId: 'App\Http\Controllers\v1\AccountsController::update'
parameters:
-
name: id
in: path
required: true
schema:
type: string
responses:
200:
description: 'An account object'
401:
description: 'Unauthorized access'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
400:
description: 'Bad request, save failed'
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/error-response'
servers:
-
url: 'https://api.API.com/v1'
components:
schemas:
account:
title: 'account object'
description: 'A single account object.'
required:
- ur_account_id
- name
- address1
- city
- state
- zip
- country_code
- phone
- email
properties:
_id:
description: 'Unique identifier to include in path to get a single record.'
type: string
ur_account_id:
description: 'The unique account ID.'
type: string
name:
description: 'The name associated with the account'
type: string
address_1:
description: 'The street address for the account.'
type: string
address_2:
description: 'The Suite number, PO Box Number, Floor Number, etc, for the account.'
type: string
city:
description: 'The city the account is resides in.'
type: string
state:
description: 'The two letter abbreviation of the state the account resides in'
type: string
zip:
description: 'The Postal Code the account resides in.'
type: string
country_code:
description: 'Country code associated with the account.'
type: string
phone:
description: 'The phone number associated with the account.'
type: string
phone_alpha:
description: 'The phone number associated with the account.'
type: string
email:
description: 'Email associated with the account'
type: string
require_po:
description: 'Whether the account requires a PO.'
type: string
status:
description: 'Status of current account'
type: boolean
tags:
-
name: accounts
description: 'Everything about accounts'
externalDocs:
description: 'Find out more'
url: 'http://admin.API.com/documents' ```
The problem is that within each path object’s servers object, I defined only the base URL, assuming for some reason that the base URL would be concatenated with the path. If you define a server object within the path object, you have to use the FULL URL for the endpoint. It was giving me errors specifically with /{id} endpoints because I defined a path variable that not present in the servers object

Swagger 3.0 schema error "should NOT have additional properties"

What does this error below mean? (Running in Swagger Editor)
Schema error should NOT have additional properties additionalProperty:
/buildinfo, /clearcache,
/countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout,
/countries/{countryId}/cinemas/{theatreid}/screens Jump to line 0
Below is my yaml file.
openapi: "3.0.1"
info:
title: Mobile backend
version: 1.0.0
license:
name: Apache 2.0
paths:
/buildinfo:
get:
description: Returns the build information (Version and Time stamp).
operationId: getBuildInfo
parameters:
- name: LBPATH
in: header
/clearcache:
get:
description: Clears the mobile backends cache (You need to be Admin to do this call)
operationId: clearCache
parameters:
- name: LBPATH
in: header
/countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout:
get:
description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
operationId: getScreenLayout
parameters:
- name: theatreid
in: path
- name: screenid
in: path
- name: seatwidth
in: query
- name: seatheight
in: query
- name: Accept-Language
in: header
- name: LBPATH
in: header
/countries/{countryId}/cinemas/{theatreid}/screens:
get:
description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
operationId: getAuditoriumsInTheatre
parameters:
- name: theatreid
in: path
- name: Accept-Language
in: header
- name: LBPATH
in: header
components:
schemas:
ProfileNotifications:
properties:
iWantEmails:
type: boolean
iWantSMS:
type: boolean
iWantPushNotifications:
type: boolean
OfferActivateRequest:
properties:
offerId:
type: int64
osType:
$ref: '#/components/schemas/OSType'
mobileId:
type: string
activationDate:
type: date
Customer:
properties:
type:
$ref: '#/components/schemas/TicketType'
count:
type: int32
Profile$ProfileStatus:
properties:
Booking:
properties:
profileId:
type: string
remoteEntityIds:
type: array
items:
string
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
showId:
type: string
seatsUnnumberedCount:
type: int32
ProfileFriend:
properties:
name:
type: string
profileReferenceCode:
type: string
OfferConsumeRequest:
properties:
offerId:
type: int64
osType:
$ref: '#/components/schemas/OSType'
mobileId:
type: string
Profile:
properties:
language:
type: string
children:
type: array
items:
int32
city:
type: string
memberSince:
type: date
status:
$ref: '#/components/schemas/Profile$ProfileStatus'
firstName:
type: string
lastName:
type: string
phonenumber:
type: string
socialSecurityNumber:
type: string
acceptedTermsAndConditionsOn:
type: date
acceptedGeneralDataProtectionRegulationOn:
type: date
profileId:
type: string
currentLevelId:
type: string
aztecCode:
type: string
allowSfBioToSendNewsletters:
type: boolean
favoriteMovies:
type: array
items:
string
spendingPointsWillExpire:
type: array
items:
$ref: '#/components/schemas/SpendingPoint'
friends:
type: array
items:
$ref: '#/components/schemas/ProfileFriend'
userEmail:
type: string
providerId:
type: int32
providerToken:
type: string
memberNumber:
type: string
userHasVerifiedThisAccount:
type: boolean
loyaltyLevelId:
type: string
loyaltyLevelName:
type: string
loyaltyLevelSince:
type: date
loyaltyLevelExpiration:
type: date
loyaltyPointsAvailableForSpending:
type: int32
loyaltyMoviesLeftToTheNextLevel:
type: int32
loyaltyPointsLeftToTheNextLevel:
type: int32
loyaltyPointsLevelToGetGoldMember:
type: int32
loyaltyMovieLevelToGetGoldMember:
type: int32
loyaltySpendingPointsExpireDate:
type: date
loyaltySpendingPointsExpireAmount:
type: int32
oldClubCardNumber:
type: string
loyaltyEndDate:
type: date
CardType$Type:
properties:
purchaseCard:
type: boolean
Card:
properties:
type:
$ref: '#/components/schemas/CardType$Type'
number:
type: string
requestedAmount:
type: int32
deductedAmount:
type: int32
isUsed:
type: boolean
balance:
type: int32
errorCode:
type: int32
LockSeats:
properties:
seatKeys:
type: array
items:
$ref: '#/components/schemas/SeatKey'
auditoriumSys99Code:
type: string
dateTime:
type: int64
SeatKey:
properties:
seatRow:
type: int32
seatSection:
type: string
seatId:
type: int32
ShowKey:
properties:
Payment:
properties:
email:
type: string
profileId:
type: string
serialVersionUID:
type: int64
ticketTypes:
type: array
items:
$ref: '#/components/schemas/TicketType'
easyPayment:
$ref: '#/components/schemas/EasyPayment'
reservationPayment:
type: boolean
reservationNumber:
type: string
cards:
type: array
items:
$ref: '#/components/schemas/Card'
showKey:
$ref: '#/components/schemas/ShowKey'
bookingId:
type: int32
redirectUrl:
type: string
transactionId:
type: string
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
goggleCount:
type: int32
paymentResponseCode:
type: string
Reservation:
properties:
email:
type: string
profileId:
type: string
cards:
type: array
items:
$ref: '#/components/schemas/Card'
bookingId:
type: int32
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
msisdn:
type: string
showId:
type: string
goggleCount:
type: int32
totalFee:
type: int32
adultTicketCount:
type: int32
childTicketCount:
type: int32
pensionerTicketCount:
type: int32
plusAndVipTicketCount:
type: int32
totalPlusAndVipTicketCost:
type: int32
SpendingPoint:
properties:
expireDate:
type: date
amount:
type: int32
ProfileMovies:
properties:
movies:
type: array
items:
string
OSType:
properties:
ProfileCinemas:
properties:
cinemas:
type: array
items:
string
LockSeatsUnnumbered:
properties:
auditoriumSys99Code:
type: string
dateTime:
type: int64
nrOfSeats:
type: int32
TicketType:
properties:
EasyPayment:
properties:
panHash:
type: string
truncPan:
type: string
userAccept:
type: boolean
The indentation of paths is wrong:
paths:
/buildinfo: # <-----
get:
It should be:
paths:
/buildinfo:
get:
Your spec also has many other errors, such as missing schema for parameters, missing responses in operations, wrong type values in schemas, etc. Follow the hints in the Swagger Editor to fix the errors.
But I still get error I don't understand. "Schema error at paths" "should be array"
parameters:
name: LBPATH
in: header
schema:
type: string
style: simple
parameters is an array of parameters. In YAML, array items are formatted with the leading -. Also style is a parameter attribute, not schema attribute.
parameters:
- name: LBPATH
in: header
schema:
type: string
style: simple
To learn more about OpenAPI 3.0 syntax and how to format things, check out this guide: https://swagger.io/docs/specification/basic-structure/

Resources