for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SilverShop\Model;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBCurrency;
/**
* A single line in an order. This could be an item, or a subtotal line.
*
* @see OrderItem
* @see OrderModifier
* @property DBCurrency $CalculatedTotal
* @property int $OrderID
* @method Order Order()
*/
class OrderAttribute extends DataObject
{
private static $singular_name = 'Attribute';
$singular_name
private static $plural_name = 'Attributes';
$plural_name
private static $db = [
$db
'CalculatedTotal' => 'Currency',
];
private static $has_one = [
$has_one
'Order' => Order::class,
private static $casting = [
$casting
'TableTitle' => 'Text',
'CartTitle' => 'Text',
private static $table_name = 'SilverShop_OrderAttribute';
$table_name
public function canCreate($member = null, $context = [])
return false;
}
public function canDelete($member = null)
public function isLive()
return (!$this->isInDB() || $this->Order()->IsCart());
* Produces a title for use in templates.
* @return string
public function getTableTitle()
$title = $this->i18n_singular_name();
$this->extend('updateTableTitle', $title);
return $title;
public function getCartTitle()
$title = $this->getTableTitle();
$this->extend('updateCartTitle', $title);
public function ShowInTable()
$showInTable = true;
$this->extend('updateShowInTable', $showInTable);
return $showInTable;