mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Add SQL migration for new order column and fix docblocks
This commit is contained in:
@@ -16,7 +16,7 @@ class Version
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $number = '4.0.0-alpha.6';
|
private $number = '4.0.0-alpha.7';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@@ -75,7 +75,7 @@ class Order
|
|||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=32, name="notification_method")
|
* @ORM\Column(type="string", length=32, name="notification_method")
|
||||||
*/
|
*/
|
||||||
private $notificationMethod = 'email';
|
private $notificationMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -83,6 +83,7 @@ class Order
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->elements = new ArrayCollection();
|
$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.
|
* notifications.
|
||||||
|
* @param string $methodName
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setNotificationMethod($methodName)
|
public function setNotificationMethod($methodName)
|
||||||
{
|
{
|
||||||
|
@@ -77,6 +77,7 @@ class OrderElementView
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \media_subdef[] $subdefs
|
* @param \media_subdef[] $subdefs
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setOrderableMediaSubdefs($subdefs)
|
public function setOrderableMediaSubdefs($subdefs)
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* 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
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
@@ -23,16 +23,19 @@ interface ValidationNotifier
|
|||||||
/**
|
/**
|
||||||
* @param Order $order
|
* @param Order $order
|
||||||
* @param User $recipient
|
* @param User $recipient
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function notifyCreation(Order $order, User $recipient);
|
public function notifyCreation(Order $order, User $recipient);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param OrderDelivery $delivery
|
* @param OrderDelivery $delivery
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function notifyDelivery(OrderDelivery $delivery);
|
public function notifyDelivery(OrderDelivery $delivery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param OrderDelivery $delivery
|
* @param OrderDelivery $delivery
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function notifyDenial(OrderDelivery $delivery);
|
public function notifyDenial(OrderDelivery $delivery);
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* 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
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* 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
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* 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
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
@@ -36,7 +36,7 @@ class ValidationNotifierRegistry
|
|||||||
public function getNotifier($notificationMethodName)
|
public function getNotifier($notificationMethodName)
|
||||||
{
|
{
|
||||||
if (! isset($this->notifiers[$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];
|
return $this->notifiers[$notificationMethodName];
|
||||||
|
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
64
lib/classes/patch/400alpha7a.php
Normal file
64
lib/classes/patch/400alpha7a.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user