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 83e08fce
authored
Dec 04, 2012
by
Jisoo Park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reuse existing DAO.identifiers
1 parent
c7bee173
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
lib/dialects/abstract/query.js
lib/utils.js
lib/dialects/abstract/query.js
View file @
83e08fc
...
@@ -284,14 +284,14 @@ module.exports = (function() {
...
@@ -284,14 +284,14 @@ module.exports = (function() {
associationData
.
forEach
(
function
(
data
)
{
associationData
.
forEach
(
function
(
data
)
{
var
daoInstance
=
associatedDaoFactory
.
build
(
data
,
{
isNewRecord
:
false
})
var
daoInstance
=
associatedDaoFactory
.
build
(
data
,
{
isNewRecord
:
false
})
,
i
dentifier
=
associatedDaoFactory
.
hasPrimaryKeys
?
Utils
.
firstKeyOfHash
(
associatedDaoFactory
.
primaryKeys
)
:
'id'
,
i
sEmpty
=
!
Utils
.
firstValueOfHash
(
daoInstance
.
identifiers
)
if
([
'BelongsTo'
,
'HasOne'
].
indexOf
(
association
.
associationType
)
>
-
1
)
{
if
([
'BelongsTo'
,
'HasOne'
].
indexOf
(
association
.
associationType
)
>
-
1
)
{
accessor
=
Utils
.
singularize
(
accessor
)
accessor
=
Utils
.
singularize
(
accessor
)
dao
[
accessor
]
=
daoInstance
[
identifier
]
?
daoInstance
:
null
dao
[
accessor
]
=
isEmpty
?
null
:
daoInstance
}
else
{
}
else
{
dao
[
accessor
]
=
dao
[
accessor
]
||
[]
dao
[
accessor
]
=
dao
[
accessor
]
||
[]
if
(
daoInstance
[
identifier
]
)
if
(
!
isEmpty
)
dao
[
accessor
].
push
(
daoInstance
)
dao
[
accessor
].
push
(
daoInstance
)
}
}
})
})
...
...
lib/utils.js
View file @
83e08fc
...
@@ -149,10 +149,10 @@ var Utils = module.exports = {
...
@@ -149,10 +149,10 @@ var Utils = module.exports = {
}
}
},
},
first
Key
OfHash
:
function
(
obj
)
{
first
Value
OfHash
:
function
(
obj
)
{
for
(
var
key
in
obj
)
{
for
(
var
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
))
if
(
obj
.
hasOwnProperty
(
key
))
return
key
return
obj
[
key
]
}
}
return
null
return
null
},
},
...
...
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