Comments (9)
Right now I'm fixing this by adding Filesystem::sync();
to requireDefaultRecords
on a model that's being built after populate.
from silverstripe-populate.
Is this still an issue? I haven't tried this module yet. If so, is it fully fixed using your technique (Filesystem::sync()
)?
from silverstripe-populate.
I havent worked on that project for while, but I believe it solved my issue then.
from silverstripe-populate.
Ok no problem, just curious. Either way, thanks for not only posting about the issue but documenting your fix (for the rest of us)!
from silverstripe-populate.
Looks like it's just not populating the file name? @patricknelson I can take another look at this over this week but if you come across a fix let me know. Running filesystem::sync() is one, but would be interested to work out why it's out of sync in the first place.
from silverstripe-populate.
I actually posted my comment above when researching tools to assist in provisioning content on the site I'm working on but I end up just writing a bash script. It just synchronized our development environments with a central server to keep our dev's working with the same files & database. So, I haven't taken time to look into this myself since I've never even tried this module!
from silverstripe-populate.
Ha yes we had a similar situation and the reason this exists. 8 devs on the team, 2 testers, 1 code base. Populate was super useful, git pull and do a dev/build and you'd all be on the same page. Easy to share state around.
from silverstripe-populate.
5 devs, 1 tester and 0 (to -1) time.
Ok, I decided to test this. Got the same result.
Reading through this code though my hunch is that it's probably not setting the title, which is why the title isn't set. It sounds facetious but I'm not seeing any mechanism here throughout which would do anything to set that title. The Filename, sure. Not the title, hence null.
So, I was looking through Filesystem::sync()
to try and figure out why the hell you get inconsistent results here. Like, you create a File instance and the data model should intuit a title if you don't set one. It does not. Also, somehow, you still get Title
's when you run this ::sync(), but apparently:
It does this without actually using the object model, as this starts messing with all the data. Rather, it does a direct database insert.
Wat? Ok... why not just work with the DataObject model? Is it really that messy or that big of a deal? If you've got good separation of concerns then doing simple tasks wouldn't be so damned complicated and things just fall into place :) Maybe I'm just being a bitter old man.
Anyway -- https://github.com/dnadesign/silverstripe-populate/blob/master/code/PopulateFactory.php#L113
$obj = parent::createObject($class, $identifier, $data);
That raw $data
array is all I see going in there so maybe calling setters there would help a bit. That and calling ->setName(...)
with the filename (to initialize a default) would do, for now. Or you can just set $data["Title"] = $data["Filename"]
.
from silverstripe-populate.
By the way I get that comment above from Folder
's ->constructChild()
method here: https://github.com/silverstripe/silverstripe-framework/blob/3.1/filesystem/Folder.php#L218
from silverstripe-populate.
Related Issues (16)
- How can i create a translation? HOT 1
- PopulateMergeMatch with HasOne? HOT 2
- PopulateMergeMatch does not work as expected HOT 3
- Subsites compatibility HOT 2
- Populate $many_many_extraFields HOT 1
- Release/Tag for SS4 HOT 2
- Allow Populate::requireRecords() to run in live mode HOT 2
- Unable to create PDF file HOT 1
- truncate_objects is not longer an array. HOT 6
- Images cause error when repeatedly running populate task.
- MNT: Move to Github Actions dynamic matrix HOT 1
- Feature Request: truncate_objects should also delete Fluent's Localised table
- Add a note that 3.1.3 is required HOT 1
- increas Maximum execution time
- How to add many_many relation? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-populate.