Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 9bfbee6c
authored
Aug 24, 2017
by
Dan Rumney
Committed by
Sushant
Aug 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(associations): throw informational message when try to associate undefined (#8106)
1 parent
56f86182
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
lib/associations/mixin.js
lib/associations/mixin.js
View file @
9bfbee6
...
...
@@ -9,7 +9,7 @@ const BelongsTo = require('./belongs-to');
const
Mixin
=
{
hasMany
(
target
,
options
)
{
// testhint options:none
if
(
!
target
.
prototype
||
!
(
target
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
if
(
!
target
||
!
target
.
prototype
||
!
(
target
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
throw
new
Error
(
this
.
name
+
'.hasMany called with something that\'s not a subclass of Sequelize.Model'
);
}
...
...
@@ -33,7 +33,7 @@ const Mixin = {
},
belongsToMany
(
targetModel
,
options
)
{
// testhint options:none
if
(
!
targetModel
.
prototype
||
!
(
targetModel
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
if
(
!
targetModel
||
!
targetModel
.
prototype
||
!
(
targetModel
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
throw
new
Error
(
this
.
name
+
'.belongsToMany called with something that\'s not a subclass of Sequelize.Model'
);
}
...
...
@@ -77,7 +77,7 @@ const Mixin = {
// The logic for hasOne and belongsTo is exactly the same
function
singleLinked
(
Type
)
{
return
function
(
target
,
options
)
{
// testhint options:none
if
(
!
target
.
prototype
||
!
(
target
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
if
(
!
target
||
!
target
.
prototype
||
!
(
target
.
prototype
instanceof
this
.
sequelize
.
Model
))
{
throw
new
Error
(
this
.
name
+
'.'
+
Utils
.
lowercaseFirst
(
Type
.
toString
())
+
' called with something that\'s not a subclass of Sequelize.Model'
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment