Posts

Showing posts with the label symfony

Symfony Doctrine: records added to table unexpectedly

In my Symfony code I've used Doctrine. In an Entity ( AppBundleEntityCoreUser ) I defined a column foodTypes , which is associated with another Entity (AppBundleEntityFoodRecordingFoodType). I've defined an Many-to-Many relationship between User and FoodType , with a linking table foodrecording_user , joining User.username and FoodType.foodtype_code . The code is shown below. As expected, I can fetch foodTypes of a certain user, and everything seems like good, until I occasionally found out that ... everytime I run the application, it seems like that the program unexpectedly adds new records in the table foodrecording_user , for instance, if the original contents in this table are: Then, after running the application with the user named 30001180, the contents will turn to be something like: Here the 112 is the ID (primary key) of the user (with username 30001180). That means, the program seems to duplicate the records of the user, just replacing the username (30001180) with ...

Call to a member function isCollection() on null

I, using the Graphaware Neo4j-php-OGM. I would like to access the 2nd level relationship. I can't seen to get it to work. What am i doing wrong? I'm trying to execute the following: Stacktrace: It throws the error on the 2nd foreach loop on line: foreach ($role->getPermissions() as $perm) It's strange, working the first time correctly and not the 2nd time. Also after fetching the object again to be sure. Without this it throws the exact same notice. Thanks in advance! All code is at github: https://github.com/djkevino/Support4Neo Looking for an answer drawing from credible and/or official sources. Honestly, pretty confused by this code. The var_dump() die() stuff in destroy() ... Also, took me a while to realize we are talking about code in the library, not your code that interacts with this library. Can you avoid the issue like so? If you are not on PHP version 7.1 or greater you could simply check if the returned value is_null or test for instance of Traversable and...