Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by NotionCommotion

  1. 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
  2. Good morning Barand, I substituted "separator" with a comma and removed the prepared statement WHERE clause for constraint_schema, however, then found that information_schema.key_column_usage.referenced_column_name doesn't exist for me. Ah, just noticed your "Perhaps". Oh well, appreciate your response regardless.
  3. I am trying to get a list of all foreign key constraints and executed the following: SELECT kcu.table_name, kcu.column_name, rel_tco.table_name fk_table_name, ccu.column_name AS fk_column_name, tc.constraint_name FROM information_schema.table_constraints tc INNER JOIN information_schema.key_column_usage kcu ON tc.constraint_schema = kcu.constraint_schema AND tc.constraint_name = kcu.constraint_name INNER JOIN information_schema.constraint_column_usage AS ccu ON ccu.table_schema = tc.table_schema AND ccu.constraint_name = tc.constraint_name INNER JOIN info
  4. Hi Thomas, No direct answer, but have you tried logging/echoing/whatever at the server what it is receiving regarding url, body, headers, etc? Don't know the answer to your issues, but guarantee that if you are getting different results, you are sending a different request.
  5. If you are truly trying to send ?key={' . api_key . '}&email={' . email . '}, that is your error, and you really want to send ?key=yourApiKey&email=theemail@bla.com;
  6. Thank you requinix. Good to know I got two YESs, one MAYBE, and no NOs! It is not Doctrine I am fighting with. Actually know it pretty well. It is that confounding Symfony and associated bundles. I expect I am in the minority in this position, but I focused on SQL first, then PHP, then Doctrine, and only recently Symfony. For instance, I can easily have Doctrine generated SQL for class table inheritance or One-to-One. Inheritance using CTI CREATE TABLE animal ( id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, sex VARCHAR(255) NOT NULL, weight INT NOT NULL, b
  7. DatabaseCat is the same thing as some would have called EntityCat, and some might have named DatabaseCat's animal() method as getAnimal(), true? And as shown in your BusinessCat's constructor, DatabaseCat $cat contains an instance of DatabaseAnimal. And to get it their in the first place, I would use composition: $databaseAnimal = new DatabaseAnimal($dbAnimProp1, $dpAnimProp1); $databaseCat = new DatabaseCat($dbCatProp1, $dbCatProp2, $databaseAnimal); Just making sure I am on the right page.
  8. What information do you wish to obtain from your array? Assuming your array is named $yourArray, then you can access elements in it using something like $yourArray[0] which will also be an array or $yourArray[0]['id'] which will return 5. Try it out and use either print_r() or var_dump() to view the results.
  9. mysqli_query wants at least two things, right? How many did you give it? Look at the second line of your original post. Now, looking below tells you exactly what it wants. Some sort of link and a query and an optional resultmode (in that order). Which one didn't you give it? mysqli_query ( mysqli $link , string $query , int $resultmode = MYSQLI_STORE_RESULT ) : mixed
  10. What does model, view, controller, business model, service, presenter, action, domain, responder, router, mapper, entity, database model all have in common? They are all stuff! I definitely have a hard time keeping them all straight. Which is part of the problem. This API-Platform thing takes care of all the CRUD business logic as well as generating OpenAPI definitions, and then there are hooks to perform application specific business. I suppose I can find some other place to make the inheritance happen but then would be totally deviating from the intended approach. Well, actually ma
  11. Please read the following, and tell me what it says in your own words. Fatal error: Uncaught ArgumentCountError: mysqli_query() expects at least 2 arguments, 1 given
  12. First look at what error message PHP send you. Then take a look at https://www.php.net/manual/en/mysqli.query.php You are doing the procedural (non OOP) version. mysqli_query ( mysqli $link , string $query , int $resultmode = MYSQLI_STORE_RESULT ) : mixed When you call a function or method, you need to provide something for all the arguments (i.e. inputs to the function) unless the input is followed by "=someDefaultValue". So, you don't send the just the query but first the mysqli link and then the query.
  13. Where do you think all the Labadoodle cam from? Regardless, agree it is way to much. Was driving home last night and realized why some dislike too abstract of examples. Attempting to model life itself with a couple classes? Sure, we can extend a couple classes and have an academic run() and speak() method, but quickly breaks down. And for composition, suppose I would need to inject about a billion objects to even pretend to be doing so. Was hoping to add this before your response. Can't totally blame myself, however. Went online to look for examples and just about every one has to do w
  14. I was envisioning something like the following where $dog = new Animal(new DogDna());. I guess I still have the issue of inheritance at the DNA level as I would need a many-to-one relationship between animal and abstractDna, but hopefully less of an issue as it is a more isolated scope. class Animal { /** * @var DnaInterface */ private DnaInterface $dna; public function __construct(DnaInterface $dna) { $this->dna = $dna; } public function run() { $this->dna->run(); } } Humm, Initially, thought it looked of
  15. I am using API-Platform, Doctrine, and Symfony with entities that utilize class type inheritance to extend an abstract entity. I've been running into one issue after another primarily related to the serialization process (serialization groups, parent annotations not propagated to the child, etc), and while I am sure user error on my part is part of the culprit, it appears that API-Platform and potentially Symfony and Doctrine don't fully support entity inheritance. My reason for thinking so is the incredibly sparse amount of documentation on the subject and remarks on quite a few github
  16. Thanks kicken, Yeah, my memory is more fuzzy than I wish to admit. Gotcha on the other parts. I found that I would need to explicitly set some ORM monitored parameter such as updatedAt so that listeners actually listened to non-ORM monitored properties such as $newPasword. Appreciate and enjoy the rest of your weekend.
  17. Hello again kicken, I struggled a little on using the correct interfaces and classes. First tried Symfony\Component\EventDispatcher\EventSubscriberInterface instead of your EventSubscriber, and found not only did it need to be static, also never called my post and pre load methods. Then tried Doctrine\Common\EventSubscriber and while it didn't need to be static, still never called the post/pre load methods. Only did Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface work as desired. Using PHP 8 and Symfony 5.2.3. Look like I am doing things right but just a diffe
  18. Thanks kicken, Good information. I actually hate the magic. I waste so much time figuring out why something is happening that shouldn't and finally discover it is something I totally didn't expect. Regarding scanning files, Symfony 5.2.3 seems to scan all PHP files in src/* as you said. If I start some file but then don't finish it, I need to change the extension from .php to .php.tmp or I get errors (unless they are cached, sometimes). Didn't know about that single line service definition. Thanks.
  19. Yes, I need to get over my class stinginess and create separate classes. At first putting a couple of tasks in a single class doesn't sting me, but eventually often does. I also like your approach of adding the EncodeOnPersistInterface to any entities that need it. Keeps things in one place. At first I thought it would be less code duplication to perform the encoding in EncodeOnPersist, but the more I think about it, the more I prefer your implementation. Thanks! Takes some of the magic away and makes me confident I can do this! One question I forgot to ask.
  20. Currently, I am using Doctrine events (prePersist or preUpdate as necessary) to do similar. For instance, new User is added but their password isn't yet hashed and they also need an account for another API so UserDoctrineEntityListner hashes their password and makes a cURL request to create their account and set's User's otherApiProperty using the response. On updating some user property which is shared with the other API, I do similarly but don't need the response to update the User entity. You "could have" done the same when you saved the approved timestamp. Was your primary reason why n
  21. I am a little confused with the difference between Symfony Events and Event Listners and Doctrine Events. The Doctrine events look pretty straight forward and are primary used for entity persistence, and I have outlined my understanding below: Doctrine Lifecycle Callbacks. Single entity and single Doctrine event. Method in class. Good performance. Don't have access to Symfony services (all others do) Doctrine Lifecycle Listeners. All entities and single Doctrine event. Separate class and configured in config.se
  22. You mean this? $fields = array('id','type'); $fields[] = 'etc'; //$fields now is array('id','type', 'etc')
  23. As indicated by my initial post, the api-platform documentation only shows PHP 8 attributes, but I don't have PHP 8 and therefore need to convert them. But there is no way to convert them. Unless by a human. Maybe.
  • 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.