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.

Data Model Questions /

Notice framework/dev/deprecation php Page,Holder class


Reply


2 Posts   511 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, 1098 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.