Add SQL migration for new order column and fix docblocks

This commit is contained in:
Thibaud Fabre
2016-05-11 16:59:36 +02:00
parent 957d588d6f
commit 2e815bc463
9 changed files with 115 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ class Version
/**
* @var string
*/
private $number = '4.0.0-alpha.6';
private $number = '4.0.0-alpha.7';
/**
* @var string

View File

@@ -75,7 +75,7 @@ class Order
/**
* @ORM\Column(type="string", length=32, name="notification_method")
*/
private $notificationMethod = 'email';
private $notificationMethod;
/**
* Constructor
@@ -83,6 +83,7 @@ class Order
public function __construct()
{
$this->elements = new ArrayCollection();
$this->notificationMethod = self::NOTIFY_MAIL;
}
/**
@@ -301,8 +302,10 @@ class Order
}
/**
* @param string $methodName Sets the name of the notification method to handle this order's status change
* Sets the name of the notification method to handle this order's status change
* notifications.
* @param string $methodName
* @return void
*/
public function setNotificationMethod($methodName)
{

View File

@@ -77,6 +77,7 @@ class OrderElementView
/**
* @param \media_subdef[] $subdefs
* @return void
*/
public function setOrderableMediaSubdefs($subdefs)
{

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,16 +23,19 @@ interface ValidationNotifier
/**
* @param Order $order
* @param User $recipient
* @return void
*/
public function notifyCreation(Order $order, User $recipient);
/**
* @param OrderDelivery $delivery
* @return void
*/
public function notifyDelivery(OrderDelivery $delivery);
/**
* @param OrderDelivery $delivery
* @return void
*/
public function notifyDenial(OrderDelivery $delivery);

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.

View File

@@ -3,7 +3,7 @@
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -36,7 +36,7 @@ class ValidationNotifierRegistry
public function getNotifier($notificationMethodName)
{
if (! isset($this->notifiers[$notificationMethodName])) {
throw new InvalidArgumentException('Undefined notifier for method: ' . $notificationMethodName);
throw new InvalidArgumentException(sprintf('Undefined notifier for method: %s', $notificationMethodName));
}
return $this->notifiers[$notificationMethodName];

View File

@@ -0,0 +1,36 @@
<?php
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Alchemy\Phrasea\Model\Entities\Order;
use Doctrine\DBAL\Migrations\AbstractMigration as BaseMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160511160640 extends BaseMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql(sprintf("ALTER TABLE Orders ADD COLUMN notification_method VARCHAR(32) NOT NULL DEFAULT '%s'", Order::NOTIFY_MAIL));
$this->addSql("ALTER TABLE Orders ALTER COLUMN notification_method DROP DEFAULT");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql("ALTER TABLE Orders DROP COLUMN notification_method");
}
}

View File

@@ -0,0 +1,64 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class patch_400alpha7a implements patchInterface
{
/** @var string */
private $release = '4.0.0-alpha.7';
/** @var array */
private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [
'20160511160640'
];
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
return true;
}
}