- * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
- * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ * $query->filterByName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
*
*
- * @param string $title The value to use as filter.
+ * @param string $name The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAddressQuery The current query, for fluid interface
*/
- public function filterByTitle($title = null, $comparison = null)
+ public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
- if (is_array($title)) {
+ if (is_array($name)) {
$comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $title)) {
- $title = str_replace('*', '%', $title);
+ } elseif (preg_match('/[\%\*]/', $name)) {
+ $name = str_replace('*', '%', $name);
$comparison = Criteria::LIKE;
}
}
- return $this->addUsingAlias(AddressTableMap::TITLE, $title, $comparison);
+ return $this->addUsingAlias(AddressTableMap::NAME, $name, $comparison);
}
/**
@@ -410,18 +414,18 @@ abstract class AddressQuery extends ModelCriteria
}
/**
- * Filter the query on the customer_title_id column
+ * Filter the query on the title_id column
*
* Example usage:
*
- * $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
- * $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
- * $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
+ * $query->filterByTitleId(1234); // WHERE title_id = 1234
+ * $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
+ * $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
*
*
* @see filterByCustomerTitle()
*
- * @param mixed $customerTitleId The value to use as filter.
+ * @param mixed $titleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -429,16 +433,16 @@ abstract class AddressQuery extends ModelCriteria
*
* @return ChildAddressQuery The current query, for fluid interface
*/
- public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
+ public function filterByTitleId($titleId = null, $comparison = null)
{
- if (is_array($customerTitleId)) {
+ if (is_array($titleId)) {
$useMinMax = false;
- if (isset($customerTitleId['min'])) {
- $this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
+ if (isset($titleId['min'])) {
+ $this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
- if (isset($customerTitleId['max'])) {
- $this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
+ if (isset($titleId['max'])) {
+ $this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -449,7 +453,7 @@ abstract class AddressQuery extends ModelCriteria
}
}
- return $this->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
+ return $this->addUsingAlias(AddressTableMap::TITLE_ID, $titleId, $comparison);
}
/**
@@ -694,6 +698,8 @@ abstract class AddressQuery extends ModelCriteria
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
*
*
+ * @see filterByCountry()
+ *
* @param mixed $countryId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
@@ -997,14 +1003,14 @@ abstract class AddressQuery extends ModelCriteria
{
if ($customerTitle instanceof \Thelia\Model\CustomerTitle) {
return $this
- ->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
+ ->addUsingAlias(AddressTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
} elseif ($customerTitle instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
- ->addUsingAlias(AddressTableMap::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ ->addUsingAlias(AddressTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \Thelia\Model\CustomerTitle or Collection');
}
@@ -1018,7 +1024,7 @@ abstract class AddressQuery extends ModelCriteria
*
* @return ChildAddressQuery The current query, for fluid interface
*/
- public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CustomerTitle');
@@ -1053,13 +1059,88 @@ abstract class AddressQuery extends ModelCriteria
*
* @return \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
*/
- public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCustomerTitle($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
}
+ /**
+ * Filter the query by a related \Thelia\Model\Country object
+ *
+ * @param \Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAddressQuery The current query, for fluid interface
+ */
+ public function filterByCountry($country, $comparison = null)
+ {
+ if ($country instanceof \Thelia\Model\Country) {
+ return $this
+ ->addUsingAlias(AddressTableMap::COUNTRY_ID, $country->getId(), $comparison);
+ } elseif ($country instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(AddressTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByCountry() only accepts arguments of type \Thelia\Model\Country or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Country relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildAddressQuery The current query, for fluid interface
+ */
+ public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Country');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Country');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Country relation Country object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
+ */
+ public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCountry($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
+ }
+
/**
* Filter the query by a related \Thelia\Model\Cart object
*
diff --git a/core/lib/Thelia/Model/Base/Country.php b/core/lib/Thelia/Model/Base/Country.php
index 4d21c09c2..704375de2 100755
--- a/core/lib/Thelia/Model/Base/Country.php
+++ b/core/lib/Thelia/Model/Base/Country.php
@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
+use Thelia\Model\Address as ChildAddress;
+use Thelia\Model\AddressQuery as ChildAddressQuery;
use Thelia\Model\Area as ChildArea;
use Thelia\Model\AreaQuery as ChildAreaQuery;
use Thelia\Model\Country as ChildCountry;
@@ -114,6 +116,12 @@ abstract class Country implements ActiveRecordInterface
protected $collTaxRuleCountries;
protected $collTaxRuleCountriesPartial;
+ /**
+ * @var ObjectCollection|ChildAddress[] Collection to store aggregation of ChildAddress objects.
+ */
+ protected $collAddresses;
+ protected $collAddressesPartial;
+
/**
* @var ObjectCollection|ChildCountryI18n[] Collection to store aggregation of ChildCountryI18n objects.
*/
@@ -148,6 +156,12 @@ abstract class Country implements ActiveRecordInterface
*/
protected $taxRuleCountriesScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var ObjectCollection
+ */
+ protected $addressesScheduledForDeletion = null;
+
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -792,6 +806,8 @@ abstract class Country implements ActiveRecordInterface
$this->aArea = null;
$this->collTaxRuleCountries = null;
+ $this->collAddresses = null;
+
$this->collCountryI18ns = null;
} // if (deep)
@@ -956,6 +972,23 @@ abstract class Country implements ActiveRecordInterface
}
}
+ if ($this->addressesScheduledForDeletion !== null) {
+ if (!$this->addressesScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\AddressQuery::create()
+ ->filterByPrimaryKeys($this->addressesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->addressesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collAddresses !== null) {
+ foreach ($this->collAddresses as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
if ($this->countryI18nsScheduledForDeletion !== null) {
if (!$this->countryI18nsScheduledForDeletion->isEmpty()) {
\Thelia\Model\CountryI18nQuery::create()
@@ -1174,6 +1207,9 @@ abstract class Country implements ActiveRecordInterface
if (null !== $this->collTaxRuleCountries) {
$result['TaxRuleCountries'] = $this->collTaxRuleCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collAddresses) {
+ $result['Addresses'] = $this->collAddresses->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
if (null !== $this->collCountryI18ns) {
$result['CountryI18ns'] = $this->collCountryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1363,6 +1399,12 @@ abstract class Country implements ActiveRecordInterface
}
}
+ foreach ($this->getAddresses() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addAddress($relObj->copy($deepCopy));
+ }
+ }
+
foreach ($this->getCountryI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCountryI18n($relObj->copy($deepCopy));
@@ -1463,6 +1505,9 @@ abstract class Country implements ActiveRecordInterface
if ('TaxRuleCountry' == $relationName) {
return $this->initTaxRuleCountries();
}
+ if ('Address' == $relationName) {
+ return $this->initAddresses();
+ }
if ('CountryI18n' == $relationName) {
return $this->initCountryI18ns();
}
@@ -1736,6 +1781,274 @@ abstract class Country implements ActiveRecordInterface
return $this->getTaxRuleCountries($query, $con);
}
+ /**
+ * Clears out the collAddresses 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.
+ *
+ * @return void
+ * @see addAddresses()
+ */
+ public function clearAddresses()
+ {
+ $this->collAddresses = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collAddresses collection loaded partially.
+ */
+ public function resetPartialAddresses($v = true)
+ {
+ $this->collAddressesPartial = $v;
+ }
+
+ /**
+ * Initializes the collAddresses collection.
+ *
+ * By default this just sets the collAddresses collection to an empty array (like clearcollAddresses());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initAddresses($overrideExisting = true)
+ {
+ if (null !== $this->collAddresses && !$overrideExisting) {
+ return;
+ }
+ $this->collAddresses = new ObjectCollection();
+ $this->collAddresses->setModel('\Thelia\Model\Address');
+ }
+
+ /**
+ * Gets an array of ChildAddress 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 ChildCountry is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildAddress[] List of ChildAddress objects
+ * @throws PropelException
+ */
+ public function getAddresses($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collAddressesPartial && !$this->isNew();
+ if (null === $this->collAddresses || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAddresses) {
+ // return empty collection
+ $this->initAddresses();
+ } else {
+ $collAddresses = ChildAddressQuery::create(null, $criteria)
+ ->filterByCountry($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collAddressesPartial && count($collAddresses)) {
+ $this->initAddresses(false);
+
+ foreach ($collAddresses as $obj) {
+ if (false == $this->collAddresses->contains($obj)) {
+ $this->collAddresses->append($obj);
+ }
+ }
+
+ $this->collAddressesPartial = true;
+ }
+
+ $collAddresses->getInternalIterator()->rewind();
+
+ return $collAddresses;
+ }
+
+ if ($partial && $this->collAddresses) {
+ foreach ($this->collAddresses as $obj) {
+ if ($obj->isNew()) {
+ $collAddresses[] = $obj;
+ }
+ }
+ }
+
+ $this->collAddresses = $collAddresses;
+ $this->collAddressesPartial = false;
+ }
+ }
+
+ return $this->collAddresses;
+ }
+
+ /**
+ * Sets a collection of Address 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.
+ *
+ * @param Collection $addresses A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildCountry The current object (for fluent API support)
+ */
+ public function setAddresses(Collection $addresses, ConnectionInterface $con = null)
+ {
+ $addressesToDelete = $this->getAddresses(new Criteria(), $con)->diff($addresses);
+
+
+ $this->addressesScheduledForDeletion = $addressesToDelete;
+
+ foreach ($addressesToDelete as $addressRemoved) {
+ $addressRemoved->setCountry(null);
+ }
+
+ $this->collAddresses = null;
+ foreach ($addresses as $address) {
+ $this->addAddress($address);
+ }
+
+ $this->collAddresses = $addresses;
+ $this->collAddressesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related Address objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related Address objects.
+ * @throws PropelException
+ */
+ public function countAddresses(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collAddressesPartial && !$this->isNew();
+ if (null === $this->collAddresses || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAddresses) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getAddresses());
+ }
+
+ $query = ChildAddressQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCountry($this)
+ ->count($con);
+ }
+
+ return count($this->collAddresses);
+ }
+
+ /**
+ * Method called to associate a ChildAddress object to this object
+ * through the ChildAddress foreign key attribute.
+ *
+ * @param ChildAddress $l ChildAddress
+ * @return \Thelia\Model\Country The current object (for fluent API support)
+ */
+ public function addAddress(ChildAddress $l)
+ {
+ if ($this->collAddresses === null) {
+ $this->initAddresses();
+ $this->collAddressesPartial = true;
+ }
+
+ if (!in_array($l, $this->collAddresses->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddAddress($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param Address $address The address object to add.
+ */
+ protected function doAddAddress($address)
+ {
+ $this->collAddresses[]= $address;
+ $address->setCountry($this);
+ }
+
+ /**
+ * @param Address $address The address object to remove.
+ * @return ChildCountry The current object (for fluent API support)
+ */
+ public function removeAddress($address)
+ {
+ if ($this->getAddresses()->contains($address)) {
+ $this->collAddresses->remove($this->collAddresses->search($address));
+ if (null === $this->addressesScheduledForDeletion) {
+ $this->addressesScheduledForDeletion = clone $this->collAddresses;
+ $this->addressesScheduledForDeletion->clear();
+ }
+ $this->addressesScheduledForDeletion[]= clone $address;
+ $address->setCountry(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Country is new, it will return
+ * an empty collection; or if this Country has previously
+ * been saved, it will retrieve related Addresses 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 Country.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildAddress[] List of ChildAddress objects
+ */
+ public function getAddressesJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildAddressQuery::create(null, $criteria);
+ $query->joinWith('Customer', $joinBehavior);
+
+ return $this->getAddresses($query, $con);
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Country is new, it will return
+ * an empty collection; or if this Country has previously
+ * been saved, it will retrieve related Addresses 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 Country.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildAddress[] List of ChildAddress objects
+ */
+ public function getAddressesJoinCustomerTitle($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildAddressQuery::create(null, $criteria);
+ $query->joinWith('CustomerTitle', $joinBehavior);
+
+ return $this->getAddresses($query, $con);
+ }
+
/**
* Clears out the collCountryI18ns collection
*
@@ -1997,6 +2310,11 @@ abstract class Country implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
+ if ($this->collAddresses) {
+ foreach ($this->collAddresses as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
if ($this->collCountryI18ns) {
foreach ($this->collCountryI18ns as $o) {
$o->clearAllReferences($deep);
@@ -2012,6 +2330,10 @@ abstract class Country implements ActiveRecordInterface
$this->collTaxRuleCountries->clearIterator();
}
$this->collTaxRuleCountries = null;
+ if ($this->collAddresses instanceof Collection) {
+ $this->collAddresses->clearIterator();
+ }
+ $this->collAddresses = null;
if ($this->collCountryI18ns instanceof Collection) {
$this->collCountryI18ns->clearIterator();
}
diff --git a/core/lib/Thelia/Model/Base/CountryQuery.php b/core/lib/Thelia/Model/Base/CountryQuery.php
index 04a66530c..6c3a1c950 100755
--- a/core/lib/Thelia/Model/Base/CountryQuery.php
+++ b/core/lib/Thelia/Model/Base/CountryQuery.php
@@ -50,6 +50,10 @@ use Thelia\Model\Map\CountryTableMap;
* @method ChildCountryQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
* @method ChildCountryQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
*
+ * @method ChildCountryQuery leftJoinAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the Address relation
+ * @method ChildCountryQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
+ * @method ChildCountryQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
+ *
* @method ChildCountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
* @method ChildCountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
* @method ChildCountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
@@ -654,6 +658,79 @@ abstract class CountryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
}
+ /**
+ * Filter the query by a related \Thelia\Model\Address object
+ *
+ * @param \Thelia\Model\Address|ObjectCollection $address the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildCountryQuery The current query, for fluid interface
+ */
+ public function filterByAddress($address, $comparison = null)
+ {
+ if ($address instanceof \Thelia\Model\Address) {
+ return $this
+ ->addUsingAlias(CountryTableMap::ID, $address->getCountryId(), $comparison);
+ } elseif ($address instanceof ObjectCollection) {
+ return $this
+ ->useAddressQuery()
+ ->filterByPrimaryKeys($address->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByAddress() only accepts arguments of type \Thelia\Model\Address or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Address relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildCountryQuery The current query, for fluid interface
+ */
+ public function joinAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Address');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Address');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Address relation Address object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
+ */
+ public function useAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinAddress($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
+ }
+
/**
* Filter the query by a related \Thelia\Model\CountryI18n object
*
diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php
index 295d56920..c3315ac6f 100755
--- a/core/lib/Thelia/Model/Base/Customer.php
+++ b/core/lib/Thelia/Model/Base/Customer.php
@@ -2153,6 +2153,31 @@ abstract class Customer implements ActiveRecordInterface
return $this->getAddresses($query, $con);
}
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Customer is new, it will return
+ * an empty collection; or if this Customer has previously
+ * been saved, it will retrieve related Addresses 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 Customer.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildAddress[] List of ChildAddress objects
+ */
+ public function getAddressesJoinCountry($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildAddressQuery::create(null, $criteria);
+ $query->joinWith('Country', $joinBehavior);
+
+ return $this->getAddresses($query, $con);
+ }
+
/**
* Clears out the collOrders collection
*
diff --git a/core/lib/Thelia/Model/Base/CustomerTitle.php b/core/lib/Thelia/Model/Base/CustomerTitle.php
index 5d34c95e5..5f8b11dd9 100755
--- a/core/lib/Thelia/Model/Base/CustomerTitle.php
+++ b/core/lib/Thelia/Model/Base/CustomerTitle.php
@@ -883,10 +883,9 @@ abstract class CustomerTitle implements ActiveRecordInterface
if ($this->addressesScheduledForDeletion !== null) {
if (!$this->addressesScheduledForDeletion->isEmpty()) {
- foreach ($this->addressesScheduledForDeletion as $address) {
- // need to save related object because we set the relation to null
- $address->save($con);
- }
+ \Thelia\Model\AddressQuery::create()
+ ->filterByPrimaryKeys($this->addressesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
$this->addressesScheduledForDeletion = null;
}
}
@@ -1777,7 +1776,7 @@ abstract class CustomerTitle implements ActiveRecordInterface
$this->addressesScheduledForDeletion = clone $this->collAddresses;
$this->addressesScheduledForDeletion->clear();
}
- $this->addressesScheduledForDeletion[]= $address;
+ $this->addressesScheduledForDeletion[]= clone $address;
$address->setCustomerTitle(null);
}
@@ -1809,6 +1808,31 @@ abstract class CustomerTitle implements ActiveRecordInterface
return $this->getAddresses($query, $con);
}
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CustomerTitle is new, it will return
+ * an empty collection; or if this CustomerTitle has previously
+ * been saved, it will retrieve related Addresses 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 CustomerTitle.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildAddress[] List of ChildAddress objects
+ */
+ public function getAddressesJoinCountry($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildAddressQuery::create(null, $criteria);
+ $query->joinWith('Country', $joinBehavior);
+
+ return $this->getAddresses($query, $con);
+ }
+
/**
* Clears out the collCustomerTitleI18ns collection
*
diff --git a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
index f3c372248..ea34c8c91 100755
--- a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
+++ b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
@@ -523,7 +523,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
{
if ($address instanceof \Thelia\Model\Address) {
return $this
- ->addUsingAlias(CustomerTitleTableMap::ID, $address->getCustomerTitleId(), $comparison);
+ ->addUsingAlias(CustomerTitleTableMap::ID, $address->getTitleId(), $comparison);
} elseif ($address instanceof ObjectCollection) {
return $this
->useAddressQuery()
@@ -542,7 +542,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
*
* @return ChildCustomerTitleQuery The current query, for fluid interface
*/
- public function joinAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function joinAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Address');
@@ -577,7 +577,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
*
* @return \Thelia\Model\AddressQuery A secondary query class using the current class as primary query
*/
- public function useAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function useAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAddress($relationAlias, $joinType)
diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php
index 2402b3302..dabd6a54e 100755
--- a/core/lib/Thelia/Model/Map/AddressTableMap.php
+++ b/core/lib/Thelia/Model/Map/AddressTableMap.php
@@ -75,9 +75,9 @@ class AddressTableMap extends TableMap
const ID = 'address.ID';
/**
- * the column name for the TITLE field
+ * the column name for the NAME field
*/
- const TITLE = 'address.TITLE';
+ const NAME = 'address.NAME';
/**
* the column name for the CUSTOMER_ID field
@@ -85,9 +85,9 @@ class AddressTableMap extends TableMap
const CUSTOMER_ID = 'address.CUSTOMER_ID';
/**
- * the column name for the CUSTOMER_TITLE_ID field
+ * the column name for the TITLE_ID field
*/
- const CUSTOMER_TITLE_ID = 'address.CUSTOMER_TITLE_ID';
+ const TITLE_ID = 'address.TITLE_ID';
/**
* the column name for the COMPANY field
@@ -171,11 +171,11 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
+ self::TYPE_PHPNAME => array('Id', 'Name', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'name', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::NAME, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'name', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
@@ -186,11 +186,11 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
- self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
+ self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::NAME => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
@@ -211,9 +211,9 @@ class AddressTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
- $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('NAME', 'Name', 'VARCHAR', false, 255, null);
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
- $this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
+ $this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
@@ -222,7 +222,7 @@ class AddressTableMap extends TableMap
$this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', true, 255, null);
$this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null);
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
- $this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
+ $this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
$this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null);
$this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
$this->addColumn('IS_DEFAULT', 'IsDefault', 'TINYINT', false, null, 0);
@@ -236,7 +236,8 @@ class AddressTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
- $this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('CartRelatedByAddressDeliveryId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery_id', ), null, null, 'CartsRelatedByAddressDeliveryId');
$this->addRelation('CartRelatedByAddressInvoiceId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice_id', ), null, null, 'CartsRelatedByAddressInvoiceId');
} // buildRelations()
@@ -393,9 +394,9 @@ class AddressTableMap extends TableMap
{
if (null === $alias) {
$criteria->addSelectColumn(AddressTableMap::ID);
- $criteria->addSelectColumn(AddressTableMap::TITLE);
+ $criteria->addSelectColumn(AddressTableMap::NAME);
$criteria->addSelectColumn(AddressTableMap::CUSTOMER_ID);
- $criteria->addSelectColumn(AddressTableMap::CUSTOMER_TITLE_ID);
+ $criteria->addSelectColumn(AddressTableMap::TITLE_ID);
$criteria->addSelectColumn(AddressTableMap::COMPANY);
$criteria->addSelectColumn(AddressTableMap::FIRSTNAME);
$criteria->addSelectColumn(AddressTableMap::LASTNAME);
@@ -412,9 +413,9 @@ class AddressTableMap extends TableMap
$criteria->addSelectColumn(AddressTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.CUSTOMER_ID');
- $criteria->addSelectColumn($alias . '.CUSTOMER_TITLE_ID');
+ $criteria->addSelectColumn($alias . '.TITLE_ID');
$criteria->addSelectColumn($alias . '.COMPANY');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
diff --git a/core/lib/Thelia/Model/Map/CountryTableMap.php b/core/lib/Thelia/Model/Map/CountryTableMap.php
index 3060da70f..e7c356f08 100755
--- a/core/lib/Thelia/Model/Map/CountryTableMap.php
+++ b/core/lib/Thelia/Model/Map/CountryTableMap.php
@@ -180,6 +180,7 @@ class CountryTableMap extends TableMap
{
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
+ $this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
$this->addRelation('CountryI18n', '\\Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');
} // buildRelations()
diff --git a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
index 44b16fafd..c10ce2500 100755
--- a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
@@ -167,7 +167,7 @@ class CustomerTitleTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'title_id', ), 'RESTRICT', 'RESTRICT', 'Customers');
- $this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
+ $this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'title_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
$this->addRelation('CustomerTitleI18n', '\\Thelia\\Model\\CustomerTitleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CustomerTitleI18ns');
} // buildRelations()
diff --git a/install/insert.sql b/install/insert.sql
index fb6b68ab9..6fe5db6d8 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -22,3 +22,268 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
(3, 'en_US', 'Miss', 'Miss'),
(3, 'fr_FR', 'Mlle', 'Madamemoiselle');
+INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at`) VALUES
+(1, NULL, '4', 'AF', 'AFG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(2, NULL, '710', 'ZA', 'ZAF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(3, NULL, '8', 'AL', 'ALB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(4, NULL, '12', 'DZ', 'DZA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(5, NULL, '276', 'DE', 'DEU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(6, NULL, '20', 'AD', 'AND', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(7, NULL, '24', 'AO', 'AGO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(8, NULL, '28', 'AG', 'ATG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(9, NULL, '682', 'SA', 'SAU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(10, NULL, '32', 'AR', 'ARG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(11, NULL, '51', 'AM', 'ARM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(12, NULL, '36', 'AU', 'AUS', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(13, NULL, '40', 'AT', 'AUT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(14, NULL, '31', 'AZ', 'AZE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(15, NULL, '44', 'BS', 'BHS', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(16, NULL, '48', 'BR', 'BHR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(17, NULL, '50', 'BD', 'BGD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(18, NULL, '52', 'BB', 'BRB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(19, NULL, '585', 'PW', 'PLW', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(20, NULL, '56', 'BE', 'BEL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(21, NULL, '84', 'BL', 'BLZ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(22, NULL, '204', 'BJ', 'BEN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(23, NULL, '64', 'BT', 'BTN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(24, NULL, '112', 'BY', 'BLR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(25, NULL, '104', 'MM', 'MMR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(26, NULL, '68', 'BO', 'BOL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(27, NULL, '70', 'BA', 'BIH', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(28, NULL, '72', 'BW', 'BWA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(29, NULL, '76', 'BR', 'BRA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(30, NULL, '96', 'BN', 'BRN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(31, NULL, '100', 'BG', 'BGR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(32, NULL, '854', 'BF', 'BFA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(33, NULL, '108', 'BI', 'BDI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(34, NULL, '116', 'KH', 'KHM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(35, NULL, '120', 'CM', 'CMR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(37, NULL, '132', 'CV', 'CPV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(38, NULL, '152', 'CL', 'CHL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(39, NULL, '156', 'CN', 'CHN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(40, NULL, '196', 'CY', 'CYP', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(41, NULL, '170', 'CO', 'COL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(42, NULL, '174', 'KM', 'COM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(43, NULL, '178', 'CG', 'COG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(44, NULL, '184', 'CK', 'COK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(45, NULL, '408', 'KP', 'PRK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(46, NULL, '410', 'KR', 'KOR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(47, NULL, '188', 'CR', 'CRI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(48, NULL, '384', 'CI', 'CIV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(49, NULL, '191', 'HR', 'HRV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(50, NULL, '192', 'CU', 'CUB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(51, NULL, '208', 'DK', 'DNK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(52, NULL, '262', 'DJ', 'DJI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(53, NULL, '212', 'DM', 'DMA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(54, NULL, '818', 'EG', 'EGY', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(55, NULL, '784', 'AE', 'ARE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(56, NULL, '218', 'EC', 'ECU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(57, NULL, '232', 'ER', 'ERI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(58, NULL, '724', 'ES', 'ESP', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(59, NULL, '233', 'EE', 'EST', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(61, NULL, '231', 'ET', 'ETH', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(62, NULL, '242', 'FJ', 'FJI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(63, NULL, '246', 'FI', 'FIN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(64, NULL, '250', 'FR', 'FRA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(65, NULL, '266', 'GA', 'GAB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(66, NULL, '270', 'GM', 'GMB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(67, NULL, '268', 'GE', 'GEO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(68, NULL, '288', 'GH', 'GHA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(69, NULL, '300', 'GR', 'GRC', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(70, NULL, '308', 'GD', 'GRD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(71, NULL, '320', 'GT', 'GTM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(72, NULL, '324', 'GN', 'GIN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(73, NULL, '624', 'GW', 'GNB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(74, NULL, '226', 'GQ', 'GNQ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(75, NULL, '328', 'GY', 'GUY', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(76, NULL, '332', 'HT', 'HTI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(77, NULL, '340', 'HN', 'HND', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(78, NULL, '348', 'HU', 'HUN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(79, NULL, '356', 'IN', 'IND', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(80, NULL, '360', 'ID', 'IDN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(81, NULL, '364', 'IR', 'IRN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(82, NULL, '368', 'IQ', 'IRQ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(83, NULL, '372', 'IE', 'IRL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(84, NULL, '352', 'IS', 'ISL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(85, NULL, '376', 'IL', 'ISR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(86, NULL, '380', 'IT', 'ITA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(87, NULL, '388', 'JM', 'JAM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(88, NULL, '392', 'JP', 'JPN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(89, NULL, '400', 'JO', 'JOR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(90, NULL, '398', 'KZ', 'KAZ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(91, NULL, '404', 'KE', 'KEN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(92, NULL, '417', 'KG', 'KGZ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(93, NULL, '296', 'KI', 'KIR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(94, NULL, '414', 'KW', 'KWT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(95, NULL, '418', 'LA', 'LAO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(96, NULL, '426', 'LS', 'LSO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(97, NULL, '428', 'LV', 'LVA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(98, NULL, '422', 'LB', 'LBN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(99, NULL, '430', 'LR', 'LBR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(100, NULL, '343', 'LY', 'LBY', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(101, NULL, '438', 'LI', 'LIE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(102, NULL, '440', 'LT', 'LTU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(103, NULL, '442', 'LU', 'LUX', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(104, NULL, '807', 'MK', 'MKD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(105, NULL, '450', 'MD', 'MDG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(106, NULL, '458', 'MY', 'MYS', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(107, NULL, '454', 'MW', 'MWI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(108, NULL, '462', 'MV', 'MDV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(109, NULL, '466', 'ML', 'MLI', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(110, NULL, '470', 'MT', 'MLT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(111, NULL, '504', 'MA', 'MAR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(112, NULL, '584', 'MH', 'MHL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(113, NULL, '480', 'MU', 'MUS', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(114, NULL, '478', 'MR', 'MRT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(115, NULL, '484', 'MX', 'MEX', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(116, NULL, '583', 'FM', 'FSM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(117, NULL, '498', 'MD', 'MDA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(118, NULL, '492', 'MC', 'MCO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(119, NULL, '496', 'MN', 'MNG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(120, NULL, '508', 'MZ', 'MOZ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(121, NULL, '516', 'NA', 'NAM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(122, NULL, '520', 'NR', 'NRU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(123, NULL, '524', 'NP', 'NPL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(124, NULL, '558', 'NI', 'NIC', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(125, NULL, '562', 'NE', 'NER', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(126, NULL, '566', 'NG', 'NGA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(127, NULL, '570', 'NU', 'NIU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(128, NULL, '578', 'NO', 'NOR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(129, NULL, '554', 'NZ', 'NZL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(130, NULL, '512', 'OM', 'OMN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(131, NULL, '800', 'UG', 'UGA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(132, NULL, '860', 'UZ', 'UZB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(133, NULL, '586', 'PK', 'PAK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(134, NULL, '591', 'PA', 'PAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(135, NULL, '598', 'PG', 'PNG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(136, NULL, '600', 'PY', 'PRY', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(137, NULL, '528', 'NL', 'NLD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(138, NULL, '604', 'PE', 'PER', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(139, NULL, '608', 'PH', 'PHL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(140, NULL, '616', 'PL', 'POL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(141, NULL, '620', 'PT', 'PRT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(142, NULL, '634', 'QA', 'QAT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(143, NULL, '140', 'CF', 'CAF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(144, NULL, '214', 'DO', 'DOM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(145, NULL, '203', 'CZ', 'CZE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(146, NULL, '642', 'RO', 'ROU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(147, NULL, '826', 'GB', 'GBR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(148, NULL, '643', 'RU', 'RUS', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(149, NULL, '646', 'RW', 'RWA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(150, NULL, '659', 'KN', 'KNA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(151, NULL, '662', 'LC', 'LCA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(152, NULL, '674', 'SM', 'SMR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(153, NULL, '670', 'VC', 'VCT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(154, NULL, '90', 'SB', 'SLB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(155, NULL, '222', 'SV', 'SLV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(156, NULL, '882', 'WS', 'WSM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(157, NULL, '678', 'ST', 'STP', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(158, NULL, '686', 'SN', 'SEN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(159, NULL, '690', 'SC', 'SYC', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(160, NULL, '694', 'SL', 'SLE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(161, NULL, '702', 'SG', 'SGP', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(162, NULL, '703', 'SK', 'SVK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(163, NULL, '705', 'SI', 'SVN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(164, NULL, '706', 'SO', 'SOM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(165, NULL, '729', 'SD', 'SDN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(166, NULL, '144', 'LK', 'LKA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(167, NULL, '752', 'SE', 'SWE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(168, NULL, '756', 'CH', 'CHE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(169, NULL, '740', 'SR', 'SUR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(170, NULL, '748', 'SZ', 'SWZ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(171, NULL, '760', 'SY', 'SYR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(172, NULL, '762', 'TJ', 'TJK', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(173, NULL, '834', 'TZ', 'TZA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(174, NULL, '148', 'TD', 'TCD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(175, NULL, '764', 'TH', 'THA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(176, NULL, '768', 'TG', 'TGO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(177, NULL, '776', 'TO', 'TON', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(178, NULL, '780', 'TT', 'TTO', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(179, NULL, '788', 'TN', 'TUN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(180, NULL, '795', 'TM', 'TKM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(181, NULL, '792', 'TR', 'TUR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(182, NULL, '798', 'TV', 'TUV', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(183, NULL, '804', 'UA', 'UKR', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(184, NULL, '858', 'UY', 'URY', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(185, NULL, '336', 'VA', 'VAT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(186, NULL, '548', 'VU', 'VUT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(187, NULL, '862', 'VE', 'VEN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(188, NULL, '704', 'VN', 'VNM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(189, NULL, '887', 'YE', 'YEM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(190, NULL, '807', 'MK', 'MKD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(191, NULL, '180', 'CD', 'COD', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(192, NULL, '894', 'ZM', 'ZMB', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(193, NULL, '716', 'ZW', 'ZWE', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(196, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(197, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(198, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(199, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(200, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(201, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(202, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(203, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(204, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(205, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(206, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(207, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(208, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(209, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(210, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(211, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(212, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(213, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(214, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(215, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(216, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(217, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(218, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(219, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(220, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(221, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(222, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(223, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(224, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(225, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(226, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(227, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(228, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(229, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(230, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(231, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(232, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(233, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(234, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(235, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(236, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(237, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(238, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(239, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(240, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(241, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(242, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(243, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(244, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(245, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(246, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(247, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(248, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(249, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(250, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(251, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(252, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(253, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(254, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(255, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(256, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(257, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(258, NULL, '124', 'CA', 'CAN', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(259, NULL, '312', 'GP', 'GLP', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(260, NULL, '254', 'GF', 'GUF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(261, NULL, '474', 'MQ', 'MTQ', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(262, NULL, '175', 'YT', 'MYT', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(263, NULL, '638', 'RE', 'REU', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(264, NULL, '666', 'PM', 'SPM', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(265, NULL, '540', 'NC', 'NCL', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(266, NULL, '258', 'PF', 'PYF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(267, NULL, '876', 'WF', 'WLF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
+(268, NULL, '840', 'US', 'USA', '2013-07-26 14:44:00', '2013-07-26 14:44:00');
diff --git a/install/thelia.sql b/install/thelia.sql
index 62326cc2e..006d86d19 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -483,9 +483,9 @@ DROP TABLE IF EXISTS `address`;
CREATE TABLE `address`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
- `title` VARCHAR(255),
+ `name` VARCHAR(255),
`customer_id` INTEGER NOT NULL,
- `customer_title_id` INTEGER,
+ `title_id` INTEGER NOT NULL,
`company` VARCHAR(255),
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
@@ -502,16 +502,22 @@ CREATE TABLE `address`
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_address_customer_id` (`customer_id`),
- INDEX `idx_address_customer_title_id` (`customer_title_id`),
+ INDEX `idx_address_customer_title_id` (`title_id`),
+ INDEX `idx_address_country_id` (`country_id`),
CONSTRAINT `fk_address_customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_address_customer_title_id`
- FOREIGN KEY (`customer_title_id`)
+ FOREIGN KEY (`title_id`)
REFERENCES `customer_title` (`id`)
ON UPDATE RESTRICT
+ ON DELETE RESTRICT,
+ CONSTRAINT `fk_address_country_id`
+ FOREIGN KEY (`country_id`)
+ REFERENCES `country` (`id`)
+ ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 2ef29e927..de7e6751e 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -351,9 +351,9 @@
| ID | #ID | @@ -10,7 +15,11 @@|
| Title | -#TITLE | ++ {loop name="title" type="title" id="#TITLE"} + #LONG (#SHORT) + {/loop} + |
| Firstname | @@ -36,5 +45,63 @@Discount | #DISCOUNT % |
| ID | +#ID | +
| Name | +#NAME | +
| Title | ++ {loop name="title" type="title"} + #LONG (#SHORT) + {/loop} + | +
| Company | +#COMPANY | +
| Firstname | +#FIRSTNAME | +
| Lastname | +#LASTNAME | +
| Address | +#ADDRESS1 #ADDRESS2 #ADDRESS3 |
+
| Zipcode | +#ZIPCODE | +
| City | +#CITY | +
| Phone | +#PHONE | +
| Cellphone | +#CELLPHONE | +