Join Jon Peck for an in-depth discussion in this video Creating, editing, and debugging entities, part of Up and Running with Symfony2 for PHP (2014).
Let's switch to a browser so we can start using…the newly created code.…Navigate to sandbox dot dev port EDA…slash symphony web app dev, but this time…pass it slash publication as the path.…Fantastic, we've got a simple list.…Nothing that I'd show to an end client,…but it's functional.…There's just one link here,…create a new entry,…so let's click it.…Well, this is a bare bones form,…but it's functional enough.…
Let's specify sandy sure, s-u-r-e for the name,…which is an intentional mistake.…It'll actually be sandy shore.…Click create.…No confirmation is shown,…but there's a very simple view,…a publication ID 1 with a name.…Let's edit it and make sure that it works…by clicking the edit link.…Update the name to sandy shore,…and click update.…Clicking update looks like it does nothing,…but at the bottom of the screen,…the debug component tells a different story.…
Click on the database icon over on the right.…This will show details from the profiler.…Looks like only one query took place, a select.…Wait a second.…Didn't we make a change?…
- Installing Symfony
- Creating a bundle from the console
- Customizing and generating database tables
- Generating controllers
- Creating, editing, and debugging entities
- Displaying and debugging a form
- Rendering content with templates
Skill Level Intermediate
Q: When trying to access the application, I receive an error stating "This script is only accessible from localhost." How can I get around this restriction?
A: The development front controller and configuration scripts are protected by default to only allow access from the localhost. Refer to the video titled “Exploring the Symfony layout” to see how to disable this security.
Q: I specified the wrong database credentials and got an "Access denied for user" error from doctrine. How can I fix the database configuration?
<div>A: The most likely cause is a typo or misconfiguration in the Symfony parameters file, which you can find at ./symfony/app/config/parameters.yml. This file is typically generated during installation using an interactive wizard.</div><div> </div><div>Symfony requires read and write access to a MySQL database, and needs to know how to connect to the database. Therefore, you'll need to specify a username, password, port (if nonstandard), host, and database name. The credentials to your individual development environment are likely different than the ones used in the course; please use your best judgment in determining the correct values. After making a change, verify the configuration by using a web browser to navigate to /symfony/web/config.php, then click “Configure your Symfony Application online” at the bottom of the page.</div>
Q: How can I configure PHP's time zone?
<div>A: You'll need to edit PHP's configuration to specify a time zone. The <em></em><a href="http://www.lynda.com/Apache-tutorials/Up-Running-Linux-PHP-Developers/158372-2.html"><em>Up and Running with Linux for PHP</em> <em>Developers</em></a> PHP configuration can be modified by editing the custom configuration:</div><div> </div><div>sudoedit /etc/php5/mods-available/custom.ini</div><div> </div><div> If you have a different development environment, determine the location of your php.ini configuration file. Specify a date.timezone, such as: </div><div> </div><div>date.timezone = America/Los_Angeles</div><div> </div><div>Then restart the server using: </div><div> </div><div>sudo service apache2 restart</div><div> </div><div>A full list of supported timezones can be found at <a target="_blank" href="http://php.net/manual/en/timezones.php">http://php.net/manual/en/timezones.php</a>.</div><div> </div>