Create form entity and repository
[MAILPOET-2639]
This commit is contained in:
committed by
Jack Kitterhing
parent
5baf21a644
commit
5917582f46
@ -168,6 +168,7 @@ class ContainerConfigurator implements IContainerConfigurator {
|
||||
// Form
|
||||
$container->autowire(\MailPoet\Form\Util\FieldNameObfuscator::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Form\AssetsController::class);
|
||||
$container->autowire(\MailPoet\Form\FormsRepository::class);
|
||||
$container->autowire(\MailPoet\Form\Util\Styles::class);
|
||||
// Helpscout
|
||||
$container->autowire(\MailPoet\Helpscout\Beacon::class);
|
||||
|
105
lib/Entities/FormEntity.php
Normal file
105
lib/Entities/FormEntity.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Entities;
|
||||
|
||||
use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait;
|
||||
use MailPoet\Doctrine\EntityTraits\CreatedAtTrait;
|
||||
use MailPoet\Doctrine\EntityTraits\DeletedAtTrait;
|
||||
use MailPoet\Doctrine\EntityTraits\UpdatedAtTrait;
|
||||
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="forms")
|
||||
*/
|
||||
class FormEntity {
|
||||
use AutoincrementedIdTrait;
|
||||
use CreatedAtTrait;
|
||||
use UpdatedAtTrait;
|
||||
use DeletedAtTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="array")
|
||||
* @var array|null
|
||||
*/
|
||||
private $body;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="array")
|
||||
* @var array|null
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
* @var string|null
|
||||
*/
|
||||
private $styles;
|
||||
|
||||
public function __construct($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getBody() {
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getSettings() {
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStyles() {
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $body
|
||||
*/
|
||||
public function setBody($body) {
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $settings
|
||||
*/
|
||||
public function setSettings($settings) {
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $styles
|
||||
*/
|
||||
public function setStyles($styles) {
|
||||
$this->styles = $styles;
|
||||
}
|
||||
|
||||
}
|
21
lib/Form/FormsRepository.php
Normal file
21
lib/Form/FormsRepository.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Form;
|
||||
|
||||
use MailPoet\Doctrine\Repository;
|
||||
use MailPoet\Entities\FormEntity;
|
||||
|
||||
/**
|
||||
* @method FormEntity[] findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null)
|
||||
* @method FormEntity[] findAll()
|
||||
* @method FormEntity|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method FormEntity|null findOneById(mixed $id)
|
||||
* @method void persist(FormEntity $entity)
|
||||
* @method void remove(FormEntity $entity)
|
||||
*/
|
||||
class FormsRepository extends Repository {
|
||||
protected function getEntityClassName() {
|
||||
return FormEntity::class;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user