Source of file Equipment.php
Size: 1,275 Bytes - Last Modified: 2021-12-23T10:06:30+00:00
/var/www/docs.ssmods.com/process/src/src/Listings/Equipment.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 | <?php namespace NobrainerWeb\Bilinfo\Listings; use NobrainerWeb\Bilinfo\Listings\Access\ListingPermissions; use SilverStripe\ORM\DataObject; class Equipment extends DataObject { use ListingPermissions; private static $table_name = 'NW_BI_Equipment'; private static $singular_name = 'Vehicle equipment'; private static $plural_name = 'Vehicle equipment'; private static $description = 'Represents extra equipment of a vehicle'; /** * List of database fields. {@link DataObject::$db} * * @var array */ private static $db = [ 'Title' => 'Varchar' ]; private static $summary_fields = [ 'Label', 'Title', ]; private static $searchable_fields = ['Title']; private static $belongs_many_many = [ 'Listings' => Listing::class ]; protected function onBeforeDelete() { // clean up relation table $this->Listings()->removeAll(); parent::onBeforeDelete(); } /** * @return string|null */ public function getLabel(): ?string { if (!$this->Title) { return null; } return _t(__CLASS__ . '.' . $this->Title, $this->getTitle()); } } |