Skip to content

Instantly share code, notes, and snippets.

<?php
define('ZF2_PATH', realpath(__DIR__ . '/../vendor/ZendFramework/library'));
In Controller : $this->getServiceLocator()
In Controller Plugin : $this->getController()->getServiceLocator()
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;
use Zend\Mail\Transport\SmtpOptions;
//////////
$message = new Message();
Join Table scenario Proposal
----------------------------
We have two table named *Album* and *Track* that joined at some function at *Album* table model or *Track* table model.
We can't make a standarditation of where join should comes, because the answer is 'depend' of the case.
so, we need a better scenario that unique, simple, and standardize at this project.
1. create an Album class model
class Album
{
<?php
namespace MyFunnyValentine;
// Detect if the currently matched route belongs to this module.
// The assumption is that the controller name includes the module namespace.
class Module
{
public function onBootstrap($e)
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';
namespace SampleModule\Form;
use Zend\Form\Form;
class SampleForm extends Form
{
public function __construct($name = null)
{
parent::__construct('Sample Form');