V8 ORM EntityManagerProvider
Permalink
Hello everyone
I've been struggeling to create a package with custom Entities in V8-style. I've created several packages in the legacy V7-style. This time I would want to add a custom attribute category as described inhttps://documentation.concrete5.org/developers/attributes/advanced-c...
I've followed the following tutorial for the ORM Entities and mapping the PHP namespaces:
https://documentation.concrete5.org/developers/packages/custom-datab...
I realized that apparently the entities are not being written to the DB. Therfore I created a test package (mypack) with just one entity in order to figure out the correct syntax:
File packages/mypack/controller.php:
File packages/mypack/src/Concrete/Entity/Test.php
As soon as I put $appVersionRequired to '7.0.0' the table 'MypackTest' will be created on installation of the package but I can't get it to work for '8.0.0'!
Thank you in advance
Mario
I've been struggeling to create a package with custom Entities in V8-style. I've created several packages in the legacy V7-style. This time I would want to add a custom attribute category as described inhttps://documentation.concrete5.org/developers/attributes/advanced-c...
I've followed the following tutorial for the ORM Entities and mapping the PHP namespaces:
https://documentation.concrete5.org/developers/packages/custom-datab...
I realized that apparently the entities are not being written to the DB. Therfore I created a test package (mypack) with just one entity in order to figure out the correct syntax:
File packages/mypack/controller.php:
<?php namespace Concrete\Package\Mypack; use Concrete\Core\Package\Package; use Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface; use Concrete\Core\Database\EntityManager\Provider\StandardPackageProvider; defined('C5_EXECUTE') or die(_("Access Denied.")); class Controller extends Package implements ProviderAggregateInterface { protected $pkgHandle = 'mypack'; protected $appVersionRequired = '8.0.0'; //Increase this value if changes are made! protected $pkgVersion = '0.0.0'; public function getPackageName() { return t("Test Package");
Viewing 15 lines of 42 lines. View entire code block.
File packages/mypack/src/Concrete/Entity/Test.php
<?php namespace Concrete\Package\Mypack\Entity; use Core; use \Doctrine\ORM\Mapping as ORM; /** * Represents a message for the Debriefing package. * * @ORM\Entity * @ORM\Table( * name="MypackTest", * options={"comment": "Messages of the Debriefing package"} * ) */ class Test {
Viewing 15 lines of 26 lines. View entire code block.
As soon as I put $appVersionRequired to '7.0.0' the table 'MypackTest' will be created on installation of the package but I can't get it to work for '8.0.0'!
Thank you in advance
Mario
And you don't need to use ProviderAggregateInterface.
Please have a look at my package controller:
and the class: