Fix Exception messages for ObjectIdentity ObjectIdentityInterface doesn't require implementing __toString method, so we need to make sure that object can be converted to string.
This commit is contained in:
parent
f66bed7bac
commit
5f3be0e7cb
@ -194,7 +194,8 @@ class AclProvider implements AclProviderInterface
|
|||||||
foreach ($oids as $oid) {
|
foreach ($oids as $oid) {
|
||||||
if (!$result->contains($oid)) {
|
if (!$result->contains($oid)) {
|
||||||
if (1 === count($oids)) {
|
if (1 === count($oids)) {
|
||||||
throw new AclNotFoundException(sprintf('No ACL found for %s.', $oid));
|
$objectName = method_exists($oid, '__toString') ? $oid : get_class($oid);
|
||||||
|
throw new AclNotFoundException(sprintf('No ACL found for %s.', $objectName));
|
||||||
}
|
}
|
||||||
|
|
||||||
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
|
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
|
||||||
@ -283,7 +284,8 @@ SELECTCLAUSE;
|
|||||||
if (1 === count($types)) {
|
if (1 === count($types)) {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
|
$identifier = (string) $batch[$i]->getIdentifier();
|
||||||
|
$ids[] = $this->connection->quote($identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= sprintf(
|
$sql .= sprintf(
|
||||||
@ -325,17 +327,17 @@ SELECTCLAUSE;
|
|||||||
$query = <<<FINDCHILDREN
|
$query = <<<FINDCHILDREN
|
||||||
SELECT o.object_identifier, c.class_type
|
SELECT o.object_identifier, c.class_type
|
||||||
FROM
|
FROM
|
||||||
{$this->options['oid_table_name']} as o
|
{$this->options['oid_table_name']} o
|
||||||
INNER JOIN {$this->options['class_table_name']} as c ON c.id = o.class_id
|
INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id
|
||||||
INNER JOIN {$this->options['oid_ancestors_table_name']} as a ON a.object_identity_id = o.id
|
INNER JOIN {$this->options['oid_ancestors_table_name']} a ON a.object_identity_id = o.id
|
||||||
WHERE
|
WHERE
|
||||||
a.ancestor_id = %d AND a.object_identity_id != a.ancestor_id
|
a.ancestor_id = %d AND a.object_identity_id != a.ancestor_id
|
||||||
FINDCHILDREN;
|
FINDCHILDREN;
|
||||||
} else {
|
} else {
|
||||||
$query = <<<FINDCHILDREN
|
$query = <<<FINDCHILDREN
|
||||||
SELECT o.object_identifier, c.class_type
|
SELECT o.object_identifier, c.class_type
|
||||||
FROM {$this->options['oid_table_name']} as o
|
FROM {$this->options['oid_table_name']} o
|
||||||
INNER JOIN {$this->options['class_table_name']} as c ON c.id = o.class_id
|
INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id
|
||||||
WHERE o.parent_object_identity_id = %d
|
WHERE o.parent_object_identity_id = %d
|
||||||
FINDCHILDREN;
|
FINDCHILDREN;
|
||||||
}
|
}
|
||||||
@ -363,8 +365,8 @@ QUERY;
|
|||||||
$query,
|
$query,
|
||||||
$this->options['oid_table_name'],
|
$this->options['oid_table_name'],
|
||||||
$this->options['class_table_name'],
|
$this->options['class_table_name'],
|
||||||
$this->connection->quote($oid->getIdentifier()),
|
$this->connection->quote((string) $oid->getIdentifier()),
|
||||||
$this->connection->quote($oid->getType())
|
$this->connection->quote((string) $oid->getType())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,8 +421,8 @@ QUERY;
|
|||||||
$ancestorIds = array();
|
$ancestorIds = array();
|
||||||
foreach ($this->connection->executeQuery($sql)->fetchAll() as $data) {
|
foreach ($this->connection->executeQuery($sql)->fetchAll() as $data) {
|
||||||
// FIXME: skip ancestors which are cached
|
// FIXME: skip ancestors which are cached
|
||||||
|
// Fix: Oracle returns keys in uppercase
|
||||||
$ancestorIds[] = $data['ancestor_id'];
|
$ancestorIds[] = reset($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ancestorIds;
|
return $ancestorIds;
|
||||||
@ -524,7 +526,7 @@ QUERY;
|
|||||||
$auditSuccess,
|
$auditSuccess,
|
||||||
$auditFailure,
|
$auditFailure,
|
||||||
$username,
|
$username,
|
||||||
$securityIdentifier) = $data;
|
$securityIdentifier) = array_values($data);
|
||||||
|
|
||||||
// has the ACL been hydrated during this hydration cycle?
|
// has the ACL been hydrated during this hydration cycle?
|
||||||
if (isset($acls[$aclId])) {
|
if (isset($acls[$aclId])) {
|
||||||
|
@ -51,7 +51,8 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||||||
public function createAcl(ObjectIdentityInterface $oid)
|
public function createAcl(ObjectIdentityInterface $oid)
|
||||||
{
|
{
|
||||||
if (false !== $this->retrieveObjectIdentityPrimaryKey($oid)) {
|
if (false !== $this->retrieveObjectIdentityPrimaryKey($oid)) {
|
||||||
throw new AclAlreadyExistsException(sprintf('%s is already associated with an ACL.', $oid));
|
$objectName = method_exists($oid, '__toString') ? $oid : get_class($oid);
|
||||||
|
throw new AclAlreadyExistsException(sprintf('%s is already associated with an ACL.', $objectName));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->connection->beginTransaction();
|
$this->connection->beginTransaction();
|
||||||
|
Reference in New Issue
Block a user