Skip to content

Upgrade api-platform #6211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"ext-zip": "*",
"ext-zlib": "*",
"a2lix/translation-form-bundle": "^3.0",
"api-platform/core": "^2.7",
"api-platform/core": "^3.0",
"beberlei/doctrineextensions": "^1.3",
"chamilo/google-map-form-type-bundle": "1.7",
"chamilo/settings-bundle": "1.3.0",
Expand Down
270 changes: 165 additions & 105 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle::class => ['all' => true],
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
SymfonyCasts\Bundle\ResetPassword\SymfonyCastsResetPasswordBundle::class => ['all' => true],
Expand Down
2 changes: 0 additions & 2 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ api_platform:
Doctrine\ORM\OptimisticLockException: 409
Doctrine\DBAL\Exception\UniqueConstraintViolationException: 409

metadata_backward_compatibility_layer: false

# mercure:
# hub_url: '%env(MERCURE_SUBSCRIBE_URL)%'

Expand Down
119 changes: 34 additions & 85 deletions public/plugin/H5pImport/Entity/H5pImport.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

// For licensing terms, see /license.txt
/* For licensing terms, see /license.txt */

declare(strict_types=1);

namespace Chamilo\PluginBundle\H5pImport\Entity;

Expand All @@ -12,105 +14,52 @@
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* Class H5pImport.
*
* @ORM\Entity()
*
* @ORM\Table(name="plugin_h5p_import")
*/
#[ORM\Entity]
#[ORM\Table(name: 'plugin_h5p_import')]
class H5pImport
{
/**
* @var string
*
* @ORM\Column(name="path", type="text", nullable=false)
*/
protected $path;
#[ORM\Column(name: 'path', type: 'text', nullable: false)]
protected string $path;

/**
* @var string
*
* @ORM\Column(name="relative_path", type="text", nullable=false)
*/
protected $relativePath;
#[ORM\Column(name: 'relative_path', type: 'text', nullable: false)]
protected string $relativePath;

/**
* @var DateTime
*
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)]
protected DateTime $createdAt;

/**
* @var DateTime
*
* @Gedmo\Timestampable(on="update")
*
* @ORM\Column(name="modified_at", type="datetime", nullable=false)
*/
protected $modifiedAt;
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(name: 'modified_at', type: 'datetime', nullable: false)]
protected DateTime $modifiedAt;

/**
* @var int
*
* @ORM\Column(name="iid", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue
*/
private $iid;
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $iid;

/**
* @var Course
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
*
* @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
*/
private $course;
#[ORM\ManyToOne(targetEntity: Course::class)]
#[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)]
private Course $course;

/**
* @var null|Session
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session")
*
* @ORM\JoinColumn(name="session_id", referencedColumnName="id")
*/
private $session;
#[ORM\ManyToOne(targetEntity: Session::class)]
#[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id')]
private ?Session $session;

/**
* @var null|string
*
* @ORM\Column(name="name", type="text", nullable=true)
*/
private $name;
#[ORM\Column(name: 'name', type: 'text', nullable: true)]
private ?string $name;

/**
* @var null|string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
#[ORM\Column(name: 'description', type: 'text', nullable: true)]
private ?string $description;

/**
* @var Collection<int, H5pImportLibrary>
*
* @ORM\ManyToMany(targetEntity="H5pImportLibrary", mappedBy="h5pImports", cascade={"persist"})
*/
private $libraries;
#[ORM\ManyToMany(targetEntity: H5pImportLibrary::class, mappedBy: 'h5pImports', cascade: ['persist'])]
private Collection $libraries;

/**
* @var H5pImportLibrary
*
* @ORM\ManyToOne(targetEntity="H5pImportLibrary")
*
* @ORM\JoinColumn(name="main_library_id", referencedColumnName="iid", onDelete="SET NULL")
*/
private $mainLibrary;
#[ORM\ManyToOne(targetEntity: H5pImportLibrary::class)]
#[ORM\JoinColumn(name: 'main_library_id', referencedColumnName: 'iid', onDelete: 'SET NULL')]
private H5pImportLibrary $mainLibrary;

public function __construct()
{
Expand Down
138 changes: 45 additions & 93 deletions public/plugin/H5pImport/Entity/H5pImportLibrary.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

// For licensing terms, see /license.txt
/* For licensing terms, see /license.txt */

declare(strict_types=1);

namespace Chamilo\PluginBundle\H5pImport\Entity;

Expand All @@ -12,115 +14,65 @@
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* Class H5pImportLibrary.
*
* @ORM\Entity()
*
* @ORM\Table(name="plugin_h5p_import_library")
*/
class H5pImportLibrary extends EntityRepository
#[ORM\Entity]
#[ORM\Table(name: 'plugin_h5p_import_library')]
class H5pImportLibrary
{
/**
* @var \DateTime
*
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)]
protected DateTime $createdAt;

/**
* @var \DateTime
*
* @Gedmo\Timestampable(on="update")
*
* @ORM\Column(name="modified_at", type="datetime", nullable=false)
*/
protected $modifiedAt;
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(name: 'modified_at', type: 'datetime', nullable: false)]
protected DateTime $modifiedAt;

/**
* @var int
*
* @ORM\Column(name="iid", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue
*/
private $iid;
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $iid;

/**
* @ORM\Column(name="title", type="string", nullable=true)
*/
private $title;
#[ORM\Column(name: 'title', type: 'string', nullable: true)]
private ?string $title;

/**
* @ORM\Column(name="machine_name", type="string")
*/
private $machineName;
#[ORM\Column(name: 'machine_name', type: 'string')]
private string $machineName;

/**
* @ORM\Column(name="major_version", type="integer")
*/
private $majorVersion;
#[ORM\Column(name: 'major_version', type: 'integer')]
private int $majorVersion;

/**
* @ORM\Column(name="minor_version", type="integer")
*/
private $minorVersion;
#[ORM\Column(name: 'minor_version', type: 'integer')]
private int $minorVersion;

/**
* @ORM\Column(name="patch_version", type="integer")
*/
private $patchVersion;
#[ORM\Column(name: 'patch_version', type: 'integer')]
private int $patchVersion;

/**
* @ORM\Column(name="runnable", type="integer", nullable=true)
*/
private $runnable;
#[ORM\Column(name: 'runnable', type: 'integer', nullable: true)]
private ?int $runnable;

/**
* @ORM\Column(name="embed_types", type="array", nullable=true)
*/
private $embedTypes;
#[ORM\Column(name: 'embed_types', type: 'array', nullable: true)]
private ?array $embedTypes;

/**
* @ORM\Column(name="preloaded_js" , type="array", nullable=true)
*/
private $preloadedJs;
#[ORM\Column(name: 'preloaded_js', type: 'array', nullable: true)]
private array $preloadedJs;

/**
* @ORM\Column(name="preloaded_css", type="array", nullable=true)
*/
private $preloadedCss;
#[ORM\Column(name: 'preloaded_css', type: 'array', nullable: true)]
private array $preloadedCss;

/**
* @ORM\Column(name="library_path", type="string", length=255)
*/
private $libraryPath;
#[ORM\Column(name: 'library_path', type: 'string', length: 255)]
private string $libraryPath;

/**
* @var Collection<int, H5pImport>
*
* @ORM\ManyToMany(targetEntity="H5pImport", inversedBy="libraries")
*
* @ORM\JoinTable(
* name="plugin_h5p_import_rel_libraries",
* joinColumns={@ORM\JoinColumn(name="h5p_import_library_id", referencedColumnName="iid", onDelete="CASCADE")},
* inverseJoinColumns={@ORM\JoinColumn(name="h5p_import_id", referencedColumnName="iid", onDelete="CASCADE")}
* )
*/
private $h5pImports;

/**
* @var Course
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
*
* @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
*/
private $course;
#[ORM\ManyToMany(targetEntity: H5pImport::class, inversedBy: 'libraries')]
#[ORM\JoinTable(name: 'plugin_h5p_import_rel_libraries')]
#[ORM\JoinColumn(name: 'h5p_import_library_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
#[ORM\InverseJoinColumn(name: 'h5p_import_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
private Collection $h5pImports;

#[ORM\ManyToOne(targetEntity: Course::class)]
#[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)]
private Course $course;

public function __construct()
{
Expand Down
Loading
Loading