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 a4dd202c
authored
Dec 30, 2013
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forgot dao-factory file
1 parent
4dfd3298
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
lib/dao-factory.js
lib/dao-factory.js
View file @
a4dd202
...
@@ -1194,17 +1194,25 @@ module.exports = (function() {
...
@@ -1194,17 +1194,25 @@ module.exports = (function() {
}.
bind
(
this
))
}.
bind
(
this
))
}
}
var
validateIncludedElement
=
function
(
include
)
{
var
validateIncludedElement
=
function
(
include
,
parent
)
{
if
(
include
instanceof
DAOFactory
)
{
if
(
include
instanceof
DAOFactory
)
{
include
=
{
daoFactory
:
include
,
as
:
include
.
tableName
}
include
=
{
daoFactory
:
include
,
as
:
include
.
tableName
}
}
}
if
(
typeof
parent
===
"undefined"
)
{
parent
=
this
}
if
(
typeof
include
===
'object'
)
{
if
(
typeof
include
===
'object'
)
{
if
(
include
.
hasOwnProperty
(
'model'
))
{
if
(
include
.
hasOwnProperty
(
'model'
))
{
include
.
daoFactory
=
include
.
model
include
.
daoFactory
=
include
.
model
delete
include
.
model
delete
include
.
model
}
}
if
(
!
include
.
hasOwnProperty
(
'as'
))
{
include
.
as
=
include
.
daoFactory
.
tableName
}
if
(
include
.
hasOwnProperty
(
'attributes'
))
{
if
(
include
.
hasOwnProperty
(
'attributes'
))
{
var
primaryKeys
;
var
primaryKeys
;
if
(
include
.
daoFactory
.
hasPrimaryKeys
)
{
if
(
include
.
daoFactory
.
hasPrimaryKeys
)
{
...
@@ -1222,7 +1230,7 @@ module.exports = (function() {
...
@@ -1222,7 +1230,7 @@ module.exports = (function() {
if
(
include
.
hasOwnProperty
(
'daoFactory'
)
&&
(
include
.
hasOwnProperty
(
'as'
)))
{
if
(
include
.
hasOwnProperty
(
'daoFactory'
)
&&
(
include
.
hasOwnProperty
(
'as'
)))
{
var
usesAlias
=
(
include
.
as
!==
include
.
daoFactory
.
tableName
)
var
usesAlias
=
(
include
.
as
!==
include
.
daoFactory
.
tableName
)
,
association
=
(
usesAlias
?
this
.
getAssociationByAlias
(
include
.
as
)
:
this
.
getAssociation
(
include
.
daoFactory
))
,
association
=
(
usesAlias
?
parent
.
getAssociationByAlias
(
include
.
as
)
:
parent
.
getAssociation
(
include
.
daoFactory
))
// If single (1:1) association, we singularize the alias, so it will match the automatically generated alias of belongsTo/HasOne
// If single (1:1) association, we singularize the alias, so it will match the automatically generated alias of belongsTo/HasOne
if
(
association
&&
!
usesAlias
&&
association
.
isSingleAssociation
)
{
if
(
association
&&
!
usesAlias
&&
association
.
isSingleAssociation
)
{
...
@@ -1233,6 +1241,12 @@ module.exports = (function() {
...
@@ -1233,6 +1241,12 @@ module.exports = (function() {
if
(
!!
association
&&
(
!
association
.
options
.
as
||
(
association
.
options
.
as
===
include
.
as
)))
{
if
(
!!
association
&&
(
!
association
.
options
.
as
||
(
association
.
options
.
as
===
include
.
as
)))
{
include
.
association
=
association
include
.
association
=
association
if
(
include
.
hasOwnProperty
(
'include'
))
{
include
.
include
=
include
.
include
.
map
(
function
(
childInclude
)
{
return
validateIncludedElement
.
call
(
this
,
childInclude
,
include
.
daoFactory
)
}.
bind
(
this
))
}
return
include
return
include
}
else
{
}
else
{
var
msg
=
include
.
daoFactory
.
name
var
msg
=
include
.
daoFactory
.
name
...
...
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