PHP code example of geosocio / entity-attacher

1. Go to this page and download the library: Download geosocio/entity-attacher 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/ */

    

geosocio / entity-attacher example snippets


/**
 * @ORM\Entity()
 * @ORM\Table(name="post")
 */
class Post
{

    /**
     * @ORM\ManyToOne(targetEntity="GeoSocio\Core\Entity\User\User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id")
     * @Attach()
     */
    private $user;
}

$post = $this->attacher->attach($post);