PHP code example of fourcoders / latch-bundle

1. Go to this page and download the library: Download fourcoders/latch-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fourcoders / latch-bundle example snippets

js
{
    ""fourcoders/latch-sdk-php": "dev-master",
        "fourcoders/latch-bundle": "dev-master"
    }
}
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Fourcoders\Bundle\LatchBundle\FourcodersLatchBundle(),
    );
}
 php

// src/Acme/UserBundle/Entity/User.php
namespace Acme\UserBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /* Start of the new field */

    /**
     * @var string $latch
     *
     * @ORM\Column(name="latch", type="string", length=255, nullable=true)
     */
    private $latch;    

    /**
     * Set latch
     *
     * @param string $latch
     */
    public function setLatch($latch)
    {
        $this->latch = $latch;
    }

    /**
     * Get latch
     *
     * @return string 
     */
    public function getlatch()
    {
        return $this->latch;
    }   

    /* End of the new field */ 

    public function __construct()
    {
        parent::__construct();
        // your own logic
    }
}
 php

// src/Acme/AccountBundle/Entity/User.php
namespace Acme\AccountBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * @ORM\Entity
 * @UniqueEntity(fields="email", message="Email already taken")
 */
class User
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=255)
     * @Assert\NotBlank()
     * @Assert\Email()
     */
    protected $email;

    /**
     * @ORM\Column(type="string", length=255)
     * @Assert\NotBlank()
     * @Assert\Length(max = 4096)
     */
    protected $plainPassword;

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

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }

    public function getPlainPassword()
    {
        return $this->plainPassword;
    }

    public function setPlainPassword($password)
    {
        $this->plainPassword = $password;
    }

    /* Start of the new field */

    /**
     * @ORM\Column(name="latch", type="string", length=255, nullable=true)
     */
    private $latch;    

    public function setLatch($latch)
    {
        $this->latch = $latch;
    }

    public function getlatch()
    {
        return $this->latch;
    }   

    /* End of the new field */ 

}