Skip to content

Commit 8be4bfa

Browse files
committed
Plugin: XApi: Get changes from fixes for 1.11.x
See chamilo#3943
1 parent 4e2f0e6 commit 8be4bfa

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

public/plugin/xapi/php-xapi/lrs-bundle/src/Model/StatementsFilterFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public function createFromParameterBag(ParameterBag $parameters)
8484
$filter->descending();
8585
}
8686

87+
$filter->cursor($parameters->getInt('cursor'));
8788
$filter->limit($parameters->getInt('limit'));
8889

8990
return $filter;

public/plugin/xapi/php-xapi/lrs-bundle/src/Resources/config/routing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</route>
1414

1515
<route id="xapi_lrs.statement.post" path="/statements" methods="POST">
16-
<default key="_controller">xapi_lrs.controller.statement.post:postStatement</default>
16+
<default key="_controller">xapi_lrs.controller.statement.post:postStatements</default>
1717
<default key="xapi_serializer">statement</default>
1818
<default key="xapi_lrs.route">
1919
<bool>true</bool>

public/plugin/xapi/php-xapi/repository-doctrine-orm/src/StatementRepository.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,25 @@ public function findStatements(array $criteria)
3838
$criteria['context'] = $contexts;
3939
}
4040

41+
if (!empty($criteria['verb'])) {
42+
$verbs = $this->_em->getRepository(Verb::class)->findBy(['id' => $criteria['verb']]);
43+
44+
$criteria['verb'] = $verbs;
45+
}
46+
4147
unset(
4248
$criteria['registration'],
4349
$criteria['related_activities'],
4450
$criteria['related_agents'],
4551
$criteria['ascending'],
46-
$criteria['limit']
4752
);
4853

49-
return parent::findBy($criteria, ['created' => 'ASC']);
54+
return parent::findBy(
55+
$criteria,
56+
['created' => 'ASC'],
57+
$criteria['limit'] ?? null,
58+
$criteria['cursor'] ?? null
59+
);
5060
}
5161

5262
public function storeStatement(Statement $mappedStatement, $flush = true): void

src/CoreBundle/Entity/XApiObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class XApiObject
9090
/**
9191
* @var Collection<int, self>
9292
*/
93-
#[ORM\OneToMany(mappedBy: 'group', targetEntity: self::class)]
93+
#[ORM\OneToMany(mappedBy: 'group', targetEntity: self::class, cascade: ['persist', 'remove'])]
9494
#[ORM\JoinColumn(referencedColumnName: 'identifier')]
9595
private Collection $members;
9696

src/CoreBundle/Entity/XApiVerb.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class XApiVerb
2020
#[ORM\Column(length: 255)]
2121
private ?string $id = null;
2222

23-
#[ORM\Column]
24-
private array $display = [];
23+
#[ORM\Column(nullable: true)]
24+
private ?array $display = null;
2525

2626
public function getIdentifier(): ?int
2727
{
@@ -40,12 +40,12 @@ public function setId(string $id): static
4040
return $this;
4141
}
4242

43-
public function getDisplay(): array
43+
public function getDisplay(): ?array
4444
{
4545
return $this->display;
4646
}
4747

48-
public function setDisplay(array $display): static
48+
public function setDisplay(?array $display): static
4949
{
5050
$this->display = $display;
5151

src/CoreBundle/Migrations/Schema/V200/Version20240515094800.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function up(Schema $schema): void
5252
}
5353

5454
if ($hasTblVerb) {
55-
$this->addSql("ALTER TABLE xapi_verb CHANGE display display LONGTEXT NOT NULL COMMENT '(DC2Type:json)'");
55+
$this->addSql("ALTER TABLE xapi_verb CHANGE display display LONGTEXT NULL COMMENT '(DC2Type:json)'");
5656
} else {
57-
$this->addSql("CREATE TABLE xapi_verb (identifier INT AUTO_INCREMENT NOT NULL, id VARCHAR(255) NOT NULL, display LONGTEXT NOT NULL COMMENT '(DC2Type:json)', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC");
57+
$this->addSql("CREATE TABLE xapi_verb (identifier INT AUTO_INCREMENT NOT NULL, id VARCHAR(255) NOT NULL, display LONGTEXT NULL COMMENT '(DC2Type:json)', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC");
5858
}
5959

6060
if ($hasTblObject) {

0 commit comments

Comments
 (0)