Cart
class Cart extends Cart
Constants
TABLE_MAP |
TableMap class name |
Methods
Returns whether the object has ever been saved. This will be false, if the object was retrieved from storage or was created and then saved.
Setter for the isNew attribute. This method will be called by Propel-generated children and objects.
Sets the modified state for the object to be false.
Compares this with another Cart
instance. If
obj
is an instance of Cart
, delegates to
equals(Cart)
. Otherwise, returns false
.
If the primary key is not null, return the hashcode of the primary key. Otherwise, return the hash code of the object.
Checks the existence of a virtual column in this object
Set the value of a virtual column in this object
Populate the current object from a string, using a given parser format
$book = new Book();
$book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
Export the current object properties to a string, using a given parser format
$book = BookQuery::create()->findPk(9012);
echo $book->exportTo('JSON');
=> {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
Clean up internal collections prior to serializing Avoids recursive loops that turn into segmentation faults when serializing
Get the [optionally formatted] temporal [created_at] column value.
Get the [optionally formatted] temporal [updated_at] column value.
Sets the value of [created_at] column to a normalized version of the date/time value specified.
Sets the value of [updated_at] column to a normalized version of the date/time value specified.
Indicates whether the columns in this object are only set to default values.
Hydrates (populates) the object variables with values from the database resultset.
Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
Removes this object from datastore and sets delete attribute.
Retrieves a field from the object by name passed in as a string.
Retrieves a field from the object by Position as specified in the xml schema.
Exports the object as an array.
Sets a field from the object by name passed in as a string.
Sets a field from the object by Position as specified in the xml schema.
Populates the object using an array.
Build a Criteria object containing the values of all modified columns in this object.
Builds a Criteria object containing the primary key for this object.
Sets contents of passed object to values from current object.
Makes a copy of this object that will be inserted as a new row in table when saved.
Declares an association between this object and a ChildCustomer object.
Get the associated ChildCustomer object
Declares an association between this object and a ChildAddress object.
Get the associated ChildAddress object
Declares an association between this object and a ChildAddress object.
Get the associated ChildAddress object
Declares an association between this object and a ChildCurrency object.
Get the associated ChildCurrency object
Initializes a collection based on the name of a relation.
Initializes the collCartItems collection.
Gets an array of ChildCartItem objects which contain a foreign key that references this object.
Sets a collection of CartItem objects related by a one-to-many relationship to the current object.
Returns the number of related CartItem objects.
Method called to associate a ChildCartItem object to this object through the ChildCartItem foreign key attribute.
If this collection has already been initialized with an identical criteria, it returns the collection.
If this collection has already been initialized with an identical criteria, it returns the collection.
Resets all references to other model objects or collections of model objects.
Mark the current object so that the update date doesn't get updated during next save
Code to be run before persisting the object
Code to be run before inserting to database
Code to be run before updating the object in database
Code to be run after updating the object in database
Code to be run before deleting the object in database
Code to be run after deleting the object in database
Derived method to catches calls to undefined methods.
Duplicate the current existing cart. Only the token is changed
Retrieve the last item added in the cart
Retrieve the total taxed amount.
No description
Return the VAT of all items
Retrieve the total weight for all products in cart
Tell if the cart contains only virtual products
Details
in
Cart at line 167
applyDefaultValues()
Applies default values to this object.
This method should be called from the object's constructor (or equivalent initialization method).
in
Cart at line 176
__construct()
Initializes internal state of Thelia\Model\Base\Cart object.
in
Cart at line 186
boolean
isModified()
Returns whether the object has been modified.
in
Cart at line 197
boolean
isColumnModified(
string $col)
Has specified column been modified?
in
Cart at line 206
array
getModifiedColumns()
Get the columns that have been modified in this object.
in
Cart at line 218
boolean
isNew()
Returns whether the object has ever been saved. This will be false, if the object was retrieved from storage or was created and then saved.
in
Cart at line 229
setNew(
boolean $b)
Setter for the isNew attribute. This method will be called by Propel-generated children and objects.
in
Cart at line 238
boolean
isDeleted()
Whether this object has been deleted.
in
Cart at line 248
void
setDeleted(
boolean $b)
Specify whether this object has been deleted.
in
Cart at line 258
void
resetModified(
string $col = null)
Sets the modified state for the object to be false.
in
Cart at line 277
boolean
equals(
mixed $obj)
Compares this with another Cart
instance. If
obj
is an instance of Cart
, delegates to
equals(Cart)
. Otherwise, returns false
.
in
Cart at line 302
int
hashCode()
If the primary key is not null, return the hashcode of the primary key. Otherwise, return the hash code of the object.
in
Cart at line 316
array
getVirtualColumns()
Get the associative array of the virtual columns in this object
in
Cart at line 327
boolean
hasVirtualColumn(
string $name)
Checks the existence of a virtual column in this object
in
Cart at line 340
mixed
getVirtualColumn(
string $name)
Get the value of a virtual column in this object
in
Cart at line 357
Cart
setVirtualColumn(
string $name,
mixed $value)
Set the value of a virtual column in this object
in
Cart at line 389
Cart
importFrom(
mixed $parser,
string $data)
Populate the current object from a string, using a given parser format
$book = new Book();
$book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
in
Cart at line 412
string
exportTo(
mixed $parser,
boolean $includeLazyLoadColumns = true)
Export the current object properties to a string, using a given parser format
$book = BookQuery::create()->findPk(9012);
echo $book->exportTo('JSON');
=> {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
in
Cart at line 425
__sleep()
Clean up internal collections prior to serializing Avoids recursive loops that turn into segmentation faults when serializing
in
Cart at line 437
int
getId()
Get the [id] column value.
in
Cart at line 448
string
getToken()
Get the [token] column value.
in
Cart at line 459
int
getCustomerId()
Get the [customer_id] column value.
in
Cart at line 470
int
getAddressDeliveryId()
Get the [addressdeliveryid] column value.
in
Cart at line 481
int
getAddressInvoiceId()
Get the [addressinvoiceid] column value.
in
Cart at line 492
int
getCurrencyId()
Get the [currency_id] column value.
in
Cart at line 503
string
getDiscount()
Get the [discount] column value.
in
Cart at line 520
mixed
getCreatedAt(
string $format = NULL)
Get the [optionally formatted] temporal [created_at] column value.
in
Cart at line 540
mixed
getUpdatedAt(
string $format = NULL)
Get the [optionally formatted] temporal [updated_at] column value.
in
Cart at line 719
Cart
setCreatedAt(
mixed $v)
Sets the value of [created_at] column to a normalized version of the date/time value specified.
in
Cart at line 740
Cart
setUpdatedAt(
mixed $v)
Sets the value of [updated_at] column to a normalized version of the date/time value specified.
in
Cart at line 762
boolean
hasOnlyDefaultValues()
Indicates whether the columns in this object are only set to default values.
This method can be used in conjunction with isModified() to indicate whether an object is both modified and has some values set which are non-default.
in
Cart at line 790
int
hydrate(
array $row,
int $startcol,
boolean $rehydrate = false,
string $indexType = TableMap::TYPE_NUM)
Hydrates (populates) the object variables with values from the database resultset.
An offset (0-based "start column") is specified so that objects can be hydrated with a subset of the columns in the resultset rows. This is needed, for example, for results of JOIN queries where the resultset row includes columns from two or more tables.
in
Cart at line 855
ensureConsistency()
Checks and repairs the internal consistency of the object.
This method is executed after an already-instantiated object is re-hydrated from the database. It exists to check any foreign keys to make sure that the objects related to the current object are correct based on foreign key.
You can override this method in the stub class, but you should always invoke the base method from the overridden method (i.e. parent::ensureConsistency()), in case your model changes.
in
Cart at line 881
void
reload(
boolean $deep = false,
ConnectionInterface $con = null)
Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
This will only work if the object has been saved and has a valid primary key set.
in
Cart at line 926
void
delete(
ConnectionInterface $con = null)
Removes this object from datastore and sets delete attribute.
in
Cart at line 968
int
save(
ConnectionInterface $con = null)
Persists this object to the database.
If the object is new, it inserts it; otherwise an update is performed. All modified related objects will also be persisted in the doSave() method. This method wraps all precipitate database operations in a single transaction.
in
Cart at line 1232
mixed
getByName(
string $name,
string $type = TableMap::TYPE_PHPNAME)
Retrieves a field from the object by name passed in as a string.
in
Cart at line 1247
mixed
getByPosition(
int $pos)
Retrieves a field from the object by Position as specified in the xml schema.
Zero-based.
in
Cart at line 1298
array
toArray(
string $keyType = TableMap::TYPE_PHPNAME,
boolean $includeLazyLoadColumns = true,
array $alreadyDumpedObjects = array(),
boolean $includeForeignObjects = false)
Exports the object as an array.
You can specify the key type of the array by passing one of the class type constants.
in
Cart at line 1353
void
setByName(
string $name,
mixed $value,
string $type = TableMap::TYPE_PHPNAME)
Sets a field from the object by name passed in as a string.
in
Cart at line 1368
void
setByPosition(
int $pos,
mixed $value)
Sets a field from the object by Position as specified in the xml schema.
Zero-based.
in
Cart at line 1418
void
fromArray(
array $arr,
string $keyType = TableMap::TYPE_PHPNAME)
Populates the object using an array.
This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column.
You can specify the key type of the array by additionally passing one of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME, TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPENUM. The default key type is the column's TableMap::TYPEPHPNAME.
in
Cart at line 1438
Criteria
buildCriteria()
Build a Criteria object containing the values of all modified columns in this object.
in
Cart at line 1463
Criteria
buildPkeyCriteria()
Builds a Criteria object containing the primary key for this object.
Unlike buildCriteria() this method includes the primary key values regardless of whether or not they have been modified.
in
Cart at line 1475
int
getPrimaryKey()
Returns the primary key for this object (row).
in
Cart at line 1486
void
setPrimaryKey(
int $key)
Generic method to set the primary key (id column).
in
Cart at line 1495
boolean
isPrimaryKeyNull()
Returns true if the primary key for this object is null.
in
Cart at line 1512
copyInto(
object $copyObj,
boolean $deepCopy = false,
boolean $makeNew = true)
Sets contents of passed object to values from current object.
If desired, this method can also make copies of all associated (fkey referrers) objects.
in
Cart at line 1554
Cart
copy(
boolean $deepCopy = false)
Makes a copy of this object that will be inserted as a new row in table when saved.
It creates a new object filling in the simple attributes, but skipping any primary keys that are defined for the table.
If desired, this method can also make copies of all associated (fkey referrers) objects.
in
Cart at line 1571
Cart
setCustomer(
Customer $v = null)
Declares an association between this object and a ChildCustomer object.
in
Cart at line 1599
Customer
getCustomer(
ConnectionInterface $con = null)
Get the associated ChildCustomer object
in
Cart at line 1622
Cart
setAddressRelatedByAddressDeliveryId(
Address $v = null)
Declares an association between this object and a ChildAddress object.
in
Cart at line 1650
Address
getAddressRelatedByAddressDeliveryId(
ConnectionInterface $con = null)
Get the associated ChildAddress object
in
Cart at line 1673
Cart
setAddressRelatedByAddressInvoiceId(
Address $v = null)
Declares an association between this object and a ChildAddress object.
in
Cart at line 1701
Address
getAddressRelatedByAddressInvoiceId(
ConnectionInterface $con = null)
Get the associated ChildAddress object
in
Cart at line 1724
Cart
setCurrency(
Currency $v = null)
Declares an association between this object and a ChildCurrency object.
in
Cart at line 1752
Currency
getCurrency(
ConnectionInterface $con = null)
Get the associated ChildCurrency object
in
Cart at line 1777
void
initRelation(
string $relationName)
Initializes a collection based on the name of a relation.
Avoids crafting an 'init[$relationName]s' method name that wouldn't work when StandardEnglishPluralizer is used.
in
Cart at line 1793
void
clearCartItems()
Clears out the collCartItems collection
This does not modify the database; however, it will remove any associated objects, causing them to be refetched by subsequent calls to accessor method.
in
Cart at line 1801
resetPartialCartItems($v = true)
Reset is the collCartItems collection loaded partially.
in
Cart at line 1818
void
initCartItems(
boolean $overrideExisting = true)
Initializes the collCartItems collection.
By default this just sets the collCartItems collection to an empty array (like clearcollCartItems()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database.
in
Cart at line 1841
Collection|CartItem[]
getCartItems(
Criteria $criteria = null,
ConnectionInterface $con = null)
Gets an array of ChildCartItem objects which contain a foreign key that references this object.
If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this ChildCart is new, it will return an empty collection or the current collection; the criteria is ignored on a new object.
in
Cart at line 1897
Cart
setCartItems(
Collection $cartItems,
ConnectionInterface $con = null)
Sets a collection of CartItem objects related by a one-to-many relationship to the current object.
It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection.
in
Cart at line 1928
int
countCartItems(
Criteria $criteria = null,
boolean $distinct = false,
ConnectionInterface $con = null)
Returns the number of related CartItem objects.
in
Cart at line 1960
Cart
addCartItem(
CartItem $l)
Method called to associate a ChildCartItem object to this object through the ChildCartItem foreign key attribute.
in
Cart at line 2019
Collection|CartItem[]
getCartItemsJoinProduct(
Criteria $criteria = null,
ConnectionInterface $con = null,
string $joinBehavior = Criteria::LEFT_JOIN)
If this collection has already been initialized with an identical criteria, it returns the collection.
Otherwise if this Cart is new, it will return an empty collection; or if this Cart has previously been saved, it will retrieve related CartItems from storage.
This method is protected by default in order to keep the public api reasonable. You can provide public methods for those you actually need in Cart.
in
Cart at line 2044
Collection|CartItem[]
getCartItemsJoinProductSaleElements(
Criteria $criteria = null,
ConnectionInterface $con = null,
string $joinBehavior = Criteria::LEFT_JOIN)
If this collection has already been initialized with an identical criteria, it returns the collection.
Otherwise if this Cart is new, it will return an empty collection; or if this Cart has previously been saved, it will retrieve related CartItems from storage.
This method is protected by default in order to keep the public api reasonable. You can provide public methods for those you actually need in Cart.
in
Cart at line 2055
clear()
Clears the current object and sets all attributes to their default values
in
Cart at line 2083
clearAllReferences(
boolean $deep = false)
Resets all references to other model objects or collections of model objects.
This method is a user-space workaround for PHP's inability to garbage collect objects with circular references (even in PHP 5.3). This is currently necessary when using Propel in certain daemon or large-volume/high-memory operations.
in
Cart at line 2105
string
__toString()
Return the string representation of this object
in
Cart at line 2117
Cart
keepUpdateDateUnchanged()
Mark the current object so that the update date doesn't get updated during next save
in
Cart at line 2129
boolean
preSave(
ConnectionInterface $con = null)
Code to be run before persisting the object
in
Cart at line 2138
postSave(
ConnectionInterface $con = null)
Code to be run after persisting the object
in
Cart at line 2148
boolean
preInsert(
ConnectionInterface $con = null)
Code to be run before inserting to database
in
Cart at line 2157
postInsert(
ConnectionInterface $con = null)
Code to be run after inserting to database
in
Cart at line 2167
boolean
preUpdate(
ConnectionInterface $con = null)
Code to be run before updating the object in database
in
Cart at line 2176
postUpdate(
ConnectionInterface $con = null)
Code to be run after updating the object in database
in
Cart at line 2186
boolean
preDelete(
ConnectionInterface $con = null)
Code to be run before deleting the object in database
in
Cart at line 2195
postDelete(
ConnectionInterface $con = null)
Code to be run after deleting the object in database
in
Cart at line 2212
array|string
__call(
string $name,
mixed $params)
Derived method to catches calls to undefined methods.
Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). Allows to define default __call() behavior if you overwrite __call()
at line 25
Cart
duplicate(
string $token,
Customer $customer = null,
Currency $currency = null,
EventDispatcherInterface $dispatcher = null)
Duplicate the current existing cart. Only the token is changed
at line 96
CartItem
getLastCartItemAdded()
Retrieve the last item added in the cart
at line 117
float|int
getTaxedAmount(
Country $country, $discount = true,
State $state = null)
Retrieve the total taxed amount.
By default, the total include the discount
/!\ The postage amount is not available so it's the total with or without discount an without postage
at line 141
float|int
getTotalAmount(
bool $discount = true)
at line 163
float|int
getTotalVAT($taxCountry, $taxState = null)
Return the VAT of all items
at line 173
float|int
getWeight()
Retrieve the total weight for all products in cart
at line 192
bool
isVirtual()
Tell if the cart contains only virtual products