Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Created First Model Class and got the following warnings.


Go to End


7 Posts   1803 Views

Avatar
Naveed

Community Member, 10 Posts

4 April 2016 at 12:17pm

Edited: 05/04/2016 3:45pm

Hi,

I am new to Silverstripe. I am following the Developer documentation pages to learn it. I have created a first class in the mysite/model/Gallery.php and when I used to build it using the following url i.e. http://localhost/mysite/dev/build the got the following warnings i.e.

Warning: array_change_key_case() expects parameter 1 to be array, null given in C:\wamp\www\silverstripe\mysite\framework\core\manifest\ConfigManifest.php on line 288

Warning: Invalid argument supplied for foreach() in C:\wamp\www\silverstripe\mysite\framework\core\manifest\ConfigManifest.php on line 655

In addition, the page is continuously refresh automatically.

I am using the silverstripe 3.3 (stable) version.
Environment Details: WAMP 3.0 (64 bit), PHP 5.6.16, MySQL 5.7.9, Apache 2.4.17

Looking forward for some help on the topic.

Image will be found at http://postimg.org/image/7jdi31pjl/

Here is the code that I have written for the Model class i.e.

class Gallery extends DataObject {
    private static $db = array(
        'ImageDesc' => 'Varchar(255)',
        'ImagePath' => 'Varchar(255)'
    );
}

Cheers,
Naveed.

Avatar
camfindlay

Forum Moderator, 267 Posts

5 April 2016 at 3:22pm

Put your Gallery.php in /mysite/code/Gallery.php - it would also be good to see the content of the Gallery.php file. Also, dod the site work before you added this custom code?

Avatar
Naveed

Community Member, 10 Posts

6 April 2016 at 9:36am

Edited: 06/04/2016 10:39am

Hi Cam,
Thanks for your response. I put the file as specified into /mysite/code/Gallery.php but its' not working and is getting the same error. I have used the ?flush=1 parameter in the url http://localhost:8011/silverstripe/mysite/dev/build?flush=1 but the error is still same.
You have used "dod" in your reply, what does it mean?

In addition, I have removed the Gallery.php file and then tried http://localhost:8011/silverstripe/mysite/dev/build and found the same errors which seems there is an issue within the core code, I think.

Cheers,
Naveed.

Avatar
camfindlay

Forum Moderator, 267 Posts

6 April 2016 at 1:55pm

typo, I meant "did" (though in a New Zealand accent, did kinda sounds like dod :D ).

Avatar
camfindlay

Forum Moderator, 267 Posts

6 April 2016 at 1:56pm

correct URL to dev/build will be http://localhost/silverstripe/dev/build (note no mysite)

Avatar
Naveed

Community Member, 10 Posts

6 April 2016 at 3:13pm

Edited: 06/04/2016 3:21pm

Hi Cam, thanks for the reply. When I use the following url

http://localhost:8011/silverstripe/mysite/dev/build

then I got the errors and when I changed to

http://localhost:8011/silverstripe/dev/build

as advised then I got the error message i.e.The requested URL /silverstripe/dev/build was not found on this server.

NOTE: I have installed silverstripe in to the root folder mysite/. It contains another folder i.e. the inner folder where I put my code. I hope you understand. Kindly don't confuse with the URL but kindly looking forward for the reason of the error that is not understandable for me.

Avatar
Naveed

Community Member, 10 Posts

15 April 2016 at 11:17am

Warning: Invalid argument supplied for foreach() in C:\wamp\www\silverstripe\mysite\framework\core\manifest\ConfigManifest.php on line 655

I found that the error above is due to the empty mysite/_config/routes.yml file added. I just removed the routes.yml file and then tired /dev/build url and it gave no error this time.

Hope someone else will take benefit of this error.