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

Notice framework/dev/deprecation php Page,Holder class


Go to End


2 Posts   1391 Views

Avatar
jelavuk

Community Member, 1 Post

22 March 2013 at 12:15pm

hello,
i have the problem.
I created classes CompanyPage,CompanyHolder and ss template.
When I tried to create CompanyPage(after created companyholder) appear notice Notice framework/dev/deprecation.php.
Where i'm wrong?

<?php

/**
* Defines the CompanyPage page type
*/
class CompanyPage extends Page {
static $db = array(
'Company_name' => 'Text',
'Email' => 'Text',
'Adress' => 'Text',
'Phone_number' => 'Text'

);
static $default_parent = 'CompanyHolder';
//static $has_one = array();

public static $has_one = array(
);

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

$fields->addFieldToTab('Root.Content.Main', new TextField('Company_name'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Email'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Adress'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Phone_number'), 'Content');
//$fields->addFieldToTab('Root.Content.Main', new DateField('DateCreated'), 'Content');
// $fields->addFieldToTab('Root.Content.Main', new DateField('DateLogin'), 'Content');
//$this->extend('updateCMSFields', $fields);
return $fields;
}
}

class CompanyPage_Controller extends Page_Controller {

}

?>
<?php

/**

*/
class CompanyHolder extends Page {
public static $db = array(
);

public static $has_one = array(
);
static $allowed_children = array(
'CompanyPage'
);
}

class CompanyHolder_Controller extends Page_Controller {

}

?>

CompanyHolder.ss:
<div class="content-container unit size3of4 lastUnit">
<article>
<h1>$Title</h1>
<div class="content">$Content</div>
</article>
<% loop Children %>
$Company_name

<% end_loop %>

</div>

companPage.ss:
$Content

Avatar
martimiz

Forum Moderator, 1391 Posts

24 March 2013 at 9:16am

A deprecation notice in SilverStripe usually means that some function in your code should either no longer be used in the current version of SilverStripe, or a function/property definition has changed (public added to it, or an extra parameter) and you should change your subclassed version accordingly.

This of course depends on the SilverStripe version you have installed, and the (custom) code you are using. The deprecation notice should tell you more about the affected code, so you can look up the equivalent from the parent class. If this doesn't make it clear, you could post the complete deprecation message here.