Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
1d5bdee6
Commit
1d5bdee6
authored
Nov 06, 2006
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rolling back r587, reopening #146 - this breaks creating new objects.
parent
d4668307
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
Record.php
lib/Doctrine/Record.php
+3
-2
Table.php
lib/Doctrine/Table.php
+15
-1
No files found.
lib/Doctrine/Record.php
View file @
1d5bdee6
...
@@ -126,13 +126,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -126,13 +126,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* open connections
* open connections
* @throws Doctrine_Record_Exception if the cleanData operation fails somehow
* @throws Doctrine_Record_Exception if the cleanData operation fails somehow
*/
*/
public
function
__construct
(
$table
=
null
,
$isNewEntry
=
false
)
{
public
function
__construct
(
$table
=
null
)
{
if
(
isset
(
$table
)
&&
$table
instanceof
Doctrine_Table
)
{
if
(
isset
(
$table
)
&&
$table
instanceof
Doctrine_Table
)
{
$this
->
_table
=
$table
;
$this
->
_table
=
$table
;
$exists
=
(
!
$this
->
_table
->
isNewEntry
());
}
else
{
}
else
{
$this
->
_table
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnection
()
->
getTable
(
get_class
(
$this
));
$this
->
_table
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnection
()
->
getTable
(
get_class
(
$this
));
$exists
=
false
;
}
}
$exists
=
!
$isNewEntry
;
// Check if the current connection has the records table in its registry
// Check if the current connection has the records table in its registry
// If not this record is only used for creating table definition and setting up
// If not this record is only used for creating table definition and setting up
...
...
lib/Doctrine/Table.php
View file @
1d5bdee6
...
@@ -31,6 +31,10 @@
...
@@ -31,6 +31,10 @@
* @version 1.0 alpha
* @version 1.0 alpha
*/
*/
class
Doctrine_Table
extends
Doctrine_Configurable
implements
Countable
{
class
Doctrine_Table
extends
Doctrine_Configurable
implements
Countable
{
/**
* @var boolean $isNewEntry whether ot not this table created a new record or not, used only internally
*/
private
$isNewEntry
=
false
;
/**
/**
* @var array $data temporary data which is then loaded into Doctrine_Record::$data
* @var array $data temporary data which is then loaded into Doctrine_Record::$data
*/
*/
...
@@ -757,7 +761,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -757,7 +761,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
*/
public
function
create
(
array
$array
=
array
())
{
public
function
create
(
array
$array
=
array
())
{
$this
->
data
=
$array
;
$this
->
data
=
$array
;
$record
=
new
$this
->
options
[
'name'
](
$this
,
true
);
$this
->
isNewEntry
=
true
;
$record
=
new
$this
->
options
[
'name'
](
$this
);
$this
->
isNewEntry
=
false
;
$this
->
data
=
array
();
$this
->
data
=
array
();
return
$record
;
return
$record
;
}
}
...
@@ -1102,6 +1108,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -1102,6 +1108,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
isset
(
$data
[
0
])
?
$data
[
0
]
:
1
;
return
isset
(
$data
[
0
])
?
$data
[
0
]
:
1
;
}
}
/**
* return whether or not a newly created object is new or not
*
* @return boolean
*/
final
public
function
isNewEntry
()
{
return
$this
->
isNewEntry
;
}
/**
/**
* returns simple cached query
* returns simple cached query
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment