This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ext = pathinfo($entity->get($field)['name'], PATHINFO_EXTENSION); | |
if($entity->has('company')) { | |
$newFileName = $entity->get($field)['name']; | |
} | |
else { | |
$newFileName = Inflector::slug($entity->company) . ".$ext"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<namespace App\Routing\Route; | |
use Cake\Routing\Route\Route; | |
use Cake\ORM\TableRegistry; | |
class AdRoute extends Route | |
{ | |
public function parse($url) | |
{ | |
$params = parent::parse($url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$agent = $this->Agents | |
->find() | |
->where(['Agents.id' => $this->Auth->user('foreign_key')]) | |
->first(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$agent = $this->Agents | |
->find() | |
->where(['Agents.id' => $this->Auth->user('foreign_key')]) | |
->first(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function validationProfile(Validator $validator) | |
{ | |
$validator | |
>requirePresence('username') | |
->notEmpty('username') | |
->add('username', [ | |
'uniqueEmail' => [ | |
'rule' => ['validateUnique', [/*'scope' => 'site_id'*/]], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There were 2 errors: | |
1) Proffer\Tests\Lib\ProfferPathTest::testDeleteFiles | |
Cake\Core\Exception\MissingPluginException: Plugin Proffer could not be found. | |
/vagrant/app/vendor/cakephp/cakephp/src/Core/Plugin.php:263 | |
/vagrant/app/vendor/davidyell/proffer/tests/TestCase/Lib/ProfferPathTest.php:232 | |
2) Proffer\Tests\Model\Behavior\ProfferBehaviorTest::testAfterDelete | |
Cake\Core\Exception\MissingPluginException: Plugin Proffer could not be found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function beforeSave(Event $event, Entity $entity, ArrayObject $options, ProfferPath $path = null) | |
{ | |
foreach ($this->config() as $field => $settings) { | |
if ($entity->has($field) && is_array($entity->get($field)) && | |
$entity->get($field)['error'] === UPLOAD_ERR_OK) { | |
if (!$path) { | |
$path = new ProfferPath($this->_table, $entity, $field, $settings); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function moveUploadedFile($file, $destination) | |
{ | |
if ($this->isUploadedFile($file)) { | |
return move_uploaded_file($file, $destination); | |
} | |
return rename($file, $destination); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function zipcodeToRegion($zipcode, $zipcodeField = 'id', $regionField = 'id') | |
{ | |
$result = $this | |
->find() | |
->select($regionField) | |
->join([ | |
[ | |
'table' => 'provinces', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function zipcodeToRegion($zipcode, $zipcodeField = 'id', $regionField = 'id') | |
{ | |
$result = $this | |
->find() | |
->select($regionField) | |
->join([ | |
[ | |
'table' => 'provinces', |