Download the PHP package uestla/yetorm without Composer

On this page you can find all versions of the php package uestla/yetorm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yetorm

YetORM

Build Status Code coverage Total downloads Latest stable

Lightweight ORM built on top of Nette\Database

Buy me a Coffee

Quickstart

Consider following database schema:

Database schema

Entities

Firstly we'll create entity classes according to the schema above. There are two ways of defining entity properties - via @property[-read] annotation, or simply via getter and setter.

Tag

Author

Book

There are some relations at the Book entity - two N:1 Author and M:N Tag relations. Every YetORM\Entity has an instance of YetORM\Record in it, which is a simple wrapper around Nette\Database\Table\ActiveRow. That means that we can access related records or column values through it.

With $record->ref($table, $column) we're accessing related table row in table $table through column $column - pretty simple.

The M:N relation is realized with YetORM\EntityCollection instance - which is a lazy collection of entities. In this case it iterates throw all related rows from book_tag table (first argument), creates instances of Tag (second argument) and on every related book_tag table row it accesses related tag table row (third argument), which then passes to the constructor of Tag entity :-)

This sounds crazy, but it's actually simple to get used to.

With this knowledge we can now simply add some helpful methods to Author entity:

Repositories

Every repository has to have table and entity class name defined - either via @table and @entity annotaion, or via protected $table and $entity class property.

Fetching collections

YetORM\Repository comes with basic findAll() and findBy($criteria) methods, both returning already mentioned EntityCollection.

We can simply iterate through all books

Fetching single entity

Magic findBy<Property>() and getBy<Property>() methods

Instead of manually writing findByTitle($title) method as this

we can just call

That will return a collection of books with that exact title.

To get a single entity use the magic getBy<Property>($value) method:

Just to have the IDE code completion along with this magic methods, we can use the @method annotation:

IMPORTANT: When using magic findBy<Property>() and getBy<Property>() methods, make sure you have the property defined via @property annotation!

NOTE: magic findBy<Property>() and getBy<Property>() do not work on relational properties of type Entity.

Persisting

To persist changes we simply call $repository->persist($entity).

And that's it!

Additional notes

More

For more examples please see the tests.


All versions of yetorm with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
nette/utils Version ^2.4
nette/database Version ^2.4
nette/reflection Version ^2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package uestla/yetorm contains the following files

Loading the files please wait ....