Tag: ORM

Syncing a ManyManyList

Sometimes you want to update a ManyMany relation to have exact this set of foreign keys. Not just adding and deleting, but both - best in just one call.
Read more about 'Syncing a ManyManyList'...

Get Related Pages, or: Filter By Many_Many Relation

On our Slack community channel today one question was, how to get all other pages with the same tags like the current page.
Read more about 'Get Related Pages, or: Filter By Many_Many Relation'...

Listening to changes in many_many relationships, but not hack the framework...

I wanted to add logging but changes to the relationships wasn't obvious at first and then I remembered I could overide the class managing the relationships...
Read more about 'Listening to changes in many_many relationships, but not hack the framework...'...

Module Review : SilverGraph

One common question when getting started with silverstripe is how to see the database.
Read more about 'Module Review : SilverGraph'...

Switch Text to HTMLText on the fly

Assuming you have a model using plain scaffolding (like my simple team listing module for SilverStripe does) you can easily switch a $db field from Text to HTMLText in your...
Read more about 'Switch Text to HTMLText on the fly'...

Diagram of relationships in SilverStripe

After reading https://docs.silverstripe.org/en/3.1/developer_guides/model/ you might need a quick reminder on the relationships between objects... here is a quick visual reminder...
Read more about 'Diagram of relationships in SilverStripe'...

Access external database

If you wish to access an external database either with the ORM or with a direct DB::Query you can...
Read more about 'Access external database'...

Save $many_many_extraFields when adding a DataObject to a list

Assuming you have a $many_many relation and SortOrder defined as $many_many_extraFields you can add an item to this ManyManyList and pass the extraFields as an array:
Read more about 'Save $many_many_extraFields when adding a DataObject to a list'...
RSS feed for this blog