Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


NotionCommotion last won the day on July 2 2019

NotionCommotion had the most liked content!

Community Reputation

32 Good

About NotionCommotion

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Agree, code thankfully doesn't behave randomly, only me! Also, agree I shouldn't import stuff I don't need, but frustrating that there appears to be no way to determine whether stuff is needed other than trial and error. Back to earlier question, you think PHP8 attributes might be more consistent (assuming the framework supports them)? If you don't know, have what I need. Thanks
  2. Yes! When you commented about the "parser", is this PHP's C code or PHP application code part of a given framework (i.e. Doctrine, Symfony)? If the later, I could see how one might get different results, but would not expect these two frameworks to implement it differently. Also, you will see that the traits provided in the original post use other traits. It is my understanding that doing so is acceptable but maybe I am not doing so correctly?
  3. The "application" I was referring to is Symfony and/or Doctrine. Take the following class which uses the traits posted in my original post: <?php namespace App\Entity\MultiTenenacy; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\SerializedName; use App\Entity\Owner\Owner; /** * @ORM\Entity() */ class Test { use PublicIdTenantTrait; /** * @ORM\Column(type="string", length=255) */ private $name; } When checking the schema, all validates. But then I comment out the use in
  4. Thanks requinix, Appears that imports for non-annotation purposes (i.e. type declaration, creating a new object) should be located in the file where they are being used, right? For annotation purposes, sounds like it is based on how the given application's author elected to write the application, true? Is there any approach that is more typical than the other? Does it make sense to always import in both the trait and the class? Do you know whether PHP 8's attributes are independent of the application?
  5. Haven't really used traits much and am confused whether to import other classes in the trait or the class that uses the trait (might also be an annotation question but not sure). Must import statements (i.e. use Foo\Bar;) be included in the class or can they be included in just the trait which is used by a class? Does it depend and if so on what? Does having one class use another class impact the decision? Is it okay for one trait to use another and another trait to just use the first trait or should it use both? What is odd is I apparently must (to not get an error) import ApiPro
  6. Thanks requinix, Maybe but not sure. Will need to discuss with others. Think I am going to use what I learned here for something else. Have so many dang duplicated photos it stresses me to even attempt to organize them. Should be fairly easy to sort by size and then compare. But then I will want to read the meta data and such. Maybe another day... Appreciate the help.
  7. There are two types of users: vendor users and end users. Vendor users will be uploading files during the project execution and the path where they were posted will remain the path that will retrieve them. End users will later inherit the documents and will only care about quickly getting documents about what they care about. They may still care about whether it was uploaded 10 different times and for which project it was uploaded under, but will not wish to take time determining whether they are looking at the same or different files, and instead will be presented with just the unique file
  8. I agree and the primary reason is to improve the user experience regarding identical files. Various users will be uploading various documents and these documents will be associated with multiple scopes and these scopes will be associated with multiple projects and these projects will be associated with multiple assets. The majority of the documents will be PDF's and will often be downloaded from the same source and be identical but will likely have different filenames. When the project is over, other users will need to access the documents and will perform searches based on things they unde
  9. Thanks requinix and mac_gyver, Sounds like going with MD5 and then some additional checks is the route to go. I would like to provide a little more context and explore a related topic. The application for documentation management and is multitenancy where each tenant will only have access to their own documents. That being said, if two files owned by two tenants is the same string of bits, only the user_provided_filename and uploaded_at belongs to the tenant and the physical file belongs to both of them. My schema will look something like the following, and the physical file w
  10. Thanks gw1500se, Looks like I can go with MD5 and also invest $1 in the lottery as insurance. Why do you recommend going with MD5 and not SHA-1 (or even SHA-256) from the get-go? I didn't say so but the frequency of uploading files will be fairly low. Thanks requeinx, For my application, duplicates will be very likely as users will often upload the same document for multiple opportunities. Would you still recommend also comparing the size (likely will include both the hash, size, and mime type in the query) and the content? Surprisingly to me, it takes about 5 times longer to calcula
  11. When a file is uploaded, I wish to determine whether an existing identical file (regardless of what it is named or what extension it has) already exists and if so don't save the newly uploaded file but just point it to the existing one. My primary reason for doing so is not really to save hard drive space but to be able to manage duplicate documents. One option is to store a hash of the documents in the DB and when a new document is uploaded, query the DB to see if an identical hash exists. How certain can one be that two hashes will never be duplicated? Another option is to compar
  12. Neither did I for quite a while based on your advice. My main reason for starting to use them was being able to see all relevant information in one place (i.e. database and serialization). That being said, have special comments in code still kind of annoys me, and I like having this content divorced from the code. Still find it kind of odd that someone hasn't come up with a annotation formatter/validator. Guess much is based on what is using them, but still...
  13. Bad question or no answers? Does difficulty of formatting annotations annoy anyone other than me?
  14. I always struggle with keeping my annotations pretty. Just about ever IDE beautifies PHP, there are many online PHP beautifiers, and notepad++ and other apps are available. None of them seem to work with annotations. Also, would like to validate them at the same time. Anyone know of any plugins or websites which do this? I would be fine with just cutting and pasting just the comment block and it need not format the entire PHP script (I probably wouldn't even use the PHP portions as git would probably see changes). If nothing is available, suppose I could create one myself. Befor
  15. Using postgresql, not mysql. michael=# \d information_schema.key_column_usage View "information_schema.key_column_usage" Column | Type | Collation | Nullable | Default -------------------------------+------------------------------------+-----------+----------+--------- constraint_catalog | information_schema.sql_identifier | | | constraint_schema | information_schema.sql_identifier | | | constraint_name | information_schema.sql_i
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.