For example, Comment table has foreign key at Author table. How do I create a new author record when I save a new comment? e.g.: Comment: id = 1, author_id = [newly generated id associated with author table], content = "this is a new comment". Author: id = 1, author_name = [newly generated author name].
Symfony: How to save record with undefined foreign key record
576 Views Asked by whamsicore At
1
There are 1 best solutions below
Related Questions in SYMFONY1
- Autoload not pulling in use_helper() after upgrading Symfony 1.4 project to PHP 8.2 via FriendsOfSymfony
- critical error thrown while running command "doctrine:migrations:migrate". Message: "An exception occurred in the driver: could not find driver"
- ExtJs 3.4, ExtDirect, Symfony and PHP 8.2 -> no data is returned
- Remove entitles that never had parent - doctrine
- Symfony JMSSerializer Context : Invalid argument supplied for foreach()
- Cannot login to symfony from Cloudfront
- Upgrade Symfony 1_4 Project to Symfony 5
- Why does RewriteRule x y.php succeed, but RewriteRule x y.php/foo fail?
- Mysql extension not loaded
- In Symfony4 update function not working,after values fetch from database
- Symfony version up-gradation from 3.4 to 4.3 using old folder structure and ERROR
- How to create a manual login from a controller method in symphony old version
- How to update table contents using generator.yml?
- How to configure htaccess to work on subdirectory?
- Fatal error: Uncaught Error: Call to undefined function <function name>
Related Questions in SYMFONY-1.4
- How to resolve 500 | Internal Server Error | Doctrine : Base table or view not found: 1932 Table 'table_name' doesn't exist in engine
- ExtJs 3.4, ExtDirect, Symfony and PHP 8.2 -> no data is returned
- Symfony 1.4 user attributes reappears after removing in async ajax request
- Symfony 1.4: Error Clearing Cache in Maintenance Mode
- Symfony tries to create related record when updating
- Upgrade Symfony 1_4 Project to Symfony 5
- Redirection to a different host without changing the URL
- PHP: In OrangeHRM v4.1.1, how to apply some admin function into employee account
- how to read default values in a symfony 1.4 form?
- php bin/console doctrine:database:create this problem appeared (i'm using symfony4)
- Is there a better approach to sort an array that contains strings of various languages
- How to add style to a form type in symfony?
- How to populate field only with Users who have a certain role in Symfony?
- Can I set html type to the subject of mail using swift?
- Symfony 1.4 / problem with Doctrine when add new table to schema.yml
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
This has nothing to do with Symfony. I assume you're using Doctrine, am I right? Well, all you have to do is to create
CommentandAuthorobjects:Doctrine should recognize that you're using two brand new objects that aren't persisted in database and thus both object will be inserted.