Lance

Forget I said anything ^^ had the password wrong in .env 🤦‍♂️

Lance

Trying to access my website remotely and I'm getting the following error in the browser:

[Unknown Error] Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user '<user>'@'localhost' (using password: YES)

I've set up an account and given them all privileges, but am still running into this issue. Anyone have any suggestions?

Lance

Are there some tutorials out there on how to set up and use Typescript in a Silverstripe 4+ project? Also React?

Lance

Thanks brett and stevie, really helpful 🙂 👍!

Lance

Both would be ideal, the getCMSFields and onBeforeWrite methods

Lance

Makes sense! I've dabbled with this approach, but ran into a few issues - any chance you could give me an example?

Lance

I think: ParentPage has_one ChildDataObject ChildDataObject has_one ParentPage

Though I guess ChildDataObject could or should be: ChildDataObject belongs_to ParentPage

Lance

Does anyone know the best way to handle displaying a has_one custom DataObject in the parent's CMS fields? I think I'm looking for something along the lines of this: https://github.com/arillo/silverstripe-GridFieldRelationHandler but am wondering if there is a native implementation or better supported module out there.

So for example, I have 2 classes:

  1. ParentPage (extends Page)
  2. ChildDataObject (extends DataObject)

Setup: ParentPage has one $db field and a $has_one, eg:

  1. $db = 'ParentField' => 'Varchar'
  2. $has_one = 'ChildDataObject' => ChildDataObject::class

ChildDataObject has a couple of $db fields eg: $db = 'FieldOne' => 'HTMLText', 'FieldTwo' => 'Text'

My question is how do I display the ChildDataObject fields nicely in ParentPage getCMSFields? Eg:

  1. function getCMSFields() {
  2.  
  3. $fields = parent::getCMSFields();
  4. $fields->addFieldToTab('Root.Main', TextField::create('ParentField'));
  5.  
  6. // Code here to display HTMLText and Text fields from ChildDataObject
  7.  
  8. $this->extend('updateCMSFields', $fields);
  9. return $fields;
  10. }