-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learning Phalcon PHP
By :
By using the ORM, there is virtually no need to write any SQL in your code. Everything is OOP, and it is using the models to perform operations. The first, and the most basic, operation is retrieving data. In the old days, you would do this:
$result = mysql_query("SELECT * FROM article");The class that our models are extending is \Phalcon\Mvc\Model. This class has some very useful methods built in, such as find(), findFirst(), count(), sum(), maximum(), minimum(), average(), save(), create(), update(), and delete().
We have already used the find() method in our article manager when calling Article::find(). By default, this method will return all the records from the article table, sorting them in a natural order. It also accepts an array with parameters. The following code examples will explain this:
$article_slug = "test-article-short-title";
$result = Article::find(
[
"article_slug = :article_slug...
Change the font size
Change margin width
Change background colour