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
0f2499f9
Commit
0f2499f9
authored
Jul 02, 2009
by
piccoloprincipe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] added Collection object creation
parent
76661cd9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
ECommerceCart.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
+14
-1
ECommerceCustomer.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php
+0
-5
ECommerceProduct.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
+11
-4
No files found.
tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
View file @
0f2499f9
...
...
@@ -20,7 +20,7 @@ class ECommerceCart
private
$id
;
/**
* @Column(type="string", length=50)
* @Column(type="string", length=50
, nullable=true
)
*/
private
$payment
;
...
...
@@ -37,6 +37,11 @@ class ECommerceCart
inverseJoinColumns={{"name"="product_id", "referencedColumnName"="id"}})
*/
private
$products
;
public
function
__construct
()
{
$this
->
products
=
new
\Doctrine\Common\Collections\Collection
;
}
public
function
getId
()
{
return
$this
->
id
;
...
...
@@ -69,4 +74,12 @@ class ECommerceCart
return
$this
->
customer
;
}
public
function
getProducts
()
{
return
$this
->
products
;
}
public
function
addProduct
(
ECommerceProduct
$product
)
{
$this
->
products
[]
=
$product
;
}
}
tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php
View file @
0f2499f9
...
...
@@ -41,11 +41,6 @@ class ECommerceCustomer
$this
->
name
=
$name
;
}
/**
* @OneToMany(targetEntity="ECommerceProduct")
public $watched;
*/
public
function
setCart
(
ECommerceCart
$cart
)
{
if
(
$this
->
cart
!==
$cart
)
{
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
View file @
0f2499f9
...
...
@@ -43,6 +43,11 @@ class ECommerceProduct
private $categories;
*/
public
function
__construct
()
{
$this
->
features
=
new
\Doctrine\Common\Collections\Collection
;
}
public
function
getId
()
{
return
$this
->
id
;
...
...
@@ -89,10 +94,12 @@ class ECommerceProduct
}
public
function
removeFeature
(
ECommerceFeature
$feature
)
{
$removed
=
$this
->
features
->
removeElement
(
$feature
);
if
(
$removed
!==
null
)
{
$removed
->
removeProduct
();
return
true
;
if
(
$this
->
features
->
contains
(
$feature
))
{
$removed
=
$this
->
features
->
removeElement
(
$feature
);
if
(
$removed
)
{
$feature
->
removeProduct
();
return
true
;
}
}
return
false
;
}
...
...
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