[DDC-551] Various minor fixes after merge and cleanup
This commit is contained in:
parent
be48821e86
commit
4c94a7ccc5
@ -1020,6 +1020,7 @@ class BasicEntityPersister
|
||||
|
||||
if ($assoc['isOwningSide']) {
|
||||
$this->_selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($assoc['joinColumns']);
|
||||
$this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) .' ON ';
|
||||
|
||||
foreach ($assoc['sourceToTargetKeyColumns'] AS $sourceCol => $targetCol) {
|
||||
if ( ! $first) {
|
||||
@ -1027,7 +1028,7 @@ class BasicEntityPersister
|
||||
}
|
||||
$tableAlias = $this->_getSQLTableAlias($assoc['targetEntity'], $assocAlias);
|
||||
$this->_selectJoinSql .= $this->_getSQLTableAlias($assoc['sourceEntity']) . '.' . $sourceCol . ' = '
|
||||
. $tableAlias . '.' . $targetCol . ' ';
|
||||
. $tableAlias . '.' . $targetCol;
|
||||
$first = false;
|
||||
}
|
||||
|
||||
@ -1536,7 +1537,7 @@ class BasicEntityPersister
|
||||
|
||||
$alias = $this->_getSQLTableAlias($this->_class->name);
|
||||
|
||||
$sql = 'SELECT 1'
|
||||
$sql = 'SELECT 1 '
|
||||
. $this->getLockTablesSql($alias)
|
||||
. ' WHERE ' . $this->_getSelectConditionSQL($criteria);
|
||||
|
||||
|
@ -401,10 +401,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLockTablesSql()
|
||||
public function getLockTablesSql($alias = null)
|
||||
{
|
||||
$idColumns = $this->_class->getIdentifierColumnNames();
|
||||
$baseTableAlias = $this->_getSQLTableAlias($this->_class->name);
|
||||
$baseTableAlias = null !== $alias ? $alias : $this->_getSQLTableAlias($this->_class->name);
|
||||
|
||||
// INNER JOIN parent tables
|
||||
$joinSql = '';
|
||||
|
@ -42,7 +42,7 @@ abstract class SQLFilter
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
final function setParameter($name, $value, $type)
|
||||
final public function setParameter($name, $value, $type)
|
||||
{
|
||||
// @todo: check for a valid type?
|
||||
$this->parameters[$name] = array('value' => $value, 'type' => $type);
|
||||
@ -56,7 +56,7 @@ abstract class SQLFilter
|
||||
return $this;
|
||||
}
|
||||
|
||||
final function getParameter($name)
|
||||
final public function getParameter($name)
|
||||
{
|
||||
if(!isset($this->parameters[$name])) {
|
||||
throw new \InvalidArgumentException("Parameter '" . $name . "' does not exist.");
|
||||
@ -65,13 +65,13 @@ abstract class SQLFilter
|
||||
return $this->em->getConnection()->quote($this->parameters[$name]['value'], $this->parameters[$name]['type']);
|
||||
}
|
||||
|
||||
final function __toString()
|
||||
final public function __toString()
|
||||
{
|
||||
return serialize($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The contstraint if there is one, empty string otherwise
|
||||
* @return string The constraint if there is one, empty string otherwise
|
||||
*/
|
||||
abstract function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias);
|
||||
abstract public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias);
|
||||
}
|
||||
|
@ -29,6 +29,17 @@ use Doctrine\ORM\Configuration,
|
||||
*/
|
||||
class FilterCollection
|
||||
{
|
||||
/* Filter STATES */
|
||||
/**
|
||||
* A filter object is in CLEAN state when it has no changed parameters.
|
||||
*/
|
||||
const FILTERS_STATE_CLEAN = 1;
|
||||
|
||||
/**
|
||||
* A filter object is in DIRTY state when it has changed parameters.
|
||||
*/
|
||||
const FILTERS_STATE_DIRTY = 2;
|
||||
|
||||
private $config;
|
||||
private $em;
|
||||
private $filters;
|
||||
@ -45,36 +56,41 @@ class FilterCollection
|
||||
*/
|
||||
private $filterHash;
|
||||
|
||||
/* Filter STATES */
|
||||
/**
|
||||
* A filter object is in CLEAN state when it has no changed parameters.
|
||||
*/
|
||||
const FILTERS_STATE_CLEAN = 1;
|
||||
|
||||
/**
|
||||
* A filter object is in DIRTY state when it has changed parameters.
|
||||
*/
|
||||
const FILTERS_STATE_DIRTY = 2;
|
||||
|
||||
/**
|
||||
* @var integer $state The current state of this filter
|
||||
* @var integer $state The current state of this filter
|
||||
*/
|
||||
private $filtersState = self::FILTERS_STATE_CLEAN;
|
||||
|
||||
final public function __construct(EntityManager $em)
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param EntityManager $em
|
||||
*/
|
||||
public function __construct(EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->config = $em->getConfiguration();
|
||||
}
|
||||
|
||||
/** @return SQLFilter[] */
|
||||
/**
|
||||
* Get all the enabled filters.
|
||||
*
|
||||
* @return array The enabled filters.
|
||||
*/
|
||||
public function getEnabledFilters()
|
||||
{
|
||||
return $this->enabledFilters;
|
||||
}
|
||||
|
||||
/** Throws exception if filter does not exist. No-op if the filter is alrady enabled.
|
||||
* @return SQLFilter */
|
||||
/**
|
||||
* Enables a filter from the collection.
|
||||
*
|
||||
* @param mixed $name Name of the filter.
|
||||
*
|
||||
* @throws \InvalidArgumentException If the filter does not exist.
|
||||
*
|
||||
* @return SQLFilter The enabled filter.
|
||||
*/
|
||||
public function enable($name)
|
||||
{
|
||||
if(null === $filterClass = $this->config->getFilterClassName($name)) {
|
||||
@ -94,7 +110,15 @@ class FilterCollection
|
||||
return $this->enabledFilters[$name];
|
||||
}
|
||||
|
||||
/** Disable the filter, looses the state */
|
||||
/**
|
||||
* Disables a filter.
|
||||
*
|
||||
* @param mixed $name Name of the filter.
|
||||
*
|
||||
* @return SQLFilter The disabled filter.
|
||||
*
|
||||
* @throws \InvalidArgumentException If the filter does not exist.
|
||||
*/
|
||||
public function disable($name)
|
||||
{
|
||||
// Get the filter to return it
|
||||
@ -108,7 +132,15 @@ class FilterCollection
|
||||
return $filter;
|
||||
}
|
||||
|
||||
/** throws exception if not in enabled filters */
|
||||
/**
|
||||
* Get an enabled filter from the collection.
|
||||
*
|
||||
* @param mixed $name Name of the filter.
|
||||
*
|
||||
* @return SQLFilter The filter.
|
||||
*
|
||||
* @throws \InvalidArgumentException If the filter is not enabled.
|
||||
*/
|
||||
public function getFilter($name)
|
||||
{
|
||||
if(!isset($this->enabledFilters[$name])) {
|
||||
@ -146,6 +178,9 @@ class FilterCollection
|
||||
return $filterHash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the filter state to dirty.
|
||||
*/
|
||||
public function setFiltersStateDirty()
|
||||
{
|
||||
$this->filtersState = self::FILTERS_STATE_DIRTY;
|
||||
|
@ -99,4 +99,4 @@ class DDC633Patient
|
||||
* @OneToOne(targetEntity="DDC633Appointment", mappedBy="patient")
|
||||
*/
|
||||
public $appointment;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user