Skip to content

Commit

Permalink
try workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 3, 2024
1 parent 57356f2 commit f6f646f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions docs/en/cookbook/custom_documentclass_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ custom mapper::

/* prepare the doctrine configuration */
$config = new \Doctrine\ODM\PHPCR\Configuration();
$map = array(
$map = [
'standard-templating-kit:pages/stkSection' => \Sandbox\MagnoliaBundle\Document\Section::class,
);
];
$mapper = new MagnoliaDocumentClassMapper($map);
$config->setDocumentClassMapper($mapper);

Expand Down Expand Up @@ -125,18 +125,18 @@ of instantiating the default one. An example from the `symfony cmf sandbox`_
$container
->register('doctrine.odm_configuration', '%doctrine_phpcr.odm.configuration.class%')
->addMethodCall('setDocumentClassMapper', array(
->addMethodCall('setDocumentClassMapper', [
new Reference('sandbox_magnolia.odm_mapper'),
))
])
;
$container ->setDefinition('sandbox_amgnolia.odm_mapper', new Definition(
MagnoliaDocumentClassMapper::class,
array(
array(
[
[
'standard-templating-kit:pages/stkSection' => Section::class,
),
),
],
],
));
.. _`symfony cmf sandbox`: https://github.com/symfony-cmf/cmf-sandbox/tree/magnolia_integration
27 changes: 13 additions & 14 deletions lib/Doctrine/ODM/PHPCR/Query/Builder/ConverterBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Doctrine\ODM\PHPCR\Query\Builder;

use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
use Doctrine\ODM\PHPCR\Query\Builder\AbstractNode as QBConstants;
use PHPCR\Query\QOM\BindVariableValueInterface;
use PHPCR\Query\QOM\ChildNodeInterface;
use PHPCR\Query\QOM\ChildNodeJoinConditionInterface;
Expand Down Expand Up @@ -117,7 +116,7 @@ protected function dispatchMany(array $nodes): void
*
* @return object|array - PHPCR QOM object or array of objects
*/
public function dispatch(QBConstants $node)
public function dispatch(AbstractNode $node)
{
$methodName = sprintf('walk%s', $node->getName());

Expand All @@ -134,7 +133,7 @@ public function dispatch(QBConstants $node)
/**
* @return ColumnInterface[]
*/
public function walkSelect(QBConstants $node): array
public function walkSelect(AbstractNode $node): array
{
$columns = [];

Expand Down Expand Up @@ -175,7 +174,7 @@ public function walkSelectAdd(SelectAdd $node): array
return $this->columns;
}

public function walkFrom(QBConstants $node): SourceInterface
public function walkFrom(AbstractNode $node): SourceInterface
{
$source = $node->getChild();
$res = $this->dispatch($source);
Expand Down Expand Up @@ -234,11 +233,11 @@ public function walkWhereOr(WhereOr $whereOr): ConstraintInterface

protected function walkSourceJoin(SourceJoin $node): JoinInterface
{
$left = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_LEFT));
$left = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_LEFT));
\assert($left instanceof SourceInterface);
$right = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_RIGHT));
$right = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_RIGHT));
\assert($right instanceof SourceInterface);
$cond = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_CONDITION_FACTORY));
$cond = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_CONDITION_FACTORY));
\assert($cond instanceof JoinConditionInterface);

return $this->qomf()->join($left, $right, $node->getJoinType(), $cond);
Expand Down Expand Up @@ -302,7 +301,7 @@ protected function walkSourceJoinConditionSameDocument(SourceJoinConditionSameDo
);
}

protected function doWalkConstraintComposite(QBConstants $node, $method)
protected function doWalkConstraintComposite(AbstractNode $node, $method)
{
$children = $node->getChildren();

Expand Down Expand Up @@ -391,10 +390,10 @@ protected function walkConstraintChild(ConstraintChild $node): ChildNodeInterfac
protected function walkConstraintComparison(ConstraintComparison $node): ComparisonInterface
{
$dynOp = $node->getChildOfType(
QBConstants::NT_OPERAND_DYNAMIC
AbstractNode::NT_OPERAND_DYNAMIC
);
$statOp = $node->getChildOfType(
QBConstants::NT_OPERAND_STATIC
AbstractNode::NT_OPERAND_STATIC
);

$phpcrDynOp = $this->dispatch($dynOp);
Expand All @@ -412,7 +411,7 @@ protected function walkConstraintComparison(ConstraintComparison $node): Compari
protected function walkConstraintNot(ConstraintNot $node): ConstraintInterface
{
$con = $node->getChildOfType(
QBConstants::NT_CONSTRAINT
AbstractNode::NT_CONSTRAINT
);

$phpcrCon = $this->dispatch($con);
Expand Down Expand Up @@ -464,7 +463,7 @@ protected function walkOperandDynamicName(OperandDynamicName $node): NodeNameInt
protected function walkOperandDynamicLowerCase(OperandDynamicLowerCase $node): LowerCaseInterface
{
$child = $node->getChildOfType(
QBConstants::NT_OPERAND_DYNAMIC
AbstractNode::NT_OPERAND_DYNAMIC
);

$phpcrChild = $this->dispatch($child);
Expand All @@ -478,7 +477,7 @@ protected function walkOperandDynamicLowerCase(OperandDynamicLowerCase $node): L
protected function walkOperandDynamicUpperCase(OperandDynamicUpperCase $node): UpperCaseInterface
{
$child = $node->getChildOfType(
QBConstants::NT_OPERAND_DYNAMIC
AbstractNode::NT_OPERAND_DYNAMIC
);

$phpcrChild = $this->dispatch($child);
Expand Down Expand Up @@ -513,7 +512,7 @@ protected function walkOrderBy(OrderBy $node): array
foreach ($orderings as $ordering) {
\assert($ordering instanceof Ordering);
$dynOp = $ordering->getChildOfType(
QBConstants::NT_OPERAND_DYNAMIC
AbstractNode::NT_OPERAND_DYNAMIC
);

$phpcrDynOp = $this->dispatch($dynOp);
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/PHPCR/Query/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function testExecuteParameters(): void
->method('bindValue')
->with(
$this->callback(function (string $key): bool {
return $key === 'kfoo' || $key === 'kbar';
return 'kfoo' === $key || 'kbar' === $key;
}), $this->callback(function (string $value): bool {
return $value === 'bar' || $value === 'foo';
return 'bar' === $value || 'foo' === $value;
})
)
;
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit_doctrine_dbal.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<var name="jackalope.doctrine.dbal.user" value="root" />
<var name="jackalope.doctrine.dbal.password" value="" />
<var name="jackalope.doctrine.dbal.dbname" value="phpcr_odm_tests" />
<var name="jackalope.doctrine.dbal.charset" value="utf8mb4" />
<var name="DOCTRINE_PHPCR_USER" value="admin" />
<var name="DOCTRINE_PHPCR_PASS" value="admin" />
<var name="DOCTRINE_PHPCR_WORKSPACE" value="default" />
Expand Down

0 comments on commit f6f646f

Please sign in to comment.