2017 © Pedro Peláez
 

project laravel5-doctrine

The Doctrine Orm Form Laravel Framework.

image

uedehua/laravel5-doctrine

The Doctrine Orm Form Laravel Framework.

  • Sunday, July 12, 2015
  • by uedehua
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Doctrine 2 for Laravel5

Latest Stable Version License Total Downloads, (*1)

A Doctrine 2 implementation that melts with Laravel 5.1.X., (*2)

Documentation

Begin reading the full documentation here or go to a specific chapter right away., (*3)

  1. Installation
  2. How It Works
    1. Basics
    2. Entity Manager
    3. Timestamps
    4. Soft Deleting
    5. Authentication
  3. Schemas
  4. Doctrine Configuration
    1. Metadata Configuration
    2. Annotation Reader
    3. Metadata
  5. MIT License

Caveats

As a result the composer install may require you to change the minimum-stability in your composer.json to dev., (*4)

如果你不想影响其他包的稳定性, 您可以在您的 composer.json增加下面的属性:, (*5)

"prefer-stable": true, (*6)

安装

通过Composer安装之前,编辑你项目的 composer.json 文件,添加 uedehua/laravel5-doctrine., (*7)

这个代码还处于早期阶段,但功能齐全。可以预料会有一些小得变化,不会有大得变动., (*8)

"require": {
    "uedehua/laravel5-doctrine": "5.1.*"
}

接下来,通过Composer命令更新你得项目:, (*9)

php composer update

一旦安装了包,您需要添加服务供应商. 打开项目 app/config/app.php 配置文件, 在providers数组内添加新的项目., (*10)

'UeDehua\LaravelDoctrine\Provider\DoctrineOrmProvider'

接下来添加Facade. 打开 app/config/app.php 配置文件, 在aliases数组内添加新的项目., (*11)

'DoctrineOrm' => 'UeDehua\LaravelDoctrine\Facade\DoctrineOrm'

别忘记发布你的配置., (*12)

php artisan config:publish uedehua/laravel5-doctrine --path=vendor/uedehua/laravel5-doctrine/config

2 Minutes

This package uses the Laravel database configuration and thus it works right out of the box. With the Entity Manager facade (or service locator) you can interact with repositories. It might be wise to check out the Doctrine 2 docs to know how it works. The little example below shows how to use the EntityManager in it simplest form., (*13)

<?php

$user = new User;
$user->setName('Mitchell');

EntityManager::persist($user);
EntityManager::flush();

The User used in the example above looks like this., (*14)

<?php

use Doctrine\ORM\Mapping AS ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="hk_user")
 */
class User
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string")
     */
    private $name;

    public function getId()
    {
        return $this->id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }
}

If you've only used Eloquent and its models this might look bloated or frightening, but it's actually very simple. Let me break the class down., (*15)

<?php

use Doctrine\ORM\Mapping AS ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="hk_user")
 */
class User
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string")
     */
    private $name;
}

The only thing that's actually important in this entity are the properties. This shows you which data the entity holds., (*16)

With Doctrine 2 you can't interact with database by using the entity User. You'll have to use Entity Manager and repositories. This does create less overhead since your entities aren't extending the whole Eloquent model class. Which can dramatically slow down your application a lot if you're working with thousands or millions of records., (*17)

License

This package is licensed under the MIT license., (*18)

The Versions

12/07 2015

5.1.x-dev

5.1.9999999.9999999-dev

The Doctrine Orm Form Laravel Framework.

  Sources   Download

MIT

The Requires

 

by 陈德华

laravel framework doctrine

12/07 2015

dev-master

9999999-dev

The Doctrine Orm Form Laravel Framework.

  Sources   Download

MIT

The Requires

 

by 陈德华

laravel framework doctrine