This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Admin; | |
use App\Entity\FooEntity; | |
use SilverStripe\Admin\ModelAdmin; | |
class FooAdmin extends ModelAdmin { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use SilverStripe\ORM\DataObject; | |
class BarEntity extends DataObject { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use SilverStripe\ORM\DataObject; | |
class FooEntity extends DataObject { | |
private static $db = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\TextType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\Form\FormEvent; | |
use Symfony\Component\Form\FormEvents; | |
class TestType extends AbstractType { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class FolderUpdateFilesystemExtension fixes issue silverstripe-framework#4993: | |
* Renaming Folders over more than two nested levels fails | |
*/ | |
class FolderUpdateFilesystemExtension extends DataExtension { | |
public function onAfterWrite() { | |
$this->enhancedUpdateFilesystem(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function updateFilesystem() { | |
$filenameBeforeUpdate = $this->Filename; | |
parent::updateFilesystem(); | |
if($filenameBeforeUpdate != $this->Filename){ | |
// in this case the filename has changed due to a changed parent | |
// we need to write the change to the db, otherwise the children won't see it | |
$this->write(); | |
// no need to proceed as this method has already been called again by the write above |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Allows visitors to like each Page once per IP | |
// Code submitted by relaxt confusion labs | |
class Page extends SiteTree { | |
private static $has_many = array( | |
'Likes' => 'Page_Like' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This RedirectorPage differs from the regular one in so far, as it only redirects | |
* on the index action (no action specified) in contrast to the original one, | |
* which redirects on any immediate suburl | |
* | |
* @author Stephan Bauer <sb@relaxt.at> | |
*/ | |
class BetterRedirectorPage extends RedirectorPage { |