Call to undefined method Silverstripe GridfieldWhat's the best method for sanitizing user input with PHP?“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHPCall to undefined function curl_init().?Laravel/Ardent - on save(), error: Relationship method must return an object of type IlluminateSilverstripe: Member relation many many null, form front endCalling the default exceptionHandler equivalent in SilverStripe 4Can I have 2 gridfield components in an admin page in Silverstripe 4Silverstripe drag and drop reorderSilverStripe - Undefined Index on DataObject onBeforeWriteIn Silverstripe 4, a standard “Add” button of a GridField does nothing

Was the Lonely Mountain, where Smaug lived, a volcano?

What made the Ancient One do this in Endgame?

Will users know a CardView is clickable

How did the European Union reach the figure of 3% as a maximum allowed deficit?

Should I worry about having my credit pulled multiple times while car shopping?

Can a 40amp breaker be used safely and without issue with a 40amp device on 6AWG wire?

The title "Mord mit Aussicht" explained

Sakkāya-Ditthi and Self-View

How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?

Print the phrase "And she said, 'But that's his.'" using only the alphabet

Manager wants to hire me; HR does not. How to proceed?

How can religions without a hell discourage evil-doing?

How to test soql with For Update statement

Can I give my friend the sour dough "throw away" as a starter to their sourdough starter?

Bullying by school - Submitted PhD thesis but not allowed to proceed to viva until change to new supervisor

Can I appeal credit ding if ex-wife is responsible for paying mortgage?

Are athletes' college degrees discounted by employers and graduate school admissions?

Is it unethical to quit my job during company crisis?

Can Dive Down protect a creature against Pacifism?

What does the output current rating from an H-Bridge's datasheet really mean?

Why is Skinner so awkward in Hot Fuzz?

Leveling up and Getting Items!

Is fission/fusion to iron the most efficient way to convert mass to energy?

Is it possible to install Firefox on Ubuntu with no desktop enviroment?



Call to undefined method Silverstripe Gridfield


What's the best method for sanitizing user input with PHP?“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHPCall to undefined function curl_init().?Laravel/Ardent - on save(), error: Relationship method must return an object of type IlluminateSilverstripe: Member relation many many null, form front endCalling the default exceptionHandler equivalent in SilverStripe 4Can I have 2 gridfield components in an admin page in Silverstripe 4Silverstripe drag and drop reorderSilverStripe - Undefined Index on DataObject onBeforeWriteIn Silverstripe 4, a standard “Add” button of a GridField does nothing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I need to have additional fields on a extended file but there is an error occur.



This will add a gallery tab with GridField which will allow the user to add images.



Not sure what is missing since it is working on other projects.



[Emergency] Uncaught Error: Call to undefined method MyProjectExtensionsBlogPostExtension::BlogGalleryImages()



<?php 


namespace MyProjectExtensions;


use SilverStripeORMDataExtension;
use SilverStripeFormsFieldList;
use SilverStripeFormsTextField;
use SilverStripeFormsGridFieldGridField;
use SilverStripeFormsGridFieldGridFieldConfig_RelationEditor;
use SilverStripeFormsGridFieldGridFieldAddNewButton;
use SilverStripeFormsGridFieldGridFieldDetailForm;
use SilverStripeFormsGridFieldGridFieldEditButton;
use SilverStripeFormsGridFieldGridFieldDeleteAction;
use UndefinedOffsetSortableGridFieldFormsGridFieldSortableRows;
use SilverStripeViewRequirements;
use MyProjectModelBlogGalleryImage;

class BlogPostExtension extends DataExtension

private static $db = [
'SortOrder' => 'Int'
];

private static $has_many = [
"BlogGalleryImages" => BlogGalleryImage::class,
];

public function updateCMSFields(FieldList $fields)
// Add fields here

$fields->removeByName("SortOrder");
$options = $this->BlogGalleryImages();
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldToolbarHeader(),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(80),
new GridFieldDetailForm(),
new GridFieldEditButton(),
new GridFieldDeleteAction()
);
$itemsTable = new GridField("BlogGalleryImages","Gallery Image",$options,$gridFieldConfig);
$fields->addFieldToTab('Root.Gallery',$itemsTable);






Here is the Dataobject file that supposed to be call on BlogPostExtension Class



<?php 

namespace MyProjectModel;

use SilverStripeAssetAdminFormsUploadField;
use SilverStripeAssetsImage;
use SilverStripeORMDataObject;

class BlogGalleryImage extends DataObject

private static $singular_name = 'Gallery Image';

private static $db = array(
'Title' => 'Varchar(256)',
'SortOrder' => 'Int'
);

private static $has_one = array(
'Image' => Image::class,
'BlogPosts' => BlogPost::class,
);

private static $owns = [
'Image',
];

private static $summary_fields = array(
'Thumbnail',
'Title'
);

private static $table_name = 'MyProject_BlogGallery';


private static $default_sort = "SortOrder ASC";

public function getCMSFields()
$fields = parent::getCMSFields();

$fields->removeByName("SortOrder");
$fields->removeByName("BlogPostID");
$fields->addFieldToTab("Root.Main", new TextField("Title","Title"));
$fields->addFieldToTab("Root.Main", $uploadfield = UploadField::create("Image","Image"));
$uploadfield->setFolderName("BlogGallery");

return $fields;


public function getThumbnail()
if ($icon = $this->Image())
return $icon->CMSThumbnail();
else
return '(No Image)';













share|improve this question




























    2















    I need to have additional fields on a extended file but there is an error occur.



    This will add a gallery tab with GridField which will allow the user to add images.



    Not sure what is missing since it is working on other projects.



    [Emergency] Uncaught Error: Call to undefined method MyProjectExtensionsBlogPostExtension::BlogGalleryImages()



    <?php 


    namespace MyProjectExtensions;


    use SilverStripeORMDataExtension;
    use SilverStripeFormsFieldList;
    use SilverStripeFormsTextField;
    use SilverStripeFormsGridFieldGridField;
    use SilverStripeFormsGridFieldGridFieldConfig_RelationEditor;
    use SilverStripeFormsGridFieldGridFieldAddNewButton;
    use SilverStripeFormsGridFieldGridFieldDetailForm;
    use SilverStripeFormsGridFieldGridFieldEditButton;
    use SilverStripeFormsGridFieldGridFieldDeleteAction;
    use UndefinedOffsetSortableGridFieldFormsGridFieldSortableRows;
    use SilverStripeViewRequirements;
    use MyProjectModelBlogGalleryImage;

    class BlogPostExtension extends DataExtension

    private static $db = [
    'SortOrder' => 'Int'
    ];

    private static $has_many = [
    "BlogGalleryImages" => BlogGalleryImage::class,
    ];

    public function updateCMSFields(FieldList $fields)
    // Add fields here

    $fields->removeByName("SortOrder");
    $options = $this->BlogGalleryImages();
    $gridFieldConfig = GridFieldConfig::create()->addComponents(
    new GridFieldAddNewButton('toolbar-header-right'),
    new GridFieldToolbarHeader(),
    new GridFieldSortableHeader(),
    new GridFieldDataColumns(),
    new GridFieldPaginator(80),
    new GridFieldDetailForm(),
    new GridFieldEditButton(),
    new GridFieldDeleteAction()
    );
    $itemsTable = new GridField("BlogGalleryImages","Gallery Image",$options,$gridFieldConfig);
    $fields->addFieldToTab('Root.Gallery',$itemsTable);






    Here is the Dataobject file that supposed to be call on BlogPostExtension Class



    <?php 

    namespace MyProjectModel;

    use SilverStripeAssetAdminFormsUploadField;
    use SilverStripeAssetsImage;
    use SilverStripeORMDataObject;

    class BlogGalleryImage extends DataObject

    private static $singular_name = 'Gallery Image';

    private static $db = array(
    'Title' => 'Varchar(256)',
    'SortOrder' => 'Int'
    );

    private static $has_one = array(
    'Image' => Image::class,
    'BlogPosts' => BlogPost::class,
    );

    private static $owns = [
    'Image',
    ];

    private static $summary_fields = array(
    'Thumbnail',
    'Title'
    );

    private static $table_name = 'MyProject_BlogGallery';


    private static $default_sort = "SortOrder ASC";

    public function getCMSFields()
    $fields = parent::getCMSFields();

    $fields->removeByName("SortOrder");
    $fields->removeByName("BlogPostID");
    $fields->addFieldToTab("Root.Main", new TextField("Title","Title"));
    $fields->addFieldToTab("Root.Main", $uploadfield = UploadField::create("Image","Image"));
    $uploadfield->setFolderName("BlogGallery");

    return $fields;


    public function getThumbnail()
    if ($icon = $this->Image())
    return $icon->CMSThumbnail();
    else
    return '(No Image)';













    share|improve this question
























      2












      2








      2








      I need to have additional fields on a extended file but there is an error occur.



      This will add a gallery tab with GridField which will allow the user to add images.



      Not sure what is missing since it is working on other projects.



      [Emergency] Uncaught Error: Call to undefined method MyProjectExtensionsBlogPostExtension::BlogGalleryImages()



      <?php 


      namespace MyProjectExtensions;


      use SilverStripeORMDataExtension;
      use SilverStripeFormsFieldList;
      use SilverStripeFormsTextField;
      use SilverStripeFormsGridFieldGridField;
      use SilverStripeFormsGridFieldGridFieldConfig_RelationEditor;
      use SilverStripeFormsGridFieldGridFieldAddNewButton;
      use SilverStripeFormsGridFieldGridFieldDetailForm;
      use SilverStripeFormsGridFieldGridFieldEditButton;
      use SilverStripeFormsGridFieldGridFieldDeleteAction;
      use UndefinedOffsetSortableGridFieldFormsGridFieldSortableRows;
      use SilverStripeViewRequirements;
      use MyProjectModelBlogGalleryImage;

      class BlogPostExtension extends DataExtension

      private static $db = [
      'SortOrder' => 'Int'
      ];

      private static $has_many = [
      "BlogGalleryImages" => BlogGalleryImage::class,
      ];

      public function updateCMSFields(FieldList $fields)
      // Add fields here

      $fields->removeByName("SortOrder");
      $options = $this->BlogGalleryImages();
      $gridFieldConfig = GridFieldConfig::create()->addComponents(
      new GridFieldAddNewButton('toolbar-header-right'),
      new GridFieldToolbarHeader(),
      new GridFieldSortableHeader(),
      new GridFieldDataColumns(),
      new GridFieldPaginator(80),
      new GridFieldDetailForm(),
      new GridFieldEditButton(),
      new GridFieldDeleteAction()
      );
      $itemsTable = new GridField("BlogGalleryImages","Gallery Image",$options,$gridFieldConfig);
      $fields->addFieldToTab('Root.Gallery',$itemsTable);






      Here is the Dataobject file that supposed to be call on BlogPostExtension Class



      <?php 

      namespace MyProjectModel;

      use SilverStripeAssetAdminFormsUploadField;
      use SilverStripeAssetsImage;
      use SilverStripeORMDataObject;

      class BlogGalleryImage extends DataObject

      private static $singular_name = 'Gallery Image';

      private static $db = array(
      'Title' => 'Varchar(256)',
      'SortOrder' => 'Int'
      );

      private static $has_one = array(
      'Image' => Image::class,
      'BlogPosts' => BlogPost::class,
      );

      private static $owns = [
      'Image',
      ];

      private static $summary_fields = array(
      'Thumbnail',
      'Title'
      );

      private static $table_name = 'MyProject_BlogGallery';


      private static $default_sort = "SortOrder ASC";

      public function getCMSFields()
      $fields = parent::getCMSFields();

      $fields->removeByName("SortOrder");
      $fields->removeByName("BlogPostID");
      $fields->addFieldToTab("Root.Main", new TextField("Title","Title"));
      $fields->addFieldToTab("Root.Main", $uploadfield = UploadField::create("Image","Image"));
      $uploadfield->setFolderName("BlogGallery");

      return $fields;


      public function getThumbnail()
      if ($icon = $this->Image())
      return $icon->CMSThumbnail();
      else
      return '(No Image)';













      share|improve this question














      I need to have additional fields on a extended file but there is an error occur.



      This will add a gallery tab with GridField which will allow the user to add images.



      Not sure what is missing since it is working on other projects.



      [Emergency] Uncaught Error: Call to undefined method MyProjectExtensionsBlogPostExtension::BlogGalleryImages()



      <?php 


      namespace MyProjectExtensions;


      use SilverStripeORMDataExtension;
      use SilverStripeFormsFieldList;
      use SilverStripeFormsTextField;
      use SilverStripeFormsGridFieldGridField;
      use SilverStripeFormsGridFieldGridFieldConfig_RelationEditor;
      use SilverStripeFormsGridFieldGridFieldAddNewButton;
      use SilverStripeFormsGridFieldGridFieldDetailForm;
      use SilverStripeFormsGridFieldGridFieldEditButton;
      use SilverStripeFormsGridFieldGridFieldDeleteAction;
      use UndefinedOffsetSortableGridFieldFormsGridFieldSortableRows;
      use SilverStripeViewRequirements;
      use MyProjectModelBlogGalleryImage;

      class BlogPostExtension extends DataExtension

      private static $db = [
      'SortOrder' => 'Int'
      ];

      private static $has_many = [
      "BlogGalleryImages" => BlogGalleryImage::class,
      ];

      public function updateCMSFields(FieldList $fields)
      // Add fields here

      $fields->removeByName("SortOrder");
      $options = $this->BlogGalleryImages();
      $gridFieldConfig = GridFieldConfig::create()->addComponents(
      new GridFieldAddNewButton('toolbar-header-right'),
      new GridFieldToolbarHeader(),
      new GridFieldSortableHeader(),
      new GridFieldDataColumns(),
      new GridFieldPaginator(80),
      new GridFieldDetailForm(),
      new GridFieldEditButton(),
      new GridFieldDeleteAction()
      );
      $itemsTable = new GridField("BlogGalleryImages","Gallery Image",$options,$gridFieldConfig);
      $fields->addFieldToTab('Root.Gallery',$itemsTable);






      Here is the Dataobject file that supposed to be call on BlogPostExtension Class



      <?php 

      namespace MyProjectModel;

      use SilverStripeAssetAdminFormsUploadField;
      use SilverStripeAssetsImage;
      use SilverStripeORMDataObject;

      class BlogGalleryImage extends DataObject

      private static $singular_name = 'Gallery Image';

      private static $db = array(
      'Title' => 'Varchar(256)',
      'SortOrder' => 'Int'
      );

      private static $has_one = array(
      'Image' => Image::class,
      'BlogPosts' => BlogPost::class,
      );

      private static $owns = [
      'Image',
      ];

      private static $summary_fields = array(
      'Thumbnail',
      'Title'
      );

      private static $table_name = 'MyProject_BlogGallery';


      private static $default_sort = "SortOrder ASC";

      public function getCMSFields()
      $fields = parent::getCMSFields();

      $fields->removeByName("SortOrder");
      $fields->removeByName("BlogPostID");
      $fields->addFieldToTab("Root.Main", new TextField("Title","Title"));
      $fields->addFieldToTab("Root.Main", $uploadfield = UploadField::create("Image","Image"));
      $uploadfield->setFolderName("BlogGallery");

      return $fields;


      public function getThumbnail()
      if ($icon = $this->Image())
      return $icon->CMSThumbnail();
      else
      return '(No Image)';










      php silverstripe-4






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 2:27









      Capitan KamoteCapitan Kamote

      455




      455






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You're calling an instance method on your extension which doesn't exist:



          $options = $this->BlogGalleryImages();


          This is actually a magic method which represents your has_many relationship "BlogGalleryImages" - this is scaffolded by DataObject. You need to refer to the extension's owner in order to access it:



          $options = $this->getOwner()->BlogGalleryImages();





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330540%2fcall-to-undefined-method-silverstripe-gridfield%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You're calling an instance method on your extension which doesn't exist:



            $options = $this->BlogGalleryImages();


            This is actually a magic method which represents your has_many relationship "BlogGalleryImages" - this is scaffolded by DataObject. You need to refer to the extension's owner in order to access it:



            $options = $this->getOwner()->BlogGalleryImages();





            share|improve this answer



























              1














              You're calling an instance method on your extension which doesn't exist:



              $options = $this->BlogGalleryImages();


              This is actually a magic method which represents your has_many relationship "BlogGalleryImages" - this is scaffolded by DataObject. You need to refer to the extension's owner in order to access it:



              $options = $this->getOwner()->BlogGalleryImages();





              share|improve this answer

























                1












                1








                1







                You're calling an instance method on your extension which doesn't exist:



                $options = $this->BlogGalleryImages();


                This is actually a magic method which represents your has_many relationship "BlogGalleryImages" - this is scaffolded by DataObject. You need to refer to the extension's owner in order to access it:



                $options = $this->getOwner()->BlogGalleryImages();





                share|improve this answer













                You're calling an instance method on your extension which doesn't exist:



                $options = $this->BlogGalleryImages();


                This is actually a magic method which represents your has_many relationship "BlogGalleryImages" - this is scaffolded by DataObject. You need to refer to the extension's owner in order to access it:



                $options = $this->getOwner()->BlogGalleryImages();






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 2:45









                Robbie AverillRobbie Averill

                21.5k74177




                21.5k74177





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330540%2fcall-to-undefined-method-silverstripe-gridfield%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현