Jump to:

7919 Posts in 1358 Topics by 932 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Bug Reports

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Go to End
Author Topic: 38465 Views
  • yurigoul
    Avatar
    Community Member
    200 Posts

    Re: Bug Reports Link to this post

    EDIT: Caching was more agressive than I thought. Should have checked again by changing the name back, sorry!

    When I use: SortableDataObject::add_sortable_class('HomePageEntry'); I get the following error when doing a dev/build:

    ...

    For the rest everything looks fine, thanks for the good work!!!!!!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    Check your code.. you've got whitespace somewhere. Make sure you're not closing your PHP tags.

  • andy_steel
    Avatar
    Community Member
    31 Posts

    Re: Bug Reports Link to this post

    I've found that it is not possible to have a DataObject that relates to itself.

    In my case each product relates to other complimentary products and similar products.

    Eg.

    class Product extends DataObject
    {
       static $many_many = array(
          'ComplimentaryProducts' => 'Product',
          'SimilarProducts' => 'Product'
       );
       
       static $belongs_many_many = array(
          'ComplimentaryProductsBelong' => 'Product',
          'SimilarProductsBelong' => 'Product'
       );
    ...
       function getCMSFields() {
          $fields = parent::getCMSFields();
       
          $ComplimentaryManager = new ManyManyDataObjectManager(
             $this,
             'ComplimentaryProducts',
             'Product',
             array('Name' => 'Name'),
             'getCMSFields_forPopup',
             'Name != "' . $this->Name . '"'
          );
          $fields->addFieldToTab("Root.ComplimentaryProducts", $ComplimentaryManager);

    ...

    In ModelAdmin when this runs I get 100% CPU usage and the server crashes. I don't get any errors in the Apache, PHP or SS error log. I guess there must be a never ending loop.

    Any help would be appreciated.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    I'll take a look at it.. I'm wondering, however, why you wouldn't just use a CheckboxSetField or MultiSelectField to create that relationship. If products are already managed in ModelAdmin, why create multiple workflows for creating them? The DOM seems like overkill in this case.

  • andy_steel
    Avatar
    Community Member
    31 Posts

    Re: Bug Reports Link to this post

    Thanks for the tip about MultiSelectField.

    I wanted to pick a solution that makes it easy to select a few dataobjects out of hundreds.

  • yurigoul
    Avatar
    Community Member
    200 Posts

    Re: Bug Reports Link to this post

    SimpleHTMLEditorfield: produces something like this:

    <div><div>paragraph1</div><div><br></div><div>paragraph2</div></div>

    - <br> should be <br /> if I am using some form of xhtml. I could not find a switch to change this behavior.
    - for some reason br is encapsulated by div, this makes the code less clean
    - Sometimes text does and sometimes text does not get encapsulated by div(s). I think it would be better to encapsulate it in p, and make this standard behavior (so you know what to expect in the output).

    I consider this a bug, but people might disagree of course

    I have now switched to SimpleTinyMCEField because it did not have any of these issues.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    Yeah, SimpleTinyMCE is the way to go. Those other two tools are fairly immature.

  • Andrew Houle
    Avatar
    Community Member
    132 Posts

    Re: Bug Reports Link to this post

    I have a nested FiledDataObject manager. Everything behaves ok, but the name under the file pulls the ID and not the caption that I want. This is my code:

    new FileDataObjectManager(
    $this,
    'ImageFiles',
    'ImageFile',
    'Photo',
    array('Caption'=>'Caption')
    )

    38465 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.