1 / 2

What is Active Record in Yii2

Learn about Active Record in Yii2. Yii2 comes with various strong classes to represent data both in and out of our database, just like many modern web frameworks. We can abstract using these classes.

XcelTec1
Download Presentation

What is Active Record in Yii2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What is Active Record in Yii2? An object-oriented interface is used by the database access and manipulation tool Active Record. An Active Record class and instance are linked to a table in a database, and an attribute of an instance of Active Record is tied to the value of a particular column in that row. Instead of using raw SQL commands, you would use Active Record properties and Active Record methods to retrieve and modify the data stored in database tables. What is Yii2's character? The base of Yii To build behaviours, utilise the behaviour class. A behaviour integrates its own methods and properties into a component by attaching to it. The events that the component has created can also be reacted to by behavioural patterns. What should you do if a Yii DB exception is thrown? Sets a callable that will be used if a yiidbException is thrown during the execution of a command, such as an anonymous function. The signature of the callable must be: The DB connection to which this command is attached serves as its default fetch mode.

  2. Active Record offers an object-oriented API for data access. An Active Record class is linked to a database table. Active Record support is available in Yii for the following relational databases: ● MySQL 4.1 or later ● SQLite 2 and 3 ● PostgreSQL 7.3 or later ● Microsoft SQL Server 2008 or later ● CUBRID 9.3 or later ● Oracle ● Elastic Search ● Sphinx You should follow these steps to query data from a separate database table after establishing an Active Record class (in our example, the user model). ● Using the yiidbActiveRecord::find() method, create a new query object. ● Create a query object. ● To get data, use a query method. Conclusion I hope my explanation of Active Record in Yii2 was useful to you. You can get aid from Virtual Developers from XcelTec with your tasks. Visit to explore more on What is Active Record in Yii2? Get in touch with us for more! Contact us on:- +91 987 979 9459 | +1 919 400 9200 Email us at:- sales@xceltec.com

More Related