Giter VIP home page Giter VIP logo

Comments (9)

anselmdk avatar anselmdk commented on June 12, 2024

Right now I'm fixing this by adding Filesystem::sync(); to requireDefaultRecords on a model that's being built after populate.

from silverstripe-populate.

patricknelson avatar patricknelson commented on June 12, 2024

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.

anselmdk avatar anselmdk commented on June 12, 2024

I havent worked on that project for while, but I believe it solved my issue then.

from silverstripe-populate.

patricknelson avatar patricknelson commented on June 12, 2024

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.

wilr avatar wilr commented on June 12, 2024

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.

patricknelson avatar patricknelson commented on June 12, 2024

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.

wilr avatar wilr commented on June 12, 2024

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.

patricknelson avatar patricknelson commented on June 12, 2024

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.

patricknelson avatar patricknelson commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.